Don't assume a screen exists before realize()
Fix for https://bugzilla.gnome.org/show_bug.cgi?id=641429
This commit is contained in:
parent
2b2e607492
commit
4dc9b294d8
@ -813,13 +813,15 @@ gtk_style_copy (GtkStyle *style)
|
|||||||
|
|
||||||
GtkStyle*
|
GtkStyle*
|
||||||
_gtk_style_new_for_path (GdkScreen *screen,
|
_gtk_style_new_for_path (GdkScreen *screen,
|
||||||
GtkWidgetPath *path)
|
GtkWidgetPath *path)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
GtkStyle *style;
|
GtkStyle *style;
|
||||||
|
|
||||||
context = gtk_style_context_new ();
|
context = gtk_style_context_new ();
|
||||||
gtk_style_context_set_screen (context, screen);
|
|
||||||
|
if (screen)
|
||||||
|
gtk_style_context_set_screen (context, screen);
|
||||||
gtk_style_context_set_path (context, path);
|
gtk_style_context_set_path (context, path);
|
||||||
|
|
||||||
style = g_object_new (GTK_TYPE_STYLE,
|
style = g_object_new (GTK_TYPE_STYLE,
|
||||||
@ -848,8 +850,7 @@ gtk_style_new (void)
|
|||||||
path = gtk_widget_path_new ();
|
path = gtk_widget_path_new ();
|
||||||
gtk_widget_path_append_type (path, GTK_TYPE_WIDGET);
|
gtk_widget_path_append_type (path, GTK_TYPE_WIDGET);
|
||||||
|
|
||||||
style = _gtk_style_new_for_path (gdk_screen_get_default (),
|
style = _gtk_style_new_for_path (gdk_screen_get_default (), path);
|
||||||
path);
|
|
||||||
|
|
||||||
gtk_widget_path_free (path);
|
gtk_widget_path_free (path);
|
||||||
|
|
||||||
|
@ -2617,7 +2617,7 @@ gtk_style_context_set_screen (GtkStyleContext *context,
|
|||||||
GtkStyleContextPrivate *priv;
|
GtkStyleContextPrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||||
g_return_if_fail (GDK_IS_SCREEN (screen));
|
g_return_if_fail (screen == NULL || GDK_IS_SCREEN (screen));
|
||||||
|
|
||||||
priv = context->priv;
|
priv = context->priv;
|
||||||
if (priv->screen == screen)
|
if (priv->screen == screen)
|
||||||
|
@ -14179,7 +14179,7 @@ gtk_widget_get_style_context (GtkWidget *widget)
|
|||||||
G_CALLBACK (style_context_changed), widget);
|
G_CALLBACK (style_context_changed), widget);
|
||||||
|
|
||||||
gtk_style_context_set_screen (widget->priv->context,
|
gtk_style_context_set_screen (widget->priv->context,
|
||||||
gtk_widget_get_screen (widget));
|
gtk_widget_get_screen_unchecked (widget));
|
||||||
|
|
||||||
_gtk_widget_update_path (widget);
|
_gtk_widget_update_path (widget);
|
||||||
gtk_style_context_set_path (widget->priv->context,
|
gtk_style_context_set_path (widget->priv->context,
|
||||||
|
@ -1108,8 +1108,9 @@ gtk_window_init (GtkWindow *window)
|
|||||||
priv->has_user_ref_count = TRUE;
|
priv->has_user_ref_count = TRUE;
|
||||||
toplevel_list = g_slist_prepend (toplevel_list, window);
|
toplevel_list = g_slist_prepend (toplevel_list, window);
|
||||||
|
|
||||||
g_signal_connect (priv->screen, "composited-changed",
|
if (priv->screen)
|
||||||
G_CALLBACK (gtk_window_on_composited_changed), window);
|
g_signal_connect (priv->screen, "composited-changed",
|
||||||
|
G_CALLBACK (gtk_window_on_composited_changed), window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -7961,7 +7962,7 @@ gtk_window_set_screen (GtkWindow *window,
|
|||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GdkScreen *previous_screen;
|
GdkScreen *previous_screen;
|
||||||
gboolean was_mapped;
|
gboolean was_mapped;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_WINDOW (window));
|
g_return_if_fail (GTK_IS_WINDOW (window));
|
||||||
g_return_if_fail (GDK_IS_SCREEN (screen));
|
g_return_if_fail (GDK_IS_SCREEN (screen));
|
||||||
|
|
||||||
@ -7979,17 +7980,18 @@ gtk_window_set_screen (GtkWindow *window,
|
|||||||
gtk_widget_unmap (widget);
|
gtk_widget_unmap (widget);
|
||||||
if (gtk_widget_get_realized (widget))
|
if (gtk_widget_get_realized (widget))
|
||||||
gtk_widget_unrealize (widget);
|
gtk_widget_unrealize (widget);
|
||||||
|
|
||||||
gtk_window_free_key_hash (window);
|
gtk_window_free_key_hash (window);
|
||||||
priv->screen = screen;
|
priv->screen = screen;
|
||||||
gtk_widget_reset_rc_styles (widget);
|
gtk_widget_reset_rc_styles (widget);
|
||||||
if (screen != previous_screen)
|
if (screen != previous_screen)
|
||||||
{
|
{
|
||||||
g_signal_handlers_disconnect_by_func (previous_screen,
|
if (previous_screen)
|
||||||
gtk_window_on_composited_changed, window);
|
g_signal_handlers_disconnect_by_func (previous_screen,
|
||||||
g_signal_connect (screen, "composited-changed",
|
gtk_window_on_composited_changed, window);
|
||||||
G_CALLBACK (gtk_window_on_composited_changed), window);
|
g_signal_connect (screen, "composited-changed",
|
||||||
|
G_CALLBACK (gtk_window_on_composited_changed), window);
|
||||||
|
|
||||||
_gtk_widget_propagate_screen_changed (widget, previous_screen);
|
_gtk_widget_propagate_screen_changed (widget, previous_screen);
|
||||||
_gtk_widget_propagate_composited_changed (widget);
|
_gtk_widget_propagate_composited_changed (widget);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user