st: Replace global grabs with input device grabs
Global grabs are being removed from Clutter in favour of input device grabs, so only grab the input device instead and replace priv->grabbed with checks for priv->grab_device. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/495
This commit is contained in:
parent
6c33aff6d1
commit
d5a1a888d9
@ -192,7 +192,7 @@ st_button_button_press (ClutterActor *actor,
|
|||||||
if (priv->button_mask & mask)
|
if (priv->button_mask & mask)
|
||||||
{
|
{
|
||||||
if (priv->grabbed == 0)
|
if (priv->grabbed == 0)
|
||||||
clutter_grab_pointer (actor);
|
clutter_input_device_grab (device, actor);
|
||||||
|
|
||||||
priv->grabbed |= mask;
|
priv->grabbed |= mask;
|
||||||
st_button_press (button, device, mask, NULL);
|
st_button_press (button, device, mask, NULL);
|
||||||
@ -221,7 +221,7 @@ st_button_button_release (ClutterActor *actor,
|
|||||||
|
|
||||||
priv->grabbed &= ~mask;
|
priv->grabbed &= ~mask;
|
||||||
if (priv->grabbed == 0)
|
if (priv->grabbed == 0)
|
||||||
clutter_ungrab_pointer ();
|
clutter_input_device_ungrab (device);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -787,7 +787,7 @@ st_button_fake_release (StButton *button)
|
|||||||
if (priv->grabbed)
|
if (priv->grabbed)
|
||||||
{
|
{
|
||||||
priv->grabbed = 0;
|
priv->grabbed = 0;
|
||||||
clutter_ungrab_pointer ();
|
clutter_input_device_ungrab (priv->device);
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->device = NULL;
|
priv->device = NULL;
|
||||||
|
@ -49,10 +49,11 @@ struct _StScrollBarPrivate
|
|||||||
{
|
{
|
||||||
StAdjustment *adjustment;
|
StAdjustment *adjustment;
|
||||||
|
|
||||||
gboolean grabbed;
|
|
||||||
gfloat x_origin;
|
gfloat x_origin;
|
||||||
gfloat y_origin;
|
gfloat y_origin;
|
||||||
|
|
||||||
|
ClutterInputDevice *grab_device;
|
||||||
|
|
||||||
ClutterActor *trough;
|
ClutterActor *trough;
|
||||||
ClutterActor *handle;
|
ClutterActor *handle;
|
||||||
|
|
||||||
@ -601,13 +602,13 @@ static void
|
|||||||
stop_scrolling (StScrollBar *bar)
|
stop_scrolling (StScrollBar *bar)
|
||||||
{
|
{
|
||||||
StScrollBarPrivate *priv = st_scroll_bar_get_instance_private (bar);
|
StScrollBarPrivate *priv = st_scroll_bar_get_instance_private (bar);
|
||||||
if (!priv->grabbed)
|
if (!priv->grab_device)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
st_widget_remove_style_pseudo_class (ST_WIDGET (priv->handle), "active");
|
st_widget_remove_style_pseudo_class (ST_WIDGET (priv->handle), "active");
|
||||||
|
|
||||||
clutter_ungrab_pointer ();
|
clutter_input_device_ungrab (priv->grab_device);
|
||||||
priv->grabbed = FALSE;
|
priv->grab_device = NULL;
|
||||||
g_signal_emit (bar, signals[SCROLL_STOP], 0);
|
g_signal_emit (bar, signals[SCROLL_STOP], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,7 +618,7 @@ handle_motion_event_cb (ClutterActor *trough,
|
|||||||
StScrollBar *bar)
|
StScrollBar *bar)
|
||||||
{
|
{
|
||||||
StScrollBarPrivate *priv = st_scroll_bar_get_instance_private (bar);
|
StScrollBarPrivate *priv = st_scroll_bar_get_instance_private (bar);
|
||||||
if (!priv->grabbed)
|
if (!priv->grab_device)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
move_slider (bar, event->x, event->y);
|
move_slider (bar, event->x, event->y);
|
||||||
@ -642,6 +643,7 @@ handle_button_press_event_cb (ClutterActor *actor,
|
|||||||
StScrollBar *bar)
|
StScrollBar *bar)
|
||||||
{
|
{
|
||||||
StScrollBarPrivate *priv = st_scroll_bar_get_instance_private (bar);
|
StScrollBarPrivate *priv = st_scroll_bar_get_instance_private (bar);
|
||||||
|
ClutterInputDevice *device = clutter_event_get_device ((ClutterEvent*) event);
|
||||||
|
|
||||||
if (event->button != 1)
|
if (event->button != 1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -659,10 +661,10 @@ handle_button_press_event_cb (ClutterActor *actor,
|
|||||||
priv->x_origin += clutter_actor_get_x (priv->trough);
|
priv->x_origin += clutter_actor_get_x (priv->trough);
|
||||||
priv->y_origin += clutter_actor_get_y (priv->trough);
|
priv->y_origin += clutter_actor_get_y (priv->trough);
|
||||||
|
|
||||||
g_assert (!priv->grabbed);
|
g_assert (!priv->grab_device);
|
||||||
|
|
||||||
clutter_grab_pointer (priv->handle);
|
clutter_input_device_grab (device, priv->handle);
|
||||||
priv->grabbed = TRUE;
|
priv->grab_device = device;
|
||||||
g_signal_emit (bar, signals[SCROLL_START], 0);
|
g_signal_emit (bar, signals[SCROLL_START], 0);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user