st/button: Ungrab device before calling st_button_release

Since priv->device gets set to NULL inside st_button_release, ungrab the
input device before calling st_button_release and avoid
clutter_input_device_ungrab failing with a critical error.

This fixes a regression introduced with
d5a1a888d9

While at it, also remove the superfluous line resetting priv->device to
NULL and move the check for priv->grabbed into an elseif block since
there should be no case where StButton has both grabs at the same time.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/614
This commit is contained in:
Jonas Dreßler 2019-07-04 17:33:06 +02:00
parent 8a22092632
commit 0bdd1b6fc4

View File

@ -779,18 +779,15 @@ st_button_fake_release (StButton *button)
clutter_input_device_sequence_ungrab (priv->device, clutter_input_device_sequence_ungrab (priv->device,
priv->press_sequence); priv->press_sequence);
} }
else if (priv->grabbed)
if (priv->pressed || priv->press_sequence)
st_button_release (button, priv->device,
priv->pressed, 0, NULL);
if (priv->grabbed)
{ {
priv->grabbed = 0; priv->grabbed = 0;
clutter_input_device_ungrab (priv->device); clutter_input_device_ungrab (priv->device);
} }
priv->device = NULL; if (priv->pressed || priv->press_sequence)
st_button_release (button, priv->device,
priv->pressed, 0, NULL);
} }
/******************************************************************************/ /******************************************************************************/