Ensure the user_rect is set sanely for windows that start maximized.

2008-08-16  Ted Percival  <ted@midg3t.net>

        Ensure the user_rect is set sanely for windows that start maximized.
        Prevents maximized windows from warping across the screen.
        Fixes bug #504692.

        * src/core/window.c (save_user_placement): renamed version of
        meta_window_save_user_rect().
        * src/core/window.c (force_save_user_placement): similar, but will
        always save user_rect even if the window is maximised or fullscreen.
        * src/core/window.c (meta_window_move_resize_internal): unplaced
        windows have force_save_user_placement() called instead of
        save_user_placement().


svn path=/trunk/; revision=3816
This commit is contained in:
Ted Percival 2008-08-16 03:09:40 +00:00 committed by Thomas James Alexander Thurman
parent 6e4c88ad93
commit 4fb40b57a9
2 changed files with 42 additions and 12 deletions

View File

@ -1,3 +1,17 @@
2008-08-16 Ted Percival <ted@midg3t.net>
Ensure the user_rect is set sanely for windows that start maximized.
Prevents maximized windows from warping across the screen.
Fixes bug #504692.
* src/core/window.c (save_user_placement): renamed version of
meta_window_save_user_rect().
* src/core/window.c (force_save_user_placement): similar, but will
always save user_rect even if the window is maximised or fullscreen.
* src/core/window.c (meta_window_move_resize_internal): unplaced
windows have force_save_user_placement() called instead of
save_user_placement().
2008-08-14 Patrick Niklaus <marex@compiz-fusion.org> 2008-08-14 Patrick Niklaus <marex@compiz-fusion.org>
Icons for windows are taken from the desktop theme, not from Icons for windows are taken from the desktop theme, not from

View File

@ -75,7 +75,8 @@ static void meta_window_show (MetaWindow *window);
static void meta_window_hide (MetaWindow *window); static void meta_window_hide (MetaWindow *window);
static void meta_window_save_rect (MetaWindow *window); static void meta_window_save_rect (MetaWindow *window);
static void meta_window_save_user_rect (MetaWindow *window); static void save_user_window_placement (MetaWindow *window);
static void force_save_user_window_placement (MetaWindow *window);
static void meta_window_move_resize_internal (MetaWindow *window, static void meta_window_move_resize_internal (MetaWindow *window,
MetaMoveResizeFlags flags, MetaMoveResizeFlags flags,
@ -2450,11 +2451,28 @@ meta_window_save_rect (MetaWindow *window)
} }
} }
/**
* Save the user_rect regardless of whether the window is maximized or
* fullscreen. See save_user_window_placement() for most uses.
*
* \param window Store current position of this window for future reference
*/
static void static void
meta_window_save_user_rect (MetaWindow *window) force_save_user_window_placement (MetaWindow *window)
{
meta_window_get_client_root_coords (window, &window->user_rect);
}
/**
* Save the user_rect, but only if the window is neither maximized nor
* fullscreen, otherwise the window may snap back to those dimensions
* (bug #461927).
*
* \param window Store current position of this window for future reference
*/
static void
save_user_window_placement (MetaWindow *window)
{ {
/* We do not save maximized or fullscreen dimensions, otherwise the
* window may snap back to those dimensions (Bug #461927). */
if (!(META_WINDOW_MAXIMIZED (window) || window->fullscreen)) if (!(META_WINDOW_MAXIMIZED (window) || window->fullscreen))
{ {
MetaRectangle user_rect; MetaRectangle user_rect;
@ -3520,13 +3538,11 @@ meta_window_move_resize_internal (MetaWindow *window,
if (need_configure_notify) if (need_configure_notify)
send_configure_notify (window); send_configure_notify (window);
/* user_rect is the position to restore towards if strut changes occur. Thus if (!window->placed)
* we want user_rect to reflect user position/size changes OR the initial force_save_user_window_placement (window);
* placement of the window. else if (is_user_action)
*/ save_user_window_placement (window);
if (is_user_action || !window->placed)
meta_window_save_user_rect(window);
if (need_move_frame || need_resize_frame || if (need_move_frame || need_resize_frame ||
need_move_client || need_resize_client) need_move_client || need_resize_client)
{ {
@ -4568,7 +4584,7 @@ meta_window_move_resize_request (MetaWindow *window,
* *
* See also bug 426519. * See also bug 426519.
*/ */
meta_window_save_user_rect(window); save_user_window_placement (window);
} }
gboolean gboolean