[mutter] seat: Don't require an event to repick()



commit a8d2dfd14f02c9690c32d3dfcb452ec189ad7d92
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Apr 17 18:46:14 2014 -0400

    seat: Don't require an event to repick()
    
    We always pass NULL, and anywhere where we want to pass an event
    should be handled internally.

 src/core/display.c              |    2 +-
 src/wayland/meta-wayland-seat.c |   78 +++++++++++++++++++++------------------
 src/wayland/meta-wayland-seat.h |    3 +-
 src/wayland/meta-wayland.c      |    2 +-
 4 files changed, 45 insertions(+), 40 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index dc82cc0..75f6f43 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1544,7 +1544,7 @@ meta_display_sync_wayland_input_focus (MetaDisplay *display)
 
   meta_wayland_compositor_set_input_focus (compositor, focus_window);
 
-  meta_wayland_seat_repick (compositor->seat, NULL);
+  meta_wayland_seat_repick (compositor->seat);
 }
 
 void
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
index 4bd6ea4..aafbbd6 100644
--- a/src/wayland/meta-wayland-seat.c
+++ b/src/wayland/meta-wayland-seat.c
@@ -186,12 +186,51 @@ meta_wayland_seat_update (MetaWaylandSeat    *seat,
 }
 
 static void
+repick_for_event (MetaWaylandSeat    *seat,
+                  const ClutterEvent *for_event)
+{
+  ClutterActor       *actor   = NULL;
+  MetaWaylandPointer *pointer = &seat->pointer;
+  MetaWaylandSurface *surface = NULL;
+  MetaDisplay        *display = meta_get_display ();
+
+  if (meta_grab_op_should_block_wayland (display->grab_op))
+    {
+      meta_wayland_pointer_update_current_focus (pointer, NULL);
+      return;
+    }
+
+  if (for_event)
+    {
+      actor = clutter_event_get_source (for_event);
+    }
+  else if (seat->current_stage)
+    {
+      ClutterStage *stage = CLUTTER_STAGE (seat->current_stage);
+      actor = clutter_stage_get_actor_at_pos (stage,
+                                              CLUTTER_PICK_REACTIVE,
+                                              wl_fixed_to_double (pointer->x),
+                                              wl_fixed_to_double (pointer->y));
+    }
+
+  if (actor)
+    seat->current_stage = clutter_actor_get_stage (actor);
+  else
+    seat->current_stage = NULL;
+
+  if (META_IS_SURFACE_ACTOR_WAYLAND (actor))
+    surface = meta_surface_actor_wayland_get_surface (META_SURFACE_ACTOR_WAYLAND (actor));
+
+  meta_wayland_pointer_update_current_focus (pointer, surface);
+}
+
+static void
 notify_motion (MetaWaylandSeat    *seat,
                const ClutterEvent *event)
 {
   MetaWaylandPointer *pointer = &seat->pointer;
 
-  meta_wayland_seat_repick (seat, event);
+  repick_for_event (seat, event);
 
   pointer->grab->interface->motion (pointer->grab, event);
 }
@@ -316,42 +355,9 @@ meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
 }
 
 void
-meta_wayland_seat_repick (MetaWaylandSeat    *seat,
-                         const ClutterEvent *for_event)
+meta_wayland_seat_repick (MetaWaylandSeat *seat)
 {
-  ClutterActor       *actor   = NULL;
-  MetaWaylandPointer *pointer = &seat->pointer;
-  MetaWaylandSurface *surface = NULL;
-  MetaDisplay        *display = meta_get_display ();
-
-  if (meta_grab_op_should_block_wayland (display->grab_op))
-    {
-      meta_wayland_pointer_update_current_focus (pointer, NULL);
-      return;
-    }
-
-  if (for_event)
-    {
-      actor = clutter_event_get_source (for_event);
-    }
-  else if (seat->current_stage)
-    {
-      ClutterStage *stage = CLUTTER_STAGE (seat->current_stage);
-      actor = clutter_stage_get_actor_at_pos (stage,
-                                              CLUTTER_PICK_REACTIVE,
-                                              wl_fixed_to_double (pointer->x),
-                                              wl_fixed_to_double (pointer->y));
-    }
-
-  if (actor)
-    seat->current_stage = clutter_actor_get_stage (actor);
-  else
-    seat->current_stage = NULL;
-
-  if (META_IS_SURFACE_ACTOR_WAYLAND (actor))
-    surface = meta_surface_actor_wayland_get_surface (META_SURFACE_ACTOR_WAYLAND (actor));
-
-  meta_wayland_pointer_update_current_focus (pointer, surface);
+  repick_for_event (seat, NULL);
 }
 
 void
diff --git a/src/wayland/meta-wayland-seat.h b/src/wayland/meta-wayland-seat.h
index 72af963..5f807f9 100644
--- a/src/wayland/meta-wayland-seat.h
+++ b/src/wayland/meta-wayland-seat.h
@@ -76,8 +76,7 @@ meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
                                 const ClutterEvent *event);
 
 void
-meta_wayland_seat_repick (MetaWaylandSeat    *seat,
-                         const ClutterEvent *for_event);
+meta_wayland_seat_repick (MetaWaylandSeat *seat);
 
 void
 meta_wayland_seat_update_cursor_surface (MetaWaylandSeat *seat);
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 1d9be56..8f3fc07 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -196,7 +196,7 @@ meta_wayland_compositor_set_input_focus (MetaWaylandCompositor *compositor,
 void
 meta_wayland_compositor_repick (MetaWaylandCompositor *compositor)
 {
-  meta_wayland_seat_repick (compositor->seat, NULL);
+  meta_wayland_seat_repick (compositor->seat);
 }
 
 static void


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