summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2010-12-15 15:25:07 +0100
committerHans de Goede <hdegoede@redhat.com>2010-12-16 16:23:56 +0100
commit85ebe4fc4dae442d7140747c22a053d8fedbf012 (patch)
treeab50250eb70bccdd71d487a61248f9c372386bd3
parent546a21b7f3c9e750b8a5839d0527edfba164fa07 (diff)
spicec-x11: Let the window manager place our window the 1st time (rhbz#662407)
The problem is that RedWindow::show calls the XLib MoveWindow function on the window after it has been mapped, moving it to the location in _show_pos. This is seen by the window manager as the application saying I know exactly where I want my window to be placed, don't do placing for me. Which causes the client window to always be shown at pos 0x0, even though that may not be the best location. What this patch does is: 1) It makes RedWindow::show not call MoveWindow when a window is first created normally and then shown 2) It makes RedWindow::show still call MoveWindow when: -when the window has been shown before, and was hidden for some reason (controller interface), and is now being re-shown so that it ends up being re-shown at its old position -when the window is a fullscreen window (screen.cpp always calls move on the window before showing it to set its position) -when the user switch from windowed mode -> fullscreen -> windowed mode again, to make sure that the windowed mode window is shown in the same position as before switching to fullscreen mode
-rw-r--r--client/x11/red_window.cpp8
-rw-r--r--client/x11/red_window_p.h1
2 files changed, 8 insertions, 1 deletions
diff --git a/client/x11/red_window.cpp b/client/x11/red_window.cpp
index 569cf4e8..d7b19f9e 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
@@ -1565,7 +1566,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)
@@ -1644,6 +1647,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);
@@ -1672,6 +1676,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);
}
@@ -1682,6 +1687,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 777a8551..6f05a905 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