KWin rule for accepting/not accepting input focus.
svn path=/trunk/kdebase/kwin/; revision=318992
This commit is contained in:
parent
76f21da02b
commit
2d336eb6ac
3 changed files with 14 additions and 3 deletions
|
@ -1162,7 +1162,7 @@ void Client::takeFocus( allowed_t )
|
|||
previous_focus_timestamp = qt_x_time;
|
||||
previous_client = this;
|
||||
#endif
|
||||
if ( input )
|
||||
if ( rules()->checkAcceptFocus( input ))
|
||||
{
|
||||
XSetInputFocus( qt_xdisplay(), window(), RevertToPointerRoot, qt_x_time );
|
||||
}
|
||||
|
@ -1496,13 +1496,13 @@ Window Client::wmClientLeader() const
|
|||
bool Client::wantsTabFocus() const
|
||||
{
|
||||
return ( isNormalWindow() || isDialog() || isOverride())
|
||||
&& ( input || Ptakefocus ) && !skip_taskbar;
|
||||
&& wantsInput() && !skip_taskbar;
|
||||
}
|
||||
|
||||
|
||||
bool Client::wantsInput() const
|
||||
{
|
||||
return input || Ptakefocus;
|
||||
return rules()->checkAcceptFocus( input || Ptakefocus );
|
||||
}
|
||||
|
||||
bool Client::isDesktop() const
|
||||
|
|
|
@ -47,6 +47,7 @@ WindowRules::WindowRules()
|
|||
, fullscreenrule( DontCareRule )
|
||||
, noborderrule( DontCareRule )
|
||||
, fspleveladjustrule( DontCareRule )
|
||||
, acceptfocusrule( DontCareRule )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -101,6 +102,7 @@ WindowRules::WindowRules( KConfig& cfg )
|
|||
READ_SET_RULE( fullscreen, Bool, );
|
||||
READ_SET_RULE( noborder, Bool, );
|
||||
READ_FORCE_RULE( fspleveladjust, Num, );
|
||||
READ_FORCE_RULE( acceptfocus, Bool, );
|
||||
kdDebug() << "READ RULE:" << wmclass << endl;
|
||||
}
|
||||
|
||||
|
@ -169,6 +171,7 @@ void WindowRules::write( KConfig& cfg ) const
|
|||
WRITE_SET_RULE( fullscreen, );
|
||||
WRITE_SET_RULE( noborder, );
|
||||
WRITE_SET_RULE( fspleveladjust, );
|
||||
WRITE_SET_RULE( acceptfocus, );
|
||||
}
|
||||
|
||||
#undef WRITE_MATCH_STRING
|
||||
|
@ -380,6 +383,11 @@ int WindowRules::checkFSP( int fsp ) const
|
|||
return QMIN( 4, QMAX( 0, fsp + fspleveladjust ));
|
||||
}
|
||||
|
||||
bool WindowRules::checkAcceptFocus( bool focus ) const
|
||||
{
|
||||
return checkForceRule( acceptfocusrule ) ? this->acceptfocus : focus;
|
||||
}
|
||||
|
||||
// Client
|
||||
|
||||
void Client::setupWindowRules()
|
||||
|
|
3
rules.h
3
rules.h
|
@ -63,6 +63,7 @@ class WindowRules
|
|||
bool checkFullScreen( bool fs, bool init = false ) const;
|
||||
bool checkNoBorder( bool noborder, bool init = false ) const;
|
||||
int checkFSP( int fsp ) const;
|
||||
bool checkAcceptFocus( bool focus ) const;
|
||||
private:
|
||||
static SettingRule readRule( KConfig&, const QString& key );
|
||||
static SettingRule readForceRule( KConfig&, const QString& key );
|
||||
|
@ -117,6 +118,8 @@ class WindowRules
|
|||
SettingRule noborderrule;
|
||||
int fspleveladjust;
|
||||
SettingRule fspleveladjustrule;
|
||||
bool acceptfocus;
|
||||
SettingRule acceptfocusrule;
|
||||
};
|
||||
|
||||
inline
|
||||
|
|
Loading…
Reference in a new issue