From f159611fabc6205c691d33b4fd035750e3dc836e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 21 May 2014 19:50:26 +0200 Subject: [PATCH] window: Fix delayed mouse mode Using clutter_actor_has_pointer() to test whether the pointer is on the window makes for clean and nice-looking code, but does not work in practice - ClutterActor:has-pointer is not recursive, so we miss when the pointer is on the associated surface actor rather than the actor itself. Instead, check whether the window actor contains the core pointer's pointer actor, which actually works. https://bugzilla.gnome.org/show_bug.cgi?id=730541 --- src/core/window.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core/window.c b/src/core/window.c index 54e3e4ab4..9bbfbced6 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -7701,8 +7701,16 @@ mouse_mode_focus (MetaWindow *window, static gboolean window_has_pointer (MetaWindow *window) { - ClutterActor *actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window)); - return clutter_actor_has_pointer (actor); + ClutterDeviceManager *dm; + ClutterInputDevice *dev; + ClutterActor *pointer_actor, *window_actor; + + dm = clutter_device_manager_get_default (); + dev = clutter_device_manager_get_core_device (dm, CLUTTER_POINTER_DEVICE); + pointer_actor = clutter_input_device_get_pointer_actor (dev); + window_actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window)); + + return pointer_actor && clutter_actor_contains (window_actor, pointer_actor); } static gboolean