diff --git a/client.cpp b/client.cpp index c7b8d5e798..342637601c 100644 --- a/client.cpp +++ b/client.cpp @@ -17,6 +17,7 @@ #include extern Atom qt_wm_state; +extern Time kwin_time; static QRect* visible_bound = 0; @@ -63,7 +64,7 @@ static void sendClientMessage(Window w, Atom a, long x){ ev.xclient.message_type = a; ev.xclient.format = 32; ev.xclient.data.l[0] = x; - ev.xclient.data.l[1] = CurrentTime; + ev.xclient.data.l[1] = kwin_time; mask = 0L; if (w == qt_xrootwin()) mask = SubstructureRedirectMask; /* magic! */ @@ -1540,7 +1541,7 @@ void Client::getWindowProtocols(){ void Client::takeFocus() { if ( input ) - XSetInputFocus( qt_xdisplay(), win, RevertToPointerRoot, CurrentTime ); + XSetInputFocus( qt_xdisplay(), win, RevertToPointerRoot, kwin_time ); if ( Ptakefocus ) sendClientMessage(win, atoms->wm_protocols, atoms->wm_take_focus); } diff --git a/main.cpp b/main.cpp index 8608b61165..6cd073f0b8 100644 --- a/main.cpp +++ b/main.cpp @@ -20,6 +20,8 @@ Options* options; Atoms* atoms; +Time kwin_time = CurrentTime; + static bool initting = FALSE; int x11ErrorHandler(Display *d, XErrorEvent *e){ char msg[80], req[80], number[80]; @@ -85,6 +87,24 @@ Application::~Application() bool Application::x11EventFilter( XEvent *e ) { + switch ( e->type ) { + case ButtonPress: + case ButtonRelease: + case MotionNotify: + kwin_time = (e->type == MotionNotify) ? + e->xmotion.time : e->xbutton.time; + break; + case KeyPress: + case KeyRelease: + kwin_time = e->xkey.time; + break; + case PropertyNotify: + kwin_time = e->xproperty.time; + break; + default: + break; + } + for ( WorkspaceList::Iterator it = workspaces.begin(); it != workspaces.end(); ++it) { if ( (*it)->workspaceEvent( e ) ) return TRUE; diff --git a/workspace.cpp b/workspace.cpp index d65bff9f9e..dae383af7a 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -19,6 +19,8 @@ #include #include +extern Time kwin_time; + // used to store the return values of // XShapeQueryExtension. // Necessary since shaped window are an extension to X @@ -447,9 +449,9 @@ bool Workspace::destroyClient( Client* c) */ void Workspace::freeKeyboard(bool pass){ if (!pass) - XAllowEvents(qt_xdisplay(), AsyncKeyboard, CurrentTime); + XAllowEvents(qt_xdisplay(), AsyncKeyboard, kwin_time); else - XAllowEvents(qt_xdisplay(), ReplayKeyboard, CurrentTime); + XAllowEvents(qt_xdisplay(), ReplayKeyboard, kwin_time); QApplication::syncX(); } @@ -500,7 +502,7 @@ bool Workspace::keyPress(XKeyEvent key) XGrabKeyboard(qt_xdisplay(), root, FALSE, GrabModeAsync, GrabModeAsync, - CurrentTime); + kwin_time); tab_grab = TRUE; tab_box->setMode( TabBox::WindowsMode ); tab_box->reset(); @@ -525,7 +527,7 @@ bool Workspace::keyPress(XKeyEvent key) XGrabKeyboard(qt_xdisplay(), root, FALSE, GrabModeAsync, GrabModeAsync, - CurrentTime); + kwin_time); control_grab = TRUE; tab_box->setMode( TabBox::DesktopMode ); tab_box->reset(); @@ -537,7 +539,7 @@ bool Workspace::keyPress(XKeyEvent key) if (control_grab || tab_grab){ if (kc == XK_Escape){ - XUngrabKeyboard(qt_xdisplay(), CurrentTime); + XUngrabKeyboard(qt_xdisplay(), kwin_time); tab_box->hide(); tab_grab = FALSE; control_grab = FALSE; @@ -563,7 +565,7 @@ bool Workspace::keyRelease(XKeyEvent key) for (i=0; imax_keypermod; i++) if (xmk->modifiermap[xmk->max_keypermod * Mod1MapIndex + i] == key.keycode){ - XUngrabKeyboard(qt_xdisplay(), CurrentTime); + XUngrabKeyboard(qt_xdisplay(), kwin_time); tab_box->hide(); tab_grab = false; if ( tab_box->currentClient() ){ @@ -577,7 +579,7 @@ bool Workspace::keyRelease(XKeyEvent key) for (i=0; imax_keypermod; i++) if (xmk->modifiermap[xmk->max_keypermod * ControlMapIndex + i] == key.keycode){ - XUngrabKeyboard(qt_xdisplay(), CurrentTime); + XUngrabKeyboard(qt_xdisplay(), kwin_time); tab_box->hide(); control_grab = False; if ( tab_box->currentDesktop() != -1 ) @@ -1244,7 +1246,7 @@ void Workspace::focusToNull(){ InputOnly, CopyFromParent, mask, &attr); XMapWindow(qt_xdisplay(), w); } - XSetInputFocus(qt_xdisplay(), w, RevertToPointerRoot, CurrentTime ); + XSetInputFocus(qt_xdisplay(), w, RevertToPointerRoot, kwin_time ); //colormapFocus(0); TODO }