display: Use meta_window_has_pointer instead of XQueryPointer

This commit is contained in:
Jasper St. Pierre 2014-06-12 17:01:13 -04:00
parent a7350475e8
commit ad60ea9e0e
3 changed files with 6 additions and 20 deletions

View File

@ -1344,23 +1344,7 @@ window_raise_with_delay_callback (void *data)
*/
if (meta_stack_get_top (window->screen->stack) != window)
{
int x, y, root_x, root_y;
Window root, child;
MetaRectangle frame_rect;
unsigned int mask;
gboolean same_screen;
gboolean point_in_window;
meta_error_trap_push (window->display);
same_screen = XQueryPointer (window->display->xdisplay,
window->xwindow,
&root, &child,
&root_x, &root_y, &x, &y, &mask);
meta_error_trap_pop (window->display);
meta_window_get_frame_rect (window, &frame_rect);
point_in_window = POINT_IN_RECT (root_x, root_y, frame_rect);
if (same_screen && point_in_window)
if (meta_window_has_pointer (window))
meta_window_raise (window);
else
meta_topic (META_DEBUG_FOCUS,

View File

@ -702,4 +702,6 @@ void meta_window_grab_op_ended (MetaWindow *window, MetaGrabOp op);
void meta_window_set_alive (MetaWindow *window, gboolean is_alive);
gboolean meta_window_has_pointer (MetaWindow *window);
#endif

View File

@ -7663,8 +7663,8 @@ window_has_pointer_x11 (MetaWindow *window)
return meta_display_lookup_x_window (display, child) == window;
}
static gboolean
window_has_pointer (MetaWindow *window)
gboolean
meta_window_has_pointer (MetaWindow *window)
{
if (meta_is_wayland_compositor ())
return window_has_pointer_wayland (window);
@ -7696,7 +7696,7 @@ window_focus_on_pointer_rest_callback (gpointer data)
return TRUE;
}
if (!window_has_pointer (window))
if (!meta_window_has_pointer (window))
goto out;
timestamp = meta_display_get_current_time_roundtrip (display);