[gtk+] Fix a problem with screen changes and csd
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Fix a problem with screen changes and csd
- Date: Fri, 24 Oct 2014 19:57:44 +0000 (UTC)
commit fea13fcfc1a7d9e286d5bb12bdbb8b5acd774001
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Oct 24 13:30:19 2014 -0400
Fix a problem with screen changes and csd
When a new screen is set on a window, we unrealize it, to
recreate all the resources. But we don't reset the client_decorated
flag, so realize() doesn't call create_decoration() - which makes
sense, since the decoration already exists. But the side-effect
of create_decoration() is to select the rgba visual, and visuals
are per-screen.
Fix this by looking for the rgba visual in set_screen(), and
replacing it with the rgba visual for the new screen, if necessary.
gtk/gtkwindow.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 2328591..11a2220 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -10291,6 +10291,7 @@ gtk_window_set_screen (GtkWindow *window,
GtkWindowPrivate *priv;
GtkWidget *widget;
GdkScreen *previous_screen;
+ gboolean was_rgba;
gboolean was_mapped;
g_return_if_fail (GTK_IS_WINDOW (window));
@@ -10304,6 +10305,12 @@ gtk_window_set_screen (GtkWindow *window,
widget = GTK_WIDGET (window);
previous_screen = priv->screen;
+
+ if (gdk_screen_get_rgba_visual (previous_screen) == gtk_widget_get_visual (widget))
+ was_rgba = TRUE;
+ else
+ was_rgba = FALSE;
+
was_mapped = gtk_widget_get_mapped (widget);
if (was_mapped)
@@ -10337,6 +10344,15 @@ gtk_window_set_screen (GtkWindow *window,
}
g_object_notify (G_OBJECT (window), "screen");
+ if (was_rgba)
+ {
+ GdkVisual *visual;
+
+ visual = gdk_screen_get_rgba_visual (screen);
+ if (visual)
+ gtk_widget_set_visual (widget, visual);
+ }
+
if (was_mapped)
gtk_widget_map (widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]