display: Use the grab pointer for delayed window raising

This commit is contained in:
Carlos Garnacho 2011-07-03 21:16:28 +02:00
parent 5ecbb3ec3b
commit 38df2715f2

View File

@ -48,6 +48,7 @@
#include "xprops.h" #include "xprops.h"
#include "workspace-private.h" #include "workspace-private.h"
#include "bell.h" #include "bell.h"
#include "device-pointer.h"
#include "device-keyboard.h" #include "device-keyboard.h"
#include "device-private.h" #include "device-private.h"
#include "input-events.h" #include "input-events.h"
@ -1458,22 +1459,26 @@ window_raise_with_delay_callback (void *data)
if (window == NULL) if (window == NULL)
return FALSE; return FALSE;
if (window->cur_grab == NULL)
return FALSE;
/* If we aren't already on top, check whether the pointer is inside /* If we aren't already on top, check whether the pointer is inside
* the window and raise the window if so. * the window and raise the window if so.
*/ */
if (meta_stack_get_top (window->screen->stack) != window) if (meta_stack_get_top (window->screen->stack) != window)
{ {
int x, y, root_x, root_y; int root_x, root_y;
Window root, child;
unsigned int mask;
gboolean same_screen; gboolean same_screen;
gboolean point_in_window; gboolean point_in_window;
MetaDevicePointer *pointer;
meta_error_trap_push (window->display); meta_error_trap_push (window->display);
same_screen = XQueryPointer (window->display->xdisplay, pointer = META_DEVICE_POINTER (window->cur_grab->grab_pointer);
same_screen = meta_device_pointer_query_position (pointer,
window->xwindow, window->xwindow,
&root, &child, NULL, NULL,
&root_x, &root_y, &x, &y, &mask); &root_x, &root_y,
NULL, NULL, NULL);
meta_error_trap_pop (window->display); meta_error_trap_pop (window->display);
point_in_window = point_in_window =