Pre-fill geometry, state etc. to inactive settings in order to
make it simpler to have an equivalent of 3.2's Save window settings. svn path=/trunk/kdebase/kwin/; revision=335931
This commit is contained in:
parent
72504ad4a4
commit
a9517d38c2
3 changed files with 50 additions and 4 deletions
|
@ -61,9 +61,7 @@ void DetectDialog::readWindow( WId w )
|
|||
emit detectionDone( false );
|
||||
return;
|
||||
}
|
||||
KWin::WindowInfo info = KWin::windowInfo( w,
|
||||
NET::WMName | NET::WMWindowType,
|
||||
NET::WM2WindowClass | NET::WM2WindowRole | NET::WM2ClientMachine );
|
||||
info = KWin::windowInfo( w, -1U, -1U ); // read everything
|
||||
if( !info.valid())
|
||||
{
|
||||
emit detectionDone( false );
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "detectwidgetbase.h"
|
||||
|
||||
#include <kdialogbase.h>
|
||||
#include <netwm_def.h>
|
||||
#include <kwin.h>
|
||||
|
||||
#include "../../rules.h"
|
||||
|
||||
|
@ -53,6 +53,7 @@ class DetectDialog
|
|||
QString selectedTitle() const;
|
||||
Rules::StringMatch titleMatch() const;
|
||||
QCString selectedMachine() const;
|
||||
const KWin::WindowInfo& windowInfo() const;
|
||||
signals:
|
||||
void detectionDone( bool );
|
||||
protected:
|
||||
|
@ -71,8 +72,15 @@ class DetectDialog
|
|||
QCString machine;
|
||||
DetectWidget* widget;
|
||||
QDialog* grabber;
|
||||
KWin::WindowInfo info;
|
||||
};
|
||||
|
||||
inline
|
||||
const KWin::WindowInfo& DetectDialog::windowInfo() const
|
||||
{
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
||||
|
|
|
@ -506,6 +506,16 @@ bool RulesWidget::setWindow( WId w )
|
|||
return detect_dlg_ok;
|
||||
}
|
||||
|
||||
#define GENERIC_PREFILL( var, func, info, uimethod ) \
|
||||
if( !enable_##var->isChecked()) \
|
||||
{ \
|
||||
var->uimethod( func( info )); \
|
||||
}
|
||||
|
||||
#define CHECKBOX_PREFILL( var, func, info ) GENERIC_PREFILL( var, func, info, setChecked )
|
||||
#define LINEEDIT_PREFILL( var, func, info ) GENERIC_PREFILL( var, func, info, setText )
|
||||
#define COMBOBOX_PREFILL( var, func, info ) GENERIC_PREFILL( var, func, info, setCurrentItem )
|
||||
|
||||
void RulesWidget::detected( bool ok )
|
||||
{
|
||||
if( ok )
|
||||
|
@ -540,12 +550,42 @@ void RulesWidget::detected( bool ok )
|
|||
machine->setText( detect_dlg->selectedMachine());
|
||||
machine_match->setCurrentItem( Rules::UnimportantMatch );
|
||||
machineMatchChanged();
|
||||
// prefill values from to window to settings which already set
|
||||
const KWin::WindowInfo& info = detect_dlg->windowInfo();
|
||||
LINEEDIT_PREFILL( position, positionToStr, info.frameGeometry().topLeft() );
|
||||
LINEEDIT_PREFILL( size, sizeToStr, info.frameGeometry().size() );
|
||||
COMBOBOX_PREFILL( desktop, desktopToCombo, info.desktop() );
|
||||
CHECKBOX_PREFILL( maximizehoriz,, info.state() & NET::MaxHoriz );
|
||||
CHECKBOX_PREFILL( maximizevert,, info.state() & NET::MaxVert );
|
||||
CHECKBOX_PREFILL( minimize,, info.isMinimized() );
|
||||
CHECKBOX_PREFILL( shade,, info.state() & NET::Shaded );
|
||||
CHECKBOX_PREFILL( fullscreen,, info.state() & NET::FullScreen );
|
||||
//COMBOBOX_PREFILL( placement, placementToCombo );
|
||||
CHECKBOX_PREFILL( above,, info.state() & NET::KeepAbove );
|
||||
CHECKBOX_PREFILL( below,, info.state() & NET::KeepBelow );
|
||||
// noborder is only internal KWin information, so let's guess
|
||||
CHECKBOX_PREFILL( noborder,, info.frameGeometry() == info.geometry() );
|
||||
CHECKBOX_PREFILL( skiptaskbar,, info.state() & NET::SkipTaskbar );
|
||||
CHECKBOX_PREFILL( skippager,, info.state() & NET::SkipPager );
|
||||
//CHECKBOX_PREFILL( acceptfocus, );
|
||||
//CHECKBOX_PREFILL( closeable, );
|
||||
//COMBOBOX_PREFILL( fsplevel, );
|
||||
//COMBOBOX_PREFILL( moveresizemode, moveresizeToCombo );
|
||||
COMBOBOX_PREFILL( type, typeToCombo, info.windowType( SUPPORTED_WINDOW_TYPES_MASK ) );
|
||||
//CHECKBOX_PREFILL( ignoreposition, );
|
||||
LINEEDIT_PREFILL( minsize, sizeToStr, info.frameGeometry().size() );
|
||||
LINEEDIT_PREFILL( maxsize, sizeToStr, info.frameGeometry().size() );
|
||||
}
|
||||
delete detect_dlg;
|
||||
detect_dlg = NULL;
|
||||
detect_dlg_ok = ok;
|
||||
}
|
||||
|
||||
#undef GENERIC_PREFILL
|
||||
#undef CHECKBOX_PREFILL
|
||||
#undef LINEEDIT_PREFILL
|
||||
#undef COMBOBOX_PREFILL
|
||||
|
||||
bool RulesWidget::finalCheck()
|
||||
{
|
||||
if( description->text().isEmpty())
|
||||
|
|
Loading…
Reference in a new issue