[gnome-terminal] Save position of window when unrealizing/realizing



commit e4af458835b789a76f4c9bfb85a9e2e94e01ac9e
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Wed Jun 17 17:29:06 2009 -0400

    Save position of window when unrealizing/realizing
    
    When we unrealize and realize the terminal window, save the position.
    
    http://bugzilla.gnome.org/show_bug.cgi?id=564648

 src/terminal-window.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 9c9f8e1..470189b 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -1482,12 +1482,23 @@ terminal_window_composited_changed_cb (GdkScreen *screen,
     {
       GtkWidget *widget = GTK_WIDGET (window);
       guint32 user_time;
+      int x, y;
 
       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);
       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);
       gdk_x11_window_set_user_time (widget->window, user_time);
       gtk_widget_show (widget);



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