Commit 41a07326 authored by Javier Jardón's avatar Javier Jardón

Don't use GTK_WIDGET_*SET_FLAGS (wid, GTK_HAS_DEFAULT)

Introduce internal _gtk_widget_set_has_default() for this

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=614515
parent 45257e31
......@@ -5612,6 +5612,16 @@ gtk_widget_has_default (GtkWidget *widget)
return (GTK_OBJECT_FLAGS (widget) & GTK_HAS_DEFAULT) != 0;
}
void
_gtk_widget_set_has_default (GtkWidget *widget,
gboolean has_default)
{
if (has_default)
GTK_OBJECT_FLAGS (widget) |= GTK_HAS_DEFAULT;
else
GTK_OBJECT_FLAGS (widget) &= ~(GTK_HAS_DEFAULT);
}
/**
* gtk_widget_grab_default:
* @widget: a #GtkWidget
......
......@@ -1296,6 +1296,8 @@ void gtk_requisition_free (GtkRequisition *requisition);
# define gtk_widget_unref g_object_unref
#endif /* GTK_TRACE_OBJECTS && __GNUC__ */
void _gtk_widget_set_has_default (GtkWidget *widget,
gboolean has_default);
void _gtk_widget_set_has_grab (GtkWidget *widget,
gboolean has_grab);
void _gtk_widget_set_is_toplevel (GtkWidget *widget,
......
......@@ -1664,7 +1664,7 @@ gtk_window_set_default (GtkWindow *window,
if (window->focus_widget != window->default_widget ||
!gtk_widget_get_receives_default (window->default_widget))
GTK_WIDGET_UNSET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
_gtk_widget_set_has_default (window->default_widget, FALSE);
gtk_widget_queue_draw (window->default_widget);
}
......@@ -1674,7 +1674,7 @@ gtk_window_set_default (GtkWindow *window,
{
if (window->focus_widget == NULL ||
!gtk_widget_get_receives_default (window->focus_widget))
GTK_WIDGET_SET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
_gtk_widget_set_has_default (window->default_widget, TRUE);
gtk_widget_queue_draw (window->default_widget);
}
......@@ -5480,11 +5480,11 @@ gtk_window_real_set_focus (GtkWindow *window,
if (gtk_widget_get_receives_default (window->focus_widget) &&
(window->focus_widget != window->default_widget))
{
GTK_WIDGET_UNSET_FLAGS (window->focus_widget, GTK_HAS_DEFAULT);
_gtk_widget_set_has_default (window->focus_widget, FALSE);
gtk_widget_queue_draw (window->focus_widget);
if (window->default_widget)
GTK_WIDGET_SET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
_gtk_widget_set_has_default (window->default_widget, TRUE);
}
window->focus_widget = NULL;
......@@ -5506,10 +5506,10 @@ gtk_window_real_set_focus (GtkWindow *window,
(window->focus_widget != window->default_widget))
{
if (gtk_widget_get_can_default (window->focus_widget))
GTK_WIDGET_SET_FLAGS (window->focus_widget, GTK_HAS_DEFAULT);
_gtk_widget_set_has_default (window->focus_widget, TRUE);
if (window->default_widget)
GTK_WIDGET_UNSET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
_gtk_widget_set_has_default (window->default_widget, FALSE);
}
if (window->has_focus)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment