button: Call the new function

This simplifies a lot of code and doesn't require hacks setting
in_button anymore.
This commit is contained in:
Benjamin Otte 2013-12-02 21:24:30 +01:00
parent 804be65a09
commit 9a0064c684

View File

@ -1995,21 +1995,8 @@ gtk_button_grab_broken (GtkWidget *widget,
GdkEventGrabBroken *event) GdkEventGrabBroken *event)
{ {
GtkButton *button = GTK_BUTTON (widget); GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
gboolean save_in;
/* Simulate a button release without the pointer in the button */ gtk_button_do_release (button, FALSE);
if (priv->button_down)
{
save_in = priv->in_button;
priv->in_button = FALSE;
gtk_real_button_released (button);
if (save_in != priv->in_button)
{
priv->in_button = save_in;
gtk_button_update_state (button);
}
}
return TRUE; return TRUE;
} }
@ -2721,7 +2708,7 @@ gtk_button_state_changed (GtkWidget *widget,
if (!gtk_widget_is_sensitive (widget)) if (!gtk_widget_is_sensitive (widget))
{ {
priv->in_button = FALSE; priv->in_button = FALSE;
gtk_real_button_released (button); gtk_button_do_release (button, FALSE);
} }
} }
@ -2731,7 +2718,6 @@ gtk_button_grab_notify (GtkWidget *widget,
{ {
GtkButton *button = GTK_BUTTON (widget); GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv; GtkButtonPrivate *priv = button->priv;
gboolean save_in;
if (priv->activate_timeout && if (priv->activate_timeout &&
priv->grab_keyboard && priv->grab_keyboard &&
@ -2739,16 +2725,7 @@ gtk_button_grab_notify (GtkWidget *widget,
gtk_button_finish_activate (button, FALSE); gtk_button_finish_activate (button, FALSE);
if (!was_grabbed) if (!was_grabbed)
{ gtk_button_do_release (button, FALSE);
save_in = priv->in_button;
priv->in_button = FALSE;
gtk_real_button_released (button);
if (save_in != priv->in_button)
{
priv->in_button = save_in;
gtk_button_update_state (button);
}
}
} }
/** /**