CT: handle Control-Tab at run time, not only at start time. This should
silence a few bug reports from Emacs users svn path=/trunk/kdebase/kwin/; revision=75146
This commit is contained in:
parent
e3c32ea0d4
commit
37ef0caae2
2 changed files with 1089 additions and 1041 deletions
|
@ -264,10 +264,7 @@ Workspace::Workspace( bool restore )
|
||||||
grabKey(XK_Tab, Mod1Mask | ShiftMask);
|
grabKey(XK_Tab, Mod1Mask | ShiftMask);
|
||||||
|
|
||||||
// Do this unless the user disabled it...
|
// Do this unless the user disabled it...
|
||||||
if (options->useControlTab) {
|
grabControlTab(options->useControlTab);
|
||||||
grabKey(XK_Tab, ControlMask);
|
|
||||||
grabKey(XK_Tab, ControlMask | ShiftMask);
|
|
||||||
}
|
|
||||||
|
|
||||||
createKeybindings();
|
createKeybindings();
|
||||||
tab_box = new TabBox( this );
|
tab_box = new TabBox( this );
|
||||||
|
@ -707,7 +704,7 @@ bool Workspace::keyPress(XKeyEvent key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tab_grab){
|
if (!tab_grab && options->useControlTab){
|
||||||
|
|
||||||
|
|
||||||
if( (kc == XK_Tab) &&
|
if( (kc == XK_Tab) &&
|
||||||
|
@ -777,7 +774,7 @@ bool Workspace::keyRelease(XKeyEvent key)
|
||||||
}
|
}
|
||||||
XFreeModifiermap(xmk);
|
XFreeModifiermap(xmk);
|
||||||
}
|
}
|
||||||
if (control_grab){
|
if (control_grab && options->useControlTab){
|
||||||
XModifierKeymap* xmk = XGetModifierMapping(qt_xdisplay());
|
XModifierKeymap* xmk = XGetModifierMapping(qt_xdisplay());
|
||||||
for (i=0; i<xmk->max_keypermod; i++)
|
for (i=0; i<xmk->max_keypermod; i++)
|
||||||
if (xmk->modifiermap[xmk->max_keypermod * ControlMapIndex + i]
|
if (xmk->modifiermap[xmk->max_keypermod * ControlMapIndex + i]
|
||||||
|
@ -916,6 +913,38 @@ void Workspace::grabKey(KeySym keysym, unsigned int mod){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Ungrabs the keysymbol \a keysym with the given modifiers \a mod
|
||||||
|
plus all possibile combinations of Lock and NumLock
|
||||||
|
*/
|
||||||
|
void Workspace::ungrabKey(KeySym keysym, unsigned int mod){
|
||||||
|
static int NumLockMask = 0;
|
||||||
|
if (!keysym||!XKeysymToKeycode(qt_xdisplay(), keysym)) return;
|
||||||
|
if (!NumLockMask){
|
||||||
|
XModifierKeymap* xmk = XGetModifierMapping(qt_xdisplay());
|
||||||
|
int i;
|
||||||
|
for (i=0; i<8; i++){
|
||||||
|
if (xmk->modifiermap[xmk->max_keypermod * i] ==
|
||||||
|
XKeysymToKeycode(qt_xdisplay(), XK_Num_Lock))
|
||||||
|
NumLockMask = (1<<i);
|
||||||
|
}
|
||||||
|
XFreeModifiermap(xmk);
|
||||||
|
}
|
||||||
|
XUngrabKey(qt_xdisplay(),
|
||||||
|
XKeysymToKeycode(qt_xdisplay(), keysym), mod,
|
||||||
|
qt_xrootwin());
|
||||||
|
XUngrabKey(qt_xdisplay(),
|
||||||
|
XKeysymToKeycode(qt_xdisplay(), keysym), mod | LockMask,
|
||||||
|
qt_xrootwin());
|
||||||
|
XUngrabKey(qt_xdisplay(),
|
||||||
|
XKeysymToKeycode(qt_xdisplay(), keysym), mod | NumLockMask,
|
||||||
|
qt_xrootwin());
|
||||||
|
XUngrabKey(qt_xdisplay(),
|
||||||
|
XKeysymToKeycode(qt_xdisplay(), keysym), mod | LockMask | NumLockMask,
|
||||||
|
qt_xrootwin());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Informs the workspace about the active client, i.e. the client that
|
Informs the workspace about the active client, i.e. the client that
|
||||||
has the focus (or None if no client has the focus). This functions
|
has the focus (or None if no client has the focus). This functions
|
||||||
|
@ -1555,6 +1584,22 @@ void Workspace::reconfigure()
|
||||||
KGlobal::config()->reparseConfiguration();
|
KGlobal::config()->reparseConfiguration();
|
||||||
options->reload();
|
options->reload();
|
||||||
keys->readSettings();
|
keys->readSettings();
|
||||||
|
grabControlTab(options->useControlTab);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Grab/Ungrab the Control key dynamically
|
||||||
|
*/
|
||||||
|
void Workspace::grabControlTab(bool grab)
|
||||||
|
{
|
||||||
|
if (grab) {
|
||||||
|
grabKey(XK_Tab, ControlMask);
|
||||||
|
grabKey(XK_Tab, ControlMask | ShiftMask);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ungrabKey(XK_Tab,ControlMask);
|
||||||
|
ungrabKey(XK_Tab, ControlMask | ShiftMask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -140,6 +140,9 @@ public:
|
||||||
QWidget* desktopWidget();
|
QWidget* desktopWidget();
|
||||||
|
|
||||||
void grabKey(KeySym keysym, unsigned int mod);
|
void grabKey(KeySym keysym, unsigned int mod);
|
||||||
|
void ungrabKey(KeySym keysym, unsigned int mod);
|
||||||
|
|
||||||
|
void grabControlTab(bool grab);
|
||||||
|
|
||||||
Client* nextClient(Client*) const;
|
Client* nextClient(Client*) const;
|
||||||
Client* previousClient(Client*) const;
|
Client* previousClient(Client*) const;
|
||||||
|
|
Loading…
Reference in a new issue