mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 03:20:46 -05:00
window: Fix delayed mouse mode on X
On X, basing the check whether the pointer is on the window on Clutter events does not work, as the relevant events are handled by GDK instead. So add an X-specific window_has_pointer() implementation to also fix mouse mode when running as X compositor. https://bugzilla.gnome.org/show_bug.cgi?id=730541
This commit is contained in:
parent
f159611fab
commit
f38c1f6ab4
@ -7699,7 +7699,7 @@ mouse_mode_focus (MetaWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
window_has_pointer (MetaWindow *window)
|
window_has_pointer_wayland (MetaWindow *window)
|
||||||
{
|
{
|
||||||
ClutterDeviceManager *dm;
|
ClutterDeviceManager *dm;
|
||||||
ClutterInputDevice *dev;
|
ClutterInputDevice *dev;
|
||||||
@ -7713,6 +7713,39 @@ window_has_pointer (MetaWindow *window)
|
|||||||
return pointer_actor && clutter_actor_contains (window_actor, pointer_actor);
|
return pointer_actor && clutter_actor_contains (window_actor, pointer_actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
window_has_pointer_x11 (MetaWindow *window)
|
||||||
|
{
|
||||||
|
MetaDisplay *display = window->display;
|
||||||
|
MetaScreen *screen = window->screen;
|
||||||
|
Window root, child;
|
||||||
|
double root_x, root_y, x, y;
|
||||||
|
XIButtonState buttons;
|
||||||
|
XIModifierState mods;
|
||||||
|
XIGroupState group;
|
||||||
|
|
||||||
|
meta_error_trap_push (display);
|
||||||
|
XIQueryPointer (display->xdisplay,
|
||||||
|
META_VIRTUAL_CORE_POINTER_ID,
|
||||||
|
screen->xroot,
|
||||||
|
&root, &child,
|
||||||
|
&root_x, &root_y, &x, &y,
|
||||||
|
&buttons, &mods, &group);
|
||||||
|
meta_error_trap_pop (display);
|
||||||
|
free (buttons.mask);
|
||||||
|
|
||||||
|
return meta_display_lookup_x_window (display, child) == window;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
window_has_pointer (MetaWindow *window)
|
||||||
|
{
|
||||||
|
if (meta_is_wayland_compositor ())
|
||||||
|
return window_has_pointer_wayland (window);
|
||||||
|
else
|
||||||
|
return window_has_pointer_x11 (window);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
window_focus_on_pointer_rest_callback (gpointer data)
|
window_focus_on_pointer_rest_callback (gpointer data)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user