[Spice-devel] [PATCH spice 3/4] spicec-x11: Let the window manager place our window the 1st time (rhbz#662407)
Alon Levy
alevy at redhat.com
Wed Dec 15 10:36:45 PST 2010
On Wed, Dec 15, 2010 at 04:50:08PM +0100, Hans de Goede wrote:
I'm not certain I understand what is happening here:
is show being called twice? and the _show_pos_valid flag makes sure
the second time it works, assuming the second call happens after
one of the calls that set _show_pos_valid to true, i.e.:
action | value of _show_pos_valid
construct | false
RedWindow_p::show | false, move isn't called
one of RedWindow::{hide,move,move_and_resize} is called | true
RedWindow_p::show is called again | true -> move done
Could give a more helpful explanation of the fix in the comment maybe?
Alon
> ---
> 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
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
More information about the Spice-devel
mailing list