diff --git a/src/client.c b/src/client.c index 9d387cc2a6d4292f62b9d26e59278275c19d908d..33df9acf67d69ef4785b60afbdd6ccd51861ded4 100644 --- a/src/client.c +++ b/src/client.c @@ -3202,6 +3202,7 @@ clientMove (Client * c, XEvent * ev) passdata.grab = FALSE; passdata.is_transient = clientIsValidTransientOrModal (c); +#ifdef USE_TEMP_WIN xfwmWindowTemp (screen_info, NULL, 0, screen_info->xroot, @@ -3210,7 +3211,7 @@ clientMove (Client * c, XEvent * ev) gdk_screen_get_width (screen_info->gscr), gdk_screen_get_height (screen_info->gscr), ButtonMotionMask | ButtonReleaseMask); - +#endif if (ev->type == KeyPress) { cursor = None; @@ -3229,6 +3230,7 @@ clientMove (Client * c, XEvent * ev) cursor = myDisplayGetCursorMove(display_info); getMouseXY (screen_info, screen_info->xroot, &passdata.mx, &passdata.my); } +#ifdef USE_TEMP_WIN g1 = XGrabKeyboard (display_info->dpy, MYWINDOW_XWINDOW (passdata.tmp_event_window), FALSE, GrabModeAsync, GrabModeAsync, myDisplayGetCurrentTime (display_info)); @@ -3236,7 +3238,15 @@ clientMove (Client * c, XEvent * ev) FALSE, ButtonMotionMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, screen_info->xroot, cursor, myDisplayGetCurrentTime (display_info)); - +#else + g1 = XGrabKeyboard (display_info->dpy, screen_info->gnome_win, + FALSE, GrabModeAsync, GrabModeAsync, + myDisplayGetCurrentTime (display_info)); + g2 = XGrabPointer (display_info->dpy, screen_info->gnome_win, + FALSE, ButtonMotionMask | ButtonReleaseMask, GrabModeAsync, + GrabModeAsync, screen_info->xroot, cursor, + myDisplayGetCurrentTime (display_info)); +#endif if (((passdata.use_keys) && (g1 != GrabSuccess)) || (g2 != GrabSuccess)) { TRACE ("grab failed in clientMove"); @@ -3302,8 +3312,9 @@ clientMove (Client * c, XEvent * ev) XUngrabKeyboard (display_info->dpy, myDisplayGetCurrentTime (display_info)); XUngrabPointer (display_info->dpy, myDisplayGetCurrentTime (display_info)); +#ifdef USE_TEMP_WIN xfwmWindowDelete (&passdata.tmp_event_window); - +#endif if (passdata.grab && screen_info->params->box_move) { myDisplayUngrabServer (display_info); @@ -3676,6 +3687,7 @@ clientResize (Client * c, int corner, XEvent * ev) passdata.grab = FALSE; passdata.corner = corner; +#ifdef USE_TEMP_WIN xfwmWindowTemp (screen_info, NULL, 0, screen_info->xroot, @@ -3684,6 +3696,7 @@ clientResize (Client * c, int corner, XEvent * ev) gdk_screen_get_width (screen_info->gscr), gdk_screen_get_height (screen_info->gscr), ButtonMotionMask | ButtonReleaseMask); +#endif if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) { @@ -3706,6 +3719,7 @@ clientResize (Client * c, int corner, XEvent * ev) getMouseXY (screen_info, screen_info->xroot, &passdata.mx, &passdata.my); } +#ifdef USE_TEMP_WIN g1 = XGrabKeyboard (display_info->dpy, MYWINDOW_XWINDOW (passdata.tmp_event_window), FALSE, GrabModeAsync, GrabModeAsync, myDisplayGetCurrentTime (display_info)); @@ -3714,7 +3728,16 @@ clientResize (Client * c, int corner, XEvent * ev) GrabModeAsync, screen_info->xroot, myDisplayGetCursorResize(display_info, passdata.corner), myDisplayGetCurrentTime (display_info)); - +#else + g1 = XGrabKeyboard (display_info->dpy, screen_info->gnome_win, + FALSE, GrabModeAsync, GrabModeAsync, + myDisplayGetCurrentTime (display_info)); + g2 = XGrabPointer (display_info->dpy, screen_info->gnome_win, + FALSE, ButtonMotionMask | ButtonReleaseMask, GrabModeAsync, + GrabModeAsync, screen_info->xroot, + myDisplayGetCursorResize(display_info, passdata.corner), + myDisplayGetCurrentTime (display_info)); +#endif if (((passdata.use_keys) && (g1 != GrabSuccess)) || (g2 != GrabSuccess)) { TRACE ("grab failed in clientResize"); @@ -3788,7 +3811,9 @@ clientResize (Client * c, int corner, XEvent * ev) XUngrabKeyboard (display_info->dpy, myDisplayGetCurrentTime (display_info)); XUngrabPointer (display_info->dpy, myDisplayGetCurrentTime (display_info)); +#ifdef USE_TEMP_WIN xfwmWindowDelete (&passdata.tmp_event_window); +#endif if (passdata.grab && screen_info->params->box_resize) { diff --git a/src/workspaces.c b/src/workspaces.c index 06be102a0860c27ea9ee4b8a110bbb2ea8a8564b..dbbc2ac592e8ea0d96042b66e524d8005661c67c 100644 --- a/src/workspaces.c +++ b/src/workspaces.c @@ -237,7 +237,8 @@ workspaceSwitch (ScreenInfo *screen_info, int new_ws, Client * c2) int rx, ry, wx, wy; unsigned int mask; unsigned long data[1]; - + gboolean pointer_grabbed = FALSE; + TRACE ("entering workspaceSwitch"); if ((new_ws == screen_info->current_ws) && (screen_info->params->toggle_workspaces)) @@ -266,10 +267,11 @@ workspaceSwitch (ScreenInfo *screen_info, int new_ws, Client * c2) return; } - /* Grab the pointer to avoid side effects with EnterNotify events */ - XGrabPointer (myScreenGetXDisplay (screen_info), screen_info->gnome_win, - FALSE, EnterWindowMask, GrabModeAsync, - GrabModeAsync, None, None, myDisplayGetCurrentTime (display_info)); + pointer_grabbed = ((c2 == NULL) && + (XGrabPointer (myScreenGetXDisplay (screen_info), screen_info->gnome_win, + FALSE, EnterWindowMask, GrabModeAsync, + GrabModeAsync, None, None, + myDisplayGetCurrentTime (display_info)) == GrabSuccess)); screen_info->previous_ws = screen_info->current_ws; screen_info->current_ws = new_ws; @@ -363,9 +365,12 @@ workspaceSwitch (ScreenInfo *screen_info, int new_ws, Client * c2) } } - /* Ungrab the pointer we grabbed before mapping/unmapping all windows */ - XUngrabPointer (myScreenGetXDisplay (screen_info), myDisplayGetCurrentTime (display_info)); - + if (pointer_grabbed) + { + /* Ungrab the pointer we grabbed before mapping/unmapping all windows */ + XUngrabPointer (myScreenGetXDisplay (screen_info), myDisplayGetCurrentTime (display_info)); + } + if (new_focus) { clientSetFocus (new_focus->screen_info, new_focus, myDisplayGetCurrentTime (display_info), NO_FOCUS_FLAG);