widget: Add a frameclock_connected boolean
... and use it to not connect anything to the frameclock if it isn't set. This gets around the problem that the frame clock is disconnected before GtkWidgetClass.unrealize() is called but the widget is still marked as realized and the frame clock is available during the vfunc, which makes calls like gtk_widget_queue_resize() reconnect to the frame clock. Closes #168
This commit is contained in:
parent
9e926f9a28
commit
b47bdda271
@ -2087,6 +2087,9 @@ gtk_container_start_idle_sizer (GtkContainer *container)
|
||||
if (clock == NULL)
|
||||
return;
|
||||
|
||||
if (!GTK_WIDGET (container)->priv->frameclock_connected)
|
||||
return;
|
||||
|
||||
container->priv->resize_clock = clock;
|
||||
container->priv->resize_handler = g_signal_connect (clock, "layout",
|
||||
G_CALLBACK (gtk_container_idle_sizer), container);
|
||||
|
@ -5297,7 +5297,7 @@ gtk_widget_add_tick_callback (GtkWidget *widget,
|
||||
|
||||
priv = widget->priv;
|
||||
|
||||
if (priv->realized && !priv->clock_tick_id)
|
||||
if (priv->frameclock_connected && !priv->clock_tick_id)
|
||||
{
|
||||
frame_clock = gtk_widget_get_frame_clock (widget);
|
||||
|
||||
@ -5368,6 +5368,8 @@ gtk_widget_connect_frame_clock (GtkWidget *widget,
|
||||
{
|
||||
GtkWidgetPrivate *priv = widget->priv;
|
||||
|
||||
priv->frameclock_connected = TRUE;
|
||||
|
||||
if (GTK_IS_CONTAINER (widget))
|
||||
_gtk_container_maybe_start_idle_sizer (GTK_CONTAINER (widget));
|
||||
|
||||
@ -5403,6 +5405,8 @@ gtk_widget_disconnect_frame_clock (GtkWidget *widget,
|
||||
gdk_frame_clock_end_updating (frame_clock);
|
||||
}
|
||||
|
||||
priv->frameclock_connected = FALSE;
|
||||
|
||||
if (priv->context)
|
||||
gtk_style_context_set_frame_clock (priv->context, NULL);
|
||||
}
|
||||
|
@ -89,6 +89,7 @@ struct _GtkWidgetPrivate
|
||||
guint hexpand_set : 1; /* whether to use application-forced */
|
||||
guint vexpand_set : 1; /* instead of computing from children */
|
||||
guint has_tooltip : 1;
|
||||
guint frameclock_connected : 1;
|
||||
|
||||
/* SizeGroup related flags */
|
||||
guint have_size_groups : 1;
|
||||
|
Loading…
Reference in New Issue
Block a user