widget: Don't crash if setting alpha on non-realized widget.

https://bugzilla.gnome.org/show_bug.cgi?id=703154
This commit is contained in:
Alexander Larsson 2013-07-04 12:54:59 +02:00
parent fa6a137478
commit 9e4af0b746

View File

@ -4999,6 +4999,10 @@ gtk_widget_realize (GtkWidget *widget)
_gtk_widget_enable_device_events (widget);
gtk_widget_update_devices_mask (widget, TRUE);
if (gtk_widget_is_toplevel (widget))
gdk_window_set_opacity (priv->window,
priv->alpha / 255.0);
if (priv->context)
gtk_style_context_set_scale (priv->context, gtk_widget_get_scale_factor (widget));
gtk_widget_connect_frame_clock (widget,
@ -14953,12 +14957,14 @@ gtk_widget_update_alpha (GtkWidget *widget)
priv->alpha = alpha;
if (gtk_widget_is_toplevel (widget))
gdk_window_set_opacity (priv->window,
priv->alpha / 255.0);
if (gtk_widget_get_realized (widget))
gtk_widget_queue_draw (widget);
{
if (gtk_widget_is_toplevel (widget))
gdk_window_set_opacity (priv->window,
priv->alpha / 255.0);
gtk_widget_queue_draw (widget);
}
}
static void