[gnome-shell/wip/carlosg/grabs-pt2: 6/25] st: Use ClutterGrab for StScrollBar implicit grab




commit 42a5336689f31bbb333dd04e112f7ab0b0141545
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Nov 18 00:00:26 2021 +0100

    st: Use ClutterGrab for StScrollBar implicit grab

 src/st/st-scroll-bar.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/st/st-scroll-bar.c b/src/st/st-scroll-bar.c
index f7188e8247..4797511306 100644
--- a/src/st/st-scroll-bar.c
+++ b/src/st/st-scroll-bar.c
@@ -54,6 +54,7 @@ struct _StScrollBarPrivate
   gfloat        y_origin;
 
   ClutterInputDevice *grab_device;
+  ClutterGrab *grab;
 
   ClutterActor *trough;
   ClutterActor *handle;
@@ -626,7 +627,12 @@ stop_scrolling (StScrollBar *bar)
 
   st_widget_remove_style_pseudo_class (ST_WIDGET (priv->handle), "active");
 
-  clutter_input_device_ungrab (priv->grab_device);
+  if (priv->grab)
+    {
+      clutter_grab_dismiss (priv->grab);
+      g_clear_pointer (&priv->grab, clutter_grab_unref);
+    }
+
   priv->grab_device = NULL;
   g_signal_emit (bar, signals[SCROLL_STOP], 0);
 }
@@ -663,6 +669,7 @@ handle_button_press_event_cb (ClutterActor       *actor,
 {
   StScrollBarPrivate *priv = st_scroll_bar_get_instance_private (bar);
   ClutterInputDevice *device = clutter_event_get_device ((ClutterEvent*) event);
+  ClutterActor *stage;
 
   if (event->button != 1)
     return FALSE;
@@ -682,7 +689,8 @@ handle_button_press_event_cb (ClutterActor       *actor,
 
   g_assert (!priv->grab_device);
 
-  clutter_input_device_grab (device, priv->handle);
+  stage = clutter_actor_get_stage (actor);
+  priv->grab = clutter_stage_grab (CLUTTER_STAGE (stage), priv->handle);
   priv->grab_device = device;
   g_signal_emit (bar, signals[SCROLL_START], 0);
 


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