button: Split out function

This is in preparation of the following cleanup commits.
This commit is contained in:
Benjamin Otte 2013-12-02 13:41:15 +01:00
parent 85b17e778c
commit 804be65a09

View File

@ -1970,6 +1970,26 @@ gtk_button_touch (GtkWidget *widget,
return GDK_EVENT_PROPAGATE; return GDK_EVENT_PROPAGATE;
} }
static void
gtk_button_do_release (GtkButton *button,
gboolean emit_clicked)
{
GtkButtonPrivate *priv = button->priv;
if (priv->button_down)
{
priv->button_down = FALSE;
if (priv->activate_timeout)
return;
if (emit_clicked)
gtk_button_clicked (button);
gtk_button_update_state (button);
}
}
static gboolean static gboolean
gtk_button_grab_broken (GtkWidget *widget, gtk_button_grab_broken (GtkWidget *widget,
GdkEventGrabBroken *event) GdkEventGrabBroken *event)
@ -2096,21 +2116,9 @@ touch_release_in_button (GtkButton *button)
static void static void
gtk_real_button_released (GtkButton *button) gtk_real_button_released (GtkButton *button)
{ {
GtkButtonPrivate *priv = button->priv; gtk_button_do_release (button,
button->priv->in_button ||
if (priv->button_down) touch_release_in_button (button));
{
priv->button_down = FALSE;
if (priv->activate_timeout)
return;
if (priv->in_button ||
touch_release_in_button (button))
gtk_button_clicked (button);
gtk_button_update_state (button);
}
} }
static void static void