Autosave for window rules.
svn path=/trunk/kdebase/kwin/; revision=319665
This commit is contained in:
parent
7e35926c37
commit
6e44fc30b8
7 changed files with 67 additions and 1 deletions
|
@ -405,6 +405,7 @@ void Client::setUserNoBorder( bool set )
|
||||||
return;
|
return;
|
||||||
user_noborder = set;
|
user_noborder = set;
|
||||||
updateDecoration( true, false );
|
updateDecoration( true, false );
|
||||||
|
updateWindowRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::updateShape()
|
void Client::updateShape()
|
||||||
|
@ -535,6 +536,7 @@ void Client::minimize( bool avoid_animation )
|
||||||
rawHide();
|
rawHide();
|
||||||
updateAllowedActions();
|
updateAllowedActions();
|
||||||
workspace()->updateMinimizedOfTransients( this );
|
workspace()->updateMinimizedOfTransients( this );
|
||||||
|
updateWindowRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::unminimize( bool avoid_animation )
|
void Client::unminimize( bool avoid_animation )
|
||||||
|
@ -555,6 +557,7 @@ void Client::unminimize( bool avoid_animation )
|
||||||
}
|
}
|
||||||
updateAllowedActions();
|
updateAllowedActions();
|
||||||
workspace()->updateMinimizedOfTransients( this );
|
workspace()->updateMinimizedOfTransients( this );
|
||||||
|
updateWindowRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern bool blockAnimation;
|
extern bool blockAnimation;
|
||||||
|
@ -784,6 +787,7 @@ void Client::setShade( ShadeMode mode )
|
||||||
updateAllowedActions();
|
updateAllowedActions();
|
||||||
workspace()->updateMinimizedOfTransients( this );
|
workspace()->updateMinimizedOfTransients( this );
|
||||||
decoration->shadeChange();
|
decoration->shadeChange();
|
||||||
|
updateWindowRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::shadeHover()
|
void Client::shadeHover()
|
||||||
|
@ -1065,6 +1069,7 @@ void Client::setSkipTaskbar( bool b, bool from_outside )
|
||||||
return;
|
return;
|
||||||
skip_taskbar = b;
|
skip_taskbar = b;
|
||||||
info->setState( b?NET::SkipTaskbar:0, NET::SkipTaskbar );
|
info->setState( b?NET::SkipTaskbar:0, NET::SkipTaskbar );
|
||||||
|
updateWindowRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::setSkipPager( bool b )
|
void Client::setSkipPager( bool b )
|
||||||
|
@ -1074,6 +1079,7 @@ void Client::setSkipPager( bool b )
|
||||||
return;
|
return;
|
||||||
skip_pager = b;
|
skip_pager = b;
|
||||||
info->setState( b?NET::SkipPager:0, NET::SkipPager );
|
info->setState( b?NET::SkipPager:0, NET::SkipPager );
|
||||||
|
updateWindowRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::setModal( bool m )
|
void Client::setModal( bool m )
|
||||||
|
@ -1106,6 +1112,7 @@ void Client::setDesktop( int desktop )
|
||||||
if( decoration != NULL )
|
if( decoration != NULL )
|
||||||
decoration->desktopChange();
|
decoration->desktopChange();
|
||||||
virtualDesktopChange(); // hide/show if needed
|
virtualDesktopChange(); // hide/show if needed
|
||||||
|
updateWindowRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::setOnAllDesktops( bool b )
|
void Client::setOnAllDesktops( bool b )
|
||||||
|
|
1
client.h
1
client.h
|
@ -496,6 +496,7 @@ private slots:
|
||||||
QRegion _mask;
|
QRegion _mask;
|
||||||
friend struct FetchNameInternalPredicate;
|
friend struct FetchNameInternalPredicate;
|
||||||
friend struct CheckIgnoreFocusStealingProcedure;
|
friend struct CheckIgnoreFocusStealingProcedure;
|
||||||
|
friend struct ResetupRulesProcedure;
|
||||||
void show() { assert( false ); } // SELI remove after Client is no longer QWidget
|
void show() { assert( false ); } // SELI remove after Client is no longer QWidget
|
||||||
void hide() { assert( false ); }
|
void hide() { assert( false ); }
|
||||||
};
|
};
|
||||||
|
|
|
@ -1816,6 +1816,7 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust )
|
||||||
updateAllowedActions();
|
updateAllowedActions();
|
||||||
if( decoration != NULL )
|
if( decoration != NULL )
|
||||||
decoration->maximizeChange();
|
decoration->maximizeChange();
|
||||||
|
updateWindowRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::resetMaximize()
|
void Client::resetMaximize()
|
||||||
|
@ -1881,6 +1882,7 @@ void Client::setFullScreen( bool set, bool user )
|
||||||
setGeometry( workspace()->clientArea( MaximizeArea, this ));
|
setGeometry( workspace()->clientArea( MaximizeArea, this ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateWindowRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -658,6 +658,7 @@ void Client::setKeepAbove( bool b )
|
||||||
info->setState( keepAbove() ? NET::KeepAbove : 0, NET::KeepAbove );
|
info->setState( keepAbove() ? NET::KeepAbove : 0, NET::KeepAbove );
|
||||||
// TODO emit a signal about the change to the style plugin
|
// TODO emit a signal about the change to the style plugin
|
||||||
workspace()->updateClientLayer( this );
|
workspace()->updateClientLayer( this );
|
||||||
|
updateWindowRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::setKeepBelow( bool b )
|
void Client::setKeepBelow( bool b )
|
||||||
|
@ -675,6 +676,7 @@ void Client::setKeepBelow( bool b )
|
||||||
keep_below = b;
|
keep_below = b;
|
||||||
info->setState( keepBelow() ? NET::KeepBelow : 0, NET::KeepBelow );
|
info->setState( keepBelow() ? NET::KeepBelow : 0, NET::KeepBelow );
|
||||||
workspace()->updateClientLayer( this );
|
workspace()->updateClientLayer( this );
|
||||||
|
updateWindowRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
Layer Client::layer() const
|
Layer Client::layer() const
|
||||||
|
|
47
rules.cpp
47
rules.cpp
|
@ -287,32 +287,74 @@ bool WindowRules::match( const Client* c ) const
|
||||||
void WindowRules::update( Client* c )
|
void WindowRules::update( Client* c )
|
||||||
{
|
{
|
||||||
// TODO check this setting is for this client ?
|
// TODO check this setting is for this client ?
|
||||||
|
bool updated = false;
|
||||||
if( positionrule == RememberRule )
|
if( positionrule == RememberRule )
|
||||||
|
{
|
||||||
|
updated = updated || position != c->pos();
|
||||||
position = c->pos();
|
position = c->pos();
|
||||||
|
}
|
||||||
if( sizerule == RememberRule )
|
if( sizerule == RememberRule )
|
||||||
|
{
|
||||||
|
updated = updated || size != c->size();
|
||||||
size = c->size();
|
size = c->size();
|
||||||
|
}
|
||||||
if( desktoprule == RememberRule )
|
if( desktoprule == RememberRule )
|
||||||
|
{
|
||||||
|
updated = updated || desktop != c->desktop();
|
||||||
desktop = c->desktop();
|
desktop = c->desktop();
|
||||||
|
}
|
||||||
if( maximizevertrule == RememberRule )
|
if( maximizevertrule == RememberRule )
|
||||||
|
{
|
||||||
|
updated = updated || maximizevert != bool( c->maximizeMode() & MaximizeVertical );
|
||||||
maximizevert = c->maximizeMode() & MaximizeVertical;
|
maximizevert = c->maximizeMode() & MaximizeVertical;
|
||||||
|
}
|
||||||
if( maximizehorizrule == RememberRule )
|
if( maximizehorizrule == RememberRule )
|
||||||
|
{
|
||||||
|
updated = updated || maximizehoriz != bool( c->maximizeMode() & MaximizeHorizontal );
|
||||||
maximizehoriz = c->maximizeMode() & MaximizeHorizontal;
|
maximizehoriz = c->maximizeMode() & MaximizeHorizontal;
|
||||||
|
}
|
||||||
if( minimizerule == RememberRule )
|
if( minimizerule == RememberRule )
|
||||||
|
{
|
||||||
|
updated = updated || minimize != c->isMinimized();
|
||||||
minimize = c->isMinimized();
|
minimize = c->isMinimized();
|
||||||
|
}
|
||||||
if( shaderule == RememberRule )
|
if( shaderule == RememberRule )
|
||||||
|
{
|
||||||
|
updated = updated || ( shade != ( c->shadeMode() != Client::ShadeNone ));
|
||||||
shade = c->shadeMode() != Client::ShadeNone;
|
shade = c->shadeMode() != Client::ShadeNone;
|
||||||
|
}
|
||||||
if( skiptaskbarrule == RememberRule )
|
if( skiptaskbarrule == RememberRule )
|
||||||
|
{
|
||||||
|
updated = updated || skiptaskbar != c->skipTaskbar();
|
||||||
skiptaskbar = c->skipTaskbar();
|
skiptaskbar = c->skipTaskbar();
|
||||||
|
}
|
||||||
if( skippagerrule == RememberRule )
|
if( skippagerrule == RememberRule )
|
||||||
|
{
|
||||||
|
updated = updated || skippager != c->skipPager();
|
||||||
skippager = c->skipPager();
|
skippager = c->skipPager();
|
||||||
|
}
|
||||||
if( aboverule == RememberRule )
|
if( aboverule == RememberRule )
|
||||||
|
{
|
||||||
|
updated = updated || above != c->keepAbove();
|
||||||
above = c->keepAbove();
|
above = c->keepAbove();
|
||||||
|
}
|
||||||
if( belowrule == RememberRule )
|
if( belowrule == RememberRule )
|
||||||
|
{
|
||||||
|
updated = updated || below != c->keepBelow();
|
||||||
below = c->keepBelow();
|
below = c->keepBelow();
|
||||||
|
}
|
||||||
if( fullscreenrule == RememberRule )
|
if( fullscreenrule == RememberRule )
|
||||||
|
{
|
||||||
|
updated = updated || fullscreen != c->isFullScreen();
|
||||||
fullscreen = c->isFullScreen();
|
fullscreen = c->isFullScreen();
|
||||||
|
}
|
||||||
if( noborderrule == RememberRule )
|
if( noborderrule == RememberRule )
|
||||||
|
{
|
||||||
|
updated = updated || noborder != c->isUserNoBorder();
|
||||||
noborder = c->isUserNoBorder();
|
noborder = c->isUserNoBorder();
|
||||||
|
}
|
||||||
|
if( updated )
|
||||||
|
Workspace::self()->rulesUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
Placement::Policy WindowRules::checkPlacement( Placement::Policy placement ) const
|
Placement::Policy WindowRules::checkPlacement( Placement::Policy placement ) const
|
||||||
|
@ -574,4 +616,9 @@ void Workspace::cleanupTemporaryRules()
|
||||||
QTimer::singleShot( 60000, this, SLOT( cleanupTemporaryRules()));
|
QTimer::singleShot( 60000, this, SLOT( cleanupTemporaryRules()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Workspace::rulesUpdated()
|
||||||
|
{
|
||||||
|
rulesUpdatedTimer.start( 1000, true );
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -112,6 +112,7 @@ Workspace::Workspace( bool restore )
|
||||||
|
|
||||||
connect( &temporaryRulesMessages, SIGNAL( gotMessage( const QString& )),
|
connect( &temporaryRulesMessages, SIGNAL( gotMessage( const QString& )),
|
||||||
this, SLOT( gotTemporaryRulesMessage( const QString& )));
|
this, SLOT( gotTemporaryRulesMessage( const QString& )));
|
||||||
|
connect( &rulesUpdatedTimer, SIGNAL( timeout()), this, SLOT( writeWindowRules()));
|
||||||
|
|
||||||
updateXTime(); // needed for proper initialization of user_time in Client ctor
|
updateXTime(); // needed for proper initialization of user_time in Client ctor
|
||||||
|
|
||||||
|
@ -753,6 +754,7 @@ void Workspace::slotSettingsChanged(int category)
|
||||||
Reread settings
|
Reread settings
|
||||||
*/
|
*/
|
||||||
KWIN_PROCEDURE( CheckBorderSizesProcedure, cl->checkBorderSizes() );
|
KWIN_PROCEDURE( CheckBorderSizesProcedure, cl->checkBorderSizes() );
|
||||||
|
KWIN_PROCEDURE( ResetupRulesProcedure, cl->setupWindowRules( true ) );
|
||||||
|
|
||||||
void Workspace::slotReconfigure()
|
void Workspace::slotReconfigure()
|
||||||
{
|
{
|
||||||
|
@ -807,6 +809,9 @@ void Workspace::slotReconfigure()
|
||||||
updateTopMenuGeometry();
|
updateTopMenuGeometry();
|
||||||
updateCurrentTopMenu();
|
updateCurrentTopMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadWindowRules();
|
||||||
|
forEachClient( ResetupRulesProcedure());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::loadDesktopSettings()
|
void Workspace::loadDesktopSettings()
|
||||||
|
|
|
@ -204,6 +204,7 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
|
||||||
|
|
||||||
SessionInfo* takeSessionInfo( Client* );
|
SessionInfo* takeSessionInfo( Client* );
|
||||||
WindowRules* findWindowRules( const Client*, bool );
|
WindowRules* findWindowRules( const Client*, bool );
|
||||||
|
void rulesUpdated();
|
||||||
|
|
||||||
// dcop interface
|
// dcop interface
|
||||||
void cascadeDesktop();
|
void cascadeDesktop();
|
||||||
|
@ -333,6 +334,7 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
|
||||||
void delayFocus();
|
void delayFocus();
|
||||||
void gotTemporaryRulesMessage( const QString& );
|
void gotTemporaryRulesMessage( const QString& );
|
||||||
void cleanupTemporaryRules();
|
void cleanupTemporaryRules();
|
||||||
|
void writeWindowRules();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool keyPressMouseEmulation( XKeyEvent& ev );
|
bool keyPressMouseEmulation( XKeyEvent& ev );
|
||||||
|
@ -429,12 +431,12 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
|
||||||
|
|
||||||
void loadSessionInfo();
|
void loadSessionInfo();
|
||||||
void loadWindowRules();
|
void loadWindowRules();
|
||||||
void writeWindowRules();
|
|
||||||
void editWindowRules( Client* );
|
void editWindowRules( Client* );
|
||||||
|
|
||||||
QPtrList<SessionInfo> session;
|
QPtrList<SessionInfo> session;
|
||||||
QValueList<WindowRules*> windowRules;
|
QValueList<WindowRules*> windowRules;
|
||||||
KXMessages temporaryRulesMessages;
|
KXMessages temporaryRulesMessages;
|
||||||
|
QTimer rulesUpdatedTimer;
|
||||||
static const char* windowTypeToTxt( NET::WindowType type );
|
static const char* windowTypeToTxt( NET::WindowType type );
|
||||||
static NET::WindowType txtToWindowType( const char* txt );
|
static NET::WindowType txtToWindowType( const char* txt );
|
||||||
static bool sessionInfoWindowTypeMatch( Client* c, SessionInfo* info );
|
static bool sessionInfoWindowTypeMatch( Client* c, SessionInfo* info );
|
||||||
|
|
Loading…
Reference in a new issue