Commit 98a67d96 authored by Carlos Garnacho's avatar Carlos Garnacho

popover: propagate (insensitive|backdrop) flags from relative-to widget

Popovers aren't direct children of the widget they point to, but yet
they act as children of it, so do the same with state propagation,
so the flags that propagate across the hierarchy reach popovers too.
parent 63bed5d0
......@@ -85,6 +85,7 @@ struct _GtkPopoverPrivate
guint unmap_id;
guint scrollable_notify_id;
guint grab_notify_id;
guint state_changed_id;
guint has_pointing_to : 1;
guint preferred_position : 2;
guint final_position : 2;
......@@ -1295,6 +1296,35 @@ _gtk_popover_parent_hierarchy_changed (GtkWidget *widget,
g_object_unref (popover);
static void
_popover_propagate_state (GtkPopover *popover,
GtkStateFlags state,
GtkStateFlags old_state,
GtkStateFlags flag)
if ((state & flag) != (old_state & flag))
if ((state & flag) == flag)
gtk_widget_set_state_flags (GTK_WIDGET (popover), flag, FALSE);
gtk_widget_unset_state_flags (GTK_WIDGET (popover), flag);
static void
_gtk_popover_parent_state_changed (GtkWidget *widget,
GtkStateFlags old_state,
GtkPopover *popover)
guint state;
state = gtk_widget_get_state_flags (widget);
_popover_propagate_state (popover, state, old_state,
_popover_propagate_state (popover, state, old_state,
static void
_gtk_popover_parent_grab_notify (GtkWidget *widget,
gboolean was_shadowed,
......@@ -1455,6 +1485,8 @@ gtk_popover_update_relative_to (GtkPopover *popover,
g_signal_handler_disconnect (priv->widget, priv->size_allocate_id);
if (g_signal_handler_is_connected (priv->widget, priv->unmap_id))
g_signal_handler_disconnect (priv->widget, priv->unmap_id);
if (g_signal_handler_is_connected (priv->widget, priv->state_changed_id))
g_signal_handler_disconnect (priv->widget, priv->state_changed_id);
if (g_signal_handler_is_connected (priv->widget, priv->grab_notify_id))
g_signal_handler_disconnect (priv->widget, priv->grab_notify_id);
......@@ -1488,6 +1520,10 @@ gtk_popover_update_relative_to (GtkPopover *popover,
g_signal_connect (priv->widget, "unmap",
G_CALLBACK (_gtk_popover_parent_unmap),
priv->state_changed_id =
g_signal_connect (priv->widget, "state-flags-changed",
G_CALLBACK (_gtk_popover_parent_state_changed),
priv->grab_notify_id =
g_signal_connect (priv->widget, "grab-notify",
G_CALLBACK (_gtk_popover_parent_grab_notify),
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