mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
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*
|
||||
_gtk_style_new_for_path (GdkScreen *screen,
|
||||
GtkWidgetPath *path)
|
||||
GtkWidgetPath *path)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkStyle *style;
|
||||
|
||||
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);
|
||||
|
||||
style = g_object_new (GTK_TYPE_STYLE,
|
||||
@ -848,8 +850,7 @@ gtk_style_new (void)
|
||||
path = gtk_widget_path_new ();
|
||||
gtk_widget_path_append_type (path, GTK_TYPE_WIDGET);
|
||||
|
||||
style = _gtk_style_new_for_path (gdk_screen_get_default (),
|
||||
path);
|
||||
style = _gtk_style_new_for_path (gdk_screen_get_default (), path);
|
||||
|
||||
gtk_widget_path_free (path);
|
||||
|
||||
|
@ -2617,7 +2617,7 @@ gtk_style_context_set_screen (GtkStyleContext *context,
|
||||
GtkStyleContextPrivate *priv;
|
||||
|
||||
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;
|
||||
if (priv->screen == screen)
|
||||
|
@ -14179,7 +14179,7 @@ gtk_widget_get_style_context (GtkWidget *widget)
|
||||
G_CALLBACK (style_context_changed), widget);
|
||||
|
||||
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_style_context_set_path (widget->priv->context,
|
||||
|
@ -1108,8 +1108,9 @@ gtk_window_init (GtkWindow *window)
|
||||
priv->has_user_ref_count = TRUE;
|
||||
toplevel_list = g_slist_prepend (toplevel_list, window);
|
||||
|
||||
g_signal_connect (priv->screen, "composited-changed",
|
||||
G_CALLBACK (gtk_window_on_composited_changed), window);
|
||||
if (priv->screen)
|
||||
g_signal_connect (priv->screen, "composited-changed",
|
||||
G_CALLBACK (gtk_window_on_composited_changed), window);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -7961,7 +7962,7 @@ gtk_window_set_screen (GtkWindow *window,
|
||||
GtkWidget *widget;
|
||||
GdkScreen *previous_screen;
|
||||
gboolean was_mapped;
|
||||
|
||||
|
||||
g_return_if_fail (GTK_IS_WINDOW (window));
|
||||
g_return_if_fail (GDK_IS_SCREEN (screen));
|
||||
|
||||
@ -7979,17 +7980,18 @@ gtk_window_set_screen (GtkWindow *window,
|
||||
gtk_widget_unmap (widget);
|
||||
if (gtk_widget_get_realized (widget))
|
||||
gtk_widget_unrealize (widget);
|
||||
|
||||
|
||||
gtk_window_free_key_hash (window);
|
||||
priv->screen = screen;
|
||||
gtk_widget_reset_rc_styles (widget);
|
||||
if (screen != previous_screen)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (previous_screen,
|
||||
gtk_window_on_composited_changed, window);
|
||||
g_signal_connect (screen, "composited-changed",
|
||||
G_CALLBACK (gtk_window_on_composited_changed), window);
|
||||
|
||||
if (previous_screen)
|
||||
g_signal_handlers_disconnect_by_func (previous_screen,
|
||||
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_composited_changed (widget);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user