From b33a6fa71e447b73a70d638a466a4adf82a388c8 Mon Sep 17 00:00:00 2001 From: Waldo Bastian Date: Wed, 26 Apr 2000 01:45:10 +0000 Subject: [PATCH] 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 --- workspace.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/workspace.cpp b/workspace.cpp index 91640de372..4bec90902a 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -292,6 +292,7 @@ bool Workspace::workspaceEvent( XEvent * e ) switch (e->type) { case ButtonPress: case ButtonRelease: + case MotionNotify: break; case UnmapNotify: // this is special due to @@ -585,6 +586,12 @@ bool Workspace::keyPress(XKeyEvent key) freeKeyboard(FALSE); return TRUE; } + XGrabPointer( qt_xdisplay(), root, TRUE, + (uint)(ButtonPressMask | ButtonReleaseMask | + ButtonMotionMask | EnterWindowMask | + LeaveWindowMask | PointerMotionMask), + GrabModeSync, GrabModeAsync, + None, None, kwin_time ); XGrabKeyboard(qt_xdisplay(), root, FALSE, GrabModeAsync, GrabModeAsync, @@ -610,6 +617,12 @@ bool Workspace::keyPress(XKeyEvent key) // return TRUE; // } if (!control_grab){ + XGrabPointer( qt_xdisplay(), root, TRUE, + (uint)(ButtonPressMask | ButtonReleaseMask | + ButtonMotionMask | EnterWindowMask | + LeaveWindowMask | PointerMotionMask), + GrabModeSync, GrabModeAsync, + None, None, kwin_time ); XGrabKeyboard(qt_xdisplay(), root, FALSE, GrabModeAsync, GrabModeAsync, @@ -626,6 +639,7 @@ bool Workspace::keyPress(XKeyEvent key) if (control_grab || tab_grab){ if (kc == XK_Escape){ XUngrabKeyboard(qt_xdisplay(), kwin_time); + XUngrabPointer( qt_xdisplay(), kwin_time); tab_box->hide(); tab_grab = FALSE; control_grab = FALSE; @@ -652,6 +666,7 @@ bool Workspace::keyRelease(XKeyEvent key) if (xmk->modifiermap[xmk->max_keypermod * Mod1MapIndex + i] == key.keycode){ XUngrabKeyboard(qt_xdisplay(), kwin_time); + XUngrabPointer( qt_xdisplay(), kwin_time); tab_box->hide(); tab_grab = false; if ( tab_box->currentClient() ){ @@ -665,6 +680,7 @@ bool Workspace::keyRelease(XKeyEvent key) for (i=0; imax_keypermod; i++) if (xmk->modifiermap[xmk->max_keypermod * ControlMapIndex + i] == key.keycode){ + XUngrabPointer( qt_xdisplay(), kwin_time); XUngrabKeyboard(qt_xdisplay(), kwin_time); tab_box->hide(); control_grab = False; @@ -897,7 +913,6 @@ bool Workspace::hasCaption( const QString& caption ) */ void Workspace::requestFocus( Client* c) { - //TODO will be different for non-root clients. (subclassing?) if ( !c ) { focusToNull();