diff options
author | rcaridade145 <[email protected]> | 2020-03-03 20:05:27 +0000 |
---|---|---|
committer | Victor Kareh <[email protected]> | 2020-05-27 11:25:49 -0400 |
commit | 8966925b5f7f014e7a809f743ab1725238583790 (patch) | |
tree | e305a86b30959efa38d609dbab4d35c2d1d6a051 /src | |
parent | c0549f97732dd57080c15bdd2b64c4162b1a856a (diff) | |
download | marco-8966925b5f7f014e7a809f743ab1725238583790.tar.bz2 marco-8966925b5f7f014e7a809f743ab1725238583790.tar.xz |
stack: make meta_window_raise() and meta_window_lower() smarter
https://bugzilla.gnome.org/show_bug.cgi?id=620744
Based on commit https://gitlab.gnome.org/GNOME/metacity/-/commit/9245f9588bd7c17ccbe04df65c1579313cbad07b
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stack.c | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/src/core/stack.c b/src/core/stack.c index 23a257b8..fa4dbee3 100644 --- a/src/core/stack.c +++ b/src/core/stack.c @@ -181,8 +181,25 @@ void meta_stack_raise (MetaStack *stack, MetaWindow *window) { - meta_window_set_stack_position_no_sync (window, - stack->n_positions - 1); + GList *l; + int max_stack_position = window->stack_position; + MetaWorkspace *workspace; + + g_assert (stack->added == NULL); + + workspace = meta_window_get_workspace (window); + for (l = stack->sorted; l; l = l->next) + { + MetaWindow *w = (MetaWindow *) l->data; + if (meta_window_located_on_workspace (w, workspace) && + w->stack_position > max_stack_position) + max_stack_position = w->stack_position; + } + + if (max_stack_position == window->stack_position) + return; + + meta_window_set_stack_position_no_sync (window, max_stack_position); stack_sync_to_server (stack); } @@ -191,7 +208,25 @@ void meta_stack_lower (MetaStack *stack, MetaWindow *window) { - meta_window_set_stack_position_no_sync (window, 0); + GList *l; + int min_stack_position = window->stack_position; + MetaWorkspace *workspace; + + g_assert (stack->added == NULL); + + workspace = meta_window_get_workspace (window); + for (l = stack->sorted; l; l = l->next) + { + MetaWindow *w = (MetaWindow *) l->data; + if (meta_window_located_on_workspace (w, workspace) && + w->stack_position < min_stack_position) + min_stack_position = w->stack_position; + } + + if (min_stack_position == window->stack_position) + return; + + meta_window_set_stack_position_no_sync (window, min_stack_position); stack_sync_to_server (stack); } @@ -202,6 +237,7 @@ meta_stack_freeze (MetaStack *stack) stack->freeze_count += 1; } + void meta_stack_thaw (MetaStack *stack) { |