From 49a9e74900c71ff31cdced32990b3543045e9454 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Tue, 24 Sep 2002 21:33:34 +0000 Subject: [PATCH] new function, only saves rect after checking current state, #93795 2002-09-24 Havoc Pennington * src/window.c (meta_window_save_rect): new function, only saves rect after checking current state, #93795 (meta_window_make_fullscreen): use new function (meta_window_maximize): use new function --- ChangeLog | 7 +++++++ src/window.c | 39 ++++++++++++++++++++++----------------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index e82093fe7..bf726abb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-09-24 Havoc Pennington + + * src/window.c (meta_window_save_rect): new function, + only saves rect after checking current state, #93795 + (meta_window_make_fullscreen): use new function + (meta_window_maximize): use new function + 2002-09-24 Havoc Pennington * src/window.c (meta_window_update_layer): new function diff --git a/src/window.c b/src/window.c index 2602d94d5..d39246f8c 100644 --- a/src/window.c +++ b/src/window.c @@ -104,6 +104,8 @@ static GList* meta_window_get_workspaces (MetaWindow *window); static gboolean meta_window_get_icon_geometry (MetaWindow *window, MetaRectangle *rect); +static void meta_window_save_rect (MetaWindow *window); + static void adjust_for_gravity (MetaWindow *window, MetaFrameGeometry *fgeom, gboolean coords_assume_border, @@ -1625,6 +1627,21 @@ meta_window_unminimize (MetaWindow *window) } } +static void +meta_window_save_rect (MetaWindow *window) +{ + if (!(window->maximized || window->fullscreen)) + { + /* save size/pos as appropriate args for move_resize */ + window->saved_rect = window->rect; + if (window->frame) + { + window->saved_rect.x += window->frame->rect.x; + window->saved_rect.y += window->frame->rect.y; + } + } +} + void meta_window_maximize (MetaWindow *window) { @@ -1635,19 +1652,13 @@ meta_window_maximize (MetaWindow *window) if (window->shaded) meta_window_unshade (window); + + meta_window_save_rect (window); window->maximized = TRUE; /* FIXME why did I put this here? */ - meta_window_raise (window); - - /* save size/pos as appropriate args for move_resize */ - window->saved_rect = window->rect; - if (window->frame) - { - window->saved_rect.x += window->frame->rect.x; - window->saved_rect.y += window->frame->rect.y; - } + meta_window_raise (window); /* move_resize with new maximization constraints */ @@ -1689,6 +1700,8 @@ meta_window_make_fullscreen (MetaWindow *window) if (window->shaded) meta_window_unshade (window); + + meta_window_save_rect (window); window->fullscreen = TRUE; @@ -1698,14 +1711,6 @@ meta_window_make_fullscreen (MetaWindow *window) meta_window_raise (window); meta_stack_thaw (window->screen->stack); - /* save size/pos as appropriate args for move_resize */ - window->saved_rect = window->rect; - if (window->frame) - { - window->saved_rect.x += window->frame->rect.x; - window->saved_rect.y += window->frame->rect.y; - } - /* move_resize with new constraints */ meta_window_queue_move_resize (window);