mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
widget: Add checks for setting state flags
This is more for GTK developers to catch when they forgot to change GTK_STATE_FLAGS_BITS after adding a new state flag than to prevent widget developers from using the wrong flags.
This commit is contained in:
parent
e5d0d5f9e6
commit
65cc3630c8
@ -8790,6 +8790,7 @@ gtk_widget_set_state_flags (GtkWidget *widget,
|
||||
#define ALLOWED_FLAGS (~(GTK_STATE_FLAG_DIR_LTR | GTK_STATE_FLAG_DIR_RTL))
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
g_return_if_fail (flags < (1 << GTK_STATE_FLAGS_BITS));
|
||||
|
||||
if ((!clear && (widget->priv->state_flags & flags) == flags) ||
|
||||
(clear && widget->priv->state_flags == flags))
|
||||
@ -8819,6 +8820,7 @@ gtk_widget_unset_state_flags (GtkWidget *widget,
|
||||
GtkStateFlags flags)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
g_return_if_fail (flags < (1 << GTK_STATE_FLAGS_BITS));
|
||||
|
||||
if ((widget->priv->state_flags & flags) == 0)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user