[mutter] pointer: Sync the focus surface instead of calling set_focus directly



commit c5033616e9a7f51a12eba068a4116b8772cbd8d1
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Nov 26 15:22:01 2014 -0800

    pointer: Sync the focus surface instead of calling set_focus directly
    
    set_focus is really meant to be an internal function, and
    sync_focus_surface should be able to be called at any time and get
    things right.

 src/wayland/meta-wayland-pointer.c |   62 ++++++++++++++++++------------------
 1 files changed, 31 insertions(+), 31 deletions(-)
---
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index 2b99183..52d13da 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -66,6 +66,36 @@ unbind_resource (struct wl_resource *resource)
 }
 
 static void
+sync_focus_surface (MetaWaylandPointer *pointer)
+{
+  MetaDisplay *display = meta_get_display ();
+
+  switch (display->event_route)
+    {
+    case META_EVENT_ROUTE_WINDOW_OP:
+      /* Don't update the focus surface while we're grabbing a window. */
+      return;
+
+    case META_EVENT_ROUTE_COMPOSITOR_GRAB:
+      /* The compositor has a grab, so remove our focus... */
+      meta_wayland_pointer_set_focus (pointer, NULL);
+      break;
+
+    case META_EVENT_ROUTE_NORMAL:
+    case META_EVENT_ROUTE_WAYLAND_POPUP:
+      {
+        const MetaWaylandPointerGrabInterface *interface = pointer->grab->interface;
+        interface->focus (pointer->grab, pointer->current);
+      }
+      break;
+
+    default:
+      g_assert_not_reached ();
+    }
+
+}
+
+static void
 set_cursor_surface (MetaWaylandPointer *pointer,
                     MetaWaylandSurface *surface)
 {
@@ -179,7 +209,7 @@ default_grab_button (MetaWaylandPointerGrab *grab,
     }
 
   if (pointer->button_count == 0 && event_type == CLUTTER_BUTTON_RELEASE)
-    meta_wayland_pointer_set_focus (pointer, pointer->current);
+    sync_focus_surface (pointer);
 }
 
 static const MetaWaylandPointerGrabInterface default_pointer_grab_interface = {
@@ -248,36 +278,6 @@ count_buttons (const ClutterEvent *event)
 }
 
 static void
-sync_focus_surface (MetaWaylandPointer *pointer)
-{
-  MetaDisplay *display = meta_get_display ();
-
-  switch (display->event_route)
-    {
-    case META_EVENT_ROUTE_WINDOW_OP:
-      /* Don't update the focus surface while we're grabbing a window. */
-      return;
-
-    case META_EVENT_ROUTE_COMPOSITOR_GRAB:
-      /* The compositor has a grab, so remove our focus... */
-      meta_wayland_pointer_set_focus (pointer, NULL);
-      break;
-
-    case META_EVENT_ROUTE_NORMAL:
-    case META_EVENT_ROUTE_WAYLAND_POPUP:
-      {
-        const MetaWaylandPointerGrabInterface *interface = pointer->grab->interface;
-        interface->focus (pointer->grab, pointer->current);
-      }
-      break;
-
-    default:
-      g_assert_not_reached ();
-    }
-
-}
-
-static void
 repick_for_event (MetaWaylandPointer *pointer,
                   const ClutterEvent *for_event)
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]