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




commit e6b21a0565e7db08ab105015599309c671fa1b1a
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 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/st/st-scroll-bar.c b/src/st/st-scroll-bar.c
index f7188e8247..9ee3c597fa 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,8 @@ stop_scrolling (StScrollBar *bar)
 
   st_widget_remove_style_pseudo_class (ST_WIDGET (priv->handle), "active");
 
-  clutter_input_device_ungrab (priv->grab_device);
+  g_clear_pointer (&priv->grab, clutter_grab_dismiss);
+
   priv->grab_device = NULL;
   g_signal_emit (bar, signals[SCROLL_STOP], 0);
 }
@@ -663,6 +665,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 +685,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]