WABA: Grab mouse while in Alt-Tab or Control-Tab mode. This prevents a bug

which otherwise would occur when you click on the Alt-Tab-window with the
mouse. I hope I didn't break anything because this X-stuff is rather mystical.

BTW Why does KWin get so many "MotionNotify" events when you move your mouse
across certain windows?

svn path=/trunk/kdebase/kwin/; revision=47554
icc-effect-5.14.5
Waldo Bastian 2000-04-26 01:45:10 +00:00
parent 494a879f04
commit b33a6fa71e
1 changed files with 16 additions and 1 deletions

View File

@ -292,6 +292,7 @@ bool Workspace::workspaceEvent( XEvent * e )
switch (e->type) { switch (e->type) {
case ButtonPress: case ButtonPress:
case ButtonRelease: case ButtonRelease:
case MotionNotify:
break; break;
case UnmapNotify: case UnmapNotify:
// this is special due to // this is special due to
@ -585,6 +586,12 @@ bool Workspace::keyPress(XKeyEvent key)
freeKeyboard(FALSE); freeKeyboard(FALSE);
return TRUE; return TRUE;
} }
XGrabPointer( qt_xdisplay(), root, TRUE,
(uint)(ButtonPressMask | ButtonReleaseMask |
ButtonMotionMask | EnterWindowMask |
LeaveWindowMask | PointerMotionMask),
GrabModeSync, GrabModeAsync,
None, None, kwin_time );
XGrabKeyboard(qt_xdisplay(), XGrabKeyboard(qt_xdisplay(),
root, FALSE, root, FALSE,
GrabModeAsync, GrabModeAsync, GrabModeAsync, GrabModeAsync,
@ -610,6 +617,12 @@ bool Workspace::keyPress(XKeyEvent key)
// return TRUE; // return TRUE;
// } // }
if (!control_grab){ if (!control_grab){
XGrabPointer( qt_xdisplay(), root, TRUE,
(uint)(ButtonPressMask | ButtonReleaseMask |
ButtonMotionMask | EnterWindowMask |
LeaveWindowMask | PointerMotionMask),
GrabModeSync, GrabModeAsync,
None, None, kwin_time );
XGrabKeyboard(qt_xdisplay(), XGrabKeyboard(qt_xdisplay(),
root, FALSE, root, FALSE,
GrabModeAsync, GrabModeAsync, GrabModeAsync, GrabModeAsync,
@ -626,6 +639,7 @@ bool Workspace::keyPress(XKeyEvent key)
if (control_grab || tab_grab){ if (control_grab || tab_grab){
if (kc == XK_Escape){ if (kc == XK_Escape){
XUngrabKeyboard(qt_xdisplay(), kwin_time); XUngrabKeyboard(qt_xdisplay(), kwin_time);
XUngrabPointer( qt_xdisplay(), kwin_time);
tab_box->hide(); tab_box->hide();
tab_grab = FALSE; tab_grab = FALSE;
control_grab = FALSE; control_grab = FALSE;
@ -652,6 +666,7 @@ bool Workspace::keyRelease(XKeyEvent key)
if (xmk->modifiermap[xmk->max_keypermod * Mod1MapIndex + i] if (xmk->modifiermap[xmk->max_keypermod * Mod1MapIndex + i]
== key.keycode){ == key.keycode){
XUngrabKeyboard(qt_xdisplay(), kwin_time); XUngrabKeyboard(qt_xdisplay(), kwin_time);
XUngrabPointer( qt_xdisplay(), kwin_time);
tab_box->hide(); tab_box->hide();
tab_grab = false; tab_grab = false;
if ( tab_box->currentClient() ){ if ( tab_box->currentClient() ){
@ -665,6 +680,7 @@ bool Workspace::keyRelease(XKeyEvent key)
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]
== key.keycode){ == key.keycode){
XUngrabPointer( qt_xdisplay(), kwin_time);
XUngrabKeyboard(qt_xdisplay(), kwin_time); XUngrabKeyboard(qt_xdisplay(), kwin_time);
tab_box->hide(); tab_box->hide();
control_grab = False; control_grab = False;
@ -897,7 +913,6 @@ bool Workspace::hasCaption( const QString& caption )
*/ */
void Workspace::requestFocus( Client* c) void Workspace::requestFocus( Client* c)
{ {
//TODO will be different for non-root clients. (subclassing?) //TODO will be different for non-root clients. (subclassing?)
if ( !c ) { if ( !c ) {
focusToNull(); focusToNull();