[Spice-devel] [PATCH spice 3/4] spicec-x11: Let the window manager place our window the 1st time (rhbz#662407)

Hans de Goede hdegoede at redhat.com
Wed Dec 15 07:50:08 PST 2010


---
 client/x11/red_window.cpp |    8 +++++++-
 client/x11/red_window_p.h |    1 +
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/client/x11/red_window.cpp b/client/x11/red_window.cpp
index 6e8cd58..0816bf3 100644
--- a/client/x11/red_window.cpp
+++ b/client/x11/red_window.cpp
@@ -1123,6 +1123,7 @@ Cursor RedWindow_p::create_invisible_cursor(Window window)
 
 RedWindow_p::RedWindow_p()
     : _win (None)
+    , _show_pos_valid (false)
 #ifdef USE_OGL
     , _glcont_copy (NULL)
 #endif // USE_OGL
@@ -1556,7 +1557,9 @@ void RedWindow::show(int screen_id)
     move_to_current_desktop();
     _expect_parent = wait_parent;
     wait_for_map();
-    move(_show_pos.x, _show_pos.y);
+    if (_show_pos_valid) {
+        move(_show_pos.x, _show_pos.y);
+    }
 }
 
 static bool get_prop_32(Window win, Atom prop, uint32_t &val)
@@ -1635,6 +1638,7 @@ void RedWindow::hide()
     on_focus_out();
     XUnmapWindow(x_display, _win);
     _show_pos = get_position();
+    _show_pos_valid = true;
     wait_for_unmap();
     ASSERT(!_focused);
     ASSERT(!_pointer_in_window);
@@ -1663,6 +1667,7 @@ void RedWindow::move_and_resize(int x, int y, int width, int height)
     XMoveResizeWindow(x_display, _win, x, y, width, height);
     _show_pos.x = x;
     _show_pos.y = y;
+    _show_pos_valid = true;
     if (_visibale) {
         send_expose(_win, width, height);
     }
@@ -1673,6 +1678,7 @@ void RedWindow::move(int x, int y)
     XMoveWindow(x_display, _win, x, y);
     _show_pos.x = x;
     _show_pos.y = y;
+    _show_pos_valid = true;
 }
 
 void RedWindow::resize(int width, int height)
diff --git a/client/x11/red_window_p.h b/client/x11/red_window_p.h
index 777a855..6f05a90 100644
--- a/client/x11/red_window_p.h
+++ b/client/x11/red_window_p.h
@@ -66,6 +66,7 @@ protected:
     bool _visibale;
     bool _expect_parent;
     SpicePoint _show_pos;
+    bool _show_pos_valid;
 #ifdef USE_OGL
     GLXContext _glcont_copy;
 #endif // USE_OGL
-- 
1.7.3.2



More information about the Spice-devel mailing list