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