[gnome-terminal] Remove annoying re-realize on composited-changed



commit f2d5dc3d93b4404b2fdbbb67bb56379b8440c711
Author: Christian Persch <chpe gnome org>
Date:   Sun Jul 31 19:09:38 2011 +0200

    Remove annoying re-realize on composited-changed
    
    Since we don't support transparency anymore anyway, there's no need
    to keep changing the visual.
    
    Bug #649263.

 src/terminal-window.c |  112 +------------------------------------------------
 1 files changed, 1 insertions(+), 111 deletions(-)
---
diff --git a/src/terminal-window.c b/src/terminal-window.c
index faac3c4..c29004b 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -1475,27 +1475,9 @@ terminal_window_realize (GtkWidget *widget)
 {
   TerminalWindow *window = TERMINAL_WINDOW (widget);
   TerminalWindowPrivate *priv = window->priv;
-#ifdef GDK_WINDOWING_X11
-  GdkScreen *screen;
   GtkAllocation widget_allocation;
-  GdkVisual *visual;
 
   gtk_widget_get_allocation (widget, &widget_allocation);
-  screen = gtk_widget_get_screen (GTK_WIDGET (window));
-  if (gdk_screen_is_composited (screen) &&
-      (visual = gdk_screen_get_rgba_visual (screen)) != NULL)
-    {
-      /* Set RGBA visual if possible so VTE can use real transparency */
-      gtk_widget_set_visual (GTK_WIDGET (widget), visual);
-      priv->have_argb_visual = TRUE;
-    }
-  else
-    {
-      gtk_widget_set_visual (GTK_WIDGET (window), gdk_screen_get_system_visual (screen));
-      priv->have_argb_visual = FALSE;
-    }
-#endif
-
   _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
                          "[window %p] realize, size %d : %d at (%d, %d)\n",
                          widget,
@@ -1585,84 +1567,6 @@ terminal_window_window_manager_changed_cb (GdkScreen *screen,
   gtk_action_set_sensitive (action, supports_fs);
 }
 
-#ifdef GDK_WINDOWING_X11
-
-static void
-terminal_window_composited_changed_cb (GdkScreen *screen,
-                                       TerminalWindow *window)
-{
-  TerminalWindowPrivate *priv = window->priv;
-  gboolean composited;
-
-  composited = gdk_screen_is_composited (screen);
-  if ((composited != priv->have_argb_visual) &&
-      gtk_widget_get_realized (GTK_WIDGET (window)))
-    {
-      GtkWidget *widget = GTK_WIDGET (window);
-      GdkWindow *widget_window;
-      guint32 user_time;
-      gboolean have_desktop;
-      guint32 desktop = 0; /* Quiet GCC */
-      gboolean was_minimized;
-      int x, y;
-
-      widget_window = gtk_widget_get_window (widget);
-
-      user_time = gdk_x11_display_get_user_time (gtk_widget_get_display (widget));
-
-      /* If compositing changed, re-realize the window. Bug #563561 */
-
-      /* Save the position; this isn't perfect, because the position
-       * that gtk_window_get_position() returns is the position of the
-       * frame window, and we are racing with the new window manager
-       * framing our window, so we might see a funky intermediate state.
-       * But at worst, we'll be off by a few pixels (the frame size). */
-      gtk_window_get_position (GTK_WINDOW (window), &x, &y);
-
-      /* GtkWindow tries to save whether the window was iconified
-       * and restore it, but that doesn't work because of problems
-       * GDK_WINDOW_STATE_ICONIFIED. For details, see comment for
-       * terminal_util_x11_window_is_minimized()
-       */
-      was_minimized = terminal_util_x11_window_is_minimized (widget_window);
-
-      /* And the desktop */
-      have_desktop = terminal_util_x11_get_net_wm_desktop (widget_window, &desktop);
-
-      gtk_widget_hide (widget);
-      gtk_widget_unrealize (widget);
-
-      /* put the window back where it was before */
-      gtk_window_move (GTK_WINDOW (window), x, y);
-      gtk_widget_realize (widget);
-
-      /* Get new GdkWindow */
-      widget_window = gtk_widget_get_window (widget);
-
-      gdk_x11_window_set_user_time (widget_window, user_time);
-
-      if (was_minimized)
-	gtk_window_iconify (GTK_WINDOW (window));
-      else
-	gtk_window_deiconify (GTK_WINDOW (window));
-
-      gtk_widget_show (widget);
-      if (have_desktop)
-        terminal_util_x11_set_net_wm_desktop (widget_window, desktop);
-
-      /* Mapping the window is likely to have set the "demands-attention" state.
-       * In particular, Metacity will always set the state if a window is mapped,
-       * is not given the focus (because of an old user time), and is covered
-       * by some other window. We have no way of preventing this, so we just
-       * wait for our window to be mapped, and then tell the window manager
-       * to turn off the bit. If it wasn't set, no harm.
-       */
-      priv->clear_demands_attention = TRUE;
-    }
-}
-
-#endif /* GDK_WINDOWING_X11 */
-
 static void
 terminal_window_screen_update (TerminalWindow *window,
                                GdkScreen *screen)
@@ -1673,10 +1577,6 @@ terminal_window_screen_update (TerminalWindow *window,
   terminal_window_window_manager_changed_cb (screen, window);
   g_signal_connect (screen, "window-manager-changed",
                     G_CALLBACK (terminal_window_window_manager_changed_cb), window);
-#ifdef GDK_WINDOWING_X11
-  g_signal_connect (screen, "composited-changed",
-                    G_CALLBACK (terminal_window_composited_changed_cb), window);
-#endif
 
   if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (screen), "GT::HasSettingsConnection")))
     return;
@@ -1720,11 +1620,6 @@ terminal_window_screen_changed (GtkWidget *widget,
       g_signal_handlers_disconnect_by_func (previous_screen,
                                             G_CALLBACK (terminal_window_window_manager_changed_cb),
                                             window);
-#ifdef GDK_WINDOWING_X11
-      g_signal_handlers_disconnect_by_func (previous_screen,
-                                            G_CALLBACK (terminal_window_composited_changed_cb),
-                                            window);
-#endif
     }
 
   if (!screen)
@@ -2155,16 +2050,11 @@ terminal_window_dispose (GObject *object)
       g_signal_handlers_disconnect_by_func (screen,
                                             G_CALLBACK (terminal_window_window_manager_changed_cb),
                                             window);
-#ifdef GDK_WINDOWING_X11
-      g_signal_handlers_disconnect_by_func (screen,
-                                            G_CALLBACK (terminal_window_composited_changed_cb),
-                                            window);
-#endif
     }
 
   G_OBJECT_CLASS (terminal_window_parent_class)->dispose (object);
 }
-   
+
 static void
 terminal_window_finalize (GObject *object)
 {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]