From 4694ded7cdc49be976e4e2e9e61b5656bc0f09f0 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Tue, 24 Sep 2002 21:22:06 +0000 Subject: [PATCH] new function 2002-09-24 Havoc Pennington * src/window.c (meta_window_update_layer): new function * src/stack.c (compute_layer): put focused window in a layer above all other windows, in click-to-focus mode. #93022 * src/window.c (meta_window_notify_focus): update window layer on focus change. --- ChangeLog | 11 +++++++++++ src/stack.c | 11 ++++++++--- src/stack.h | 17 +++++++++-------- src/window.c | 44 +++++++++++++++++++++++++------------------- src/window.h | 2 ++ 5 files changed, 55 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1511c0e39..e82093fe7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2002-09-24 Havoc Pennington + + * src/window.c (meta_window_update_layer): new function + + * src/stack.c (compute_layer): put focused window in a layer above + all other windows, in click-to-focus mode. #93022 + + * src/window.c (meta_window_notify_focus): update window layer on + focus change. + 2002-09-24 Havoc Pennington * src/main.c (main): support --version, #92796 patch from @@ -12,6 +22,7 @@ nearly-identical themes for ease of translation, #70962 2002-09-24 Arvind Samptur + * src/menu.c: Replace strings Shade with Roll Up and Unshade with Unroll. diff --git a/src/stack.c b/src/stack.c index 709dcfa2d..ffa8e2791 100644 --- a/src/stack.c +++ b/src/stack.c @@ -24,6 +24,7 @@ #include "errors.h" #include "frame.h" #include "group.h" +#include "prefs.h" #include "workspace.h" #include @@ -310,15 +311,19 @@ compute_layer (MetaWindow *window) break; default: - if (group_member_is_fullscreen (window)) + if (window->has_focus && + meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK) + window->layer = META_LAYER_FOCUSED_WINDOW; + else if (group_member_is_fullscreen (window)) window->layer = META_LAYER_FULLSCREEN; else window->layer = META_LAYER_NORMAL; break; } - meta_topic (META_DEBUG_STACK, "Window %s on layer %d\n", - window->desc, window->layer); + meta_topic (META_DEBUG_STACK, "Window %s on layer %d type = %d has_focus = %d\n", + window->desc, window->layer, + window->type, window->has_focus); } static GList* diff --git a/src/stack.h b/src/stack.h index 6d0c79ba9..88c431477 100644 --- a/src/stack.h +++ b/src/stack.h @@ -32,14 +32,15 @@ typedef struct _MetaStackOp MetaStackOp; /* These MUST be in the order of stacking */ typedef enum { - META_LAYER_DESKTOP = 0, - META_LAYER_BOTTOM = 1, - META_LAYER_NORMAL = 2, - META_LAYER_TOP = 3, - META_LAYER_DOCK = 4, - META_LAYER_FULLSCREEN = 5, - META_LAYER_SPLASH = 6, - META_LAYER_LAST = 7 + META_LAYER_DESKTOP = 0, + META_LAYER_BOTTOM = 1, + META_LAYER_NORMAL = 2, + META_LAYER_TOP = 3, + META_LAYER_DOCK = 4, + META_LAYER_FULLSCREEN = 5, + META_LAYER_SPLASH = 6, + META_LAYER_FOCUSED_WINDOW = 7, + META_LAYER_LAST = 8 } MetaStackLayer; struct _MetaStack diff --git a/src/window.c b/src/window.c index 7ad9786da..2602d94d5 100644 --- a/src/window.c +++ b/src/window.c @@ -1684,8 +1684,6 @@ meta_window_make_fullscreen (MetaWindow *window) { if (!window->fullscreen) { - MetaGroup *group; - meta_topic (META_DEBUG_WINDOW_OPS, "Fullscreening %s\n", window->desc); @@ -1695,11 +1693,7 @@ meta_window_make_fullscreen (MetaWindow *window) window->fullscreen = TRUE; meta_stack_freeze (window->screen->stack); - group = meta_window_get_group (window); - if (group) - meta_group_update_layers (group); - else - meta_stack_update_layer (window->screen->stack, window); + meta_window_update_layer (window); meta_window_raise (window); meta_stack_thaw (window->screen->stack); @@ -1725,20 +1719,12 @@ meta_window_unmake_fullscreen (MetaWindow *window) { if (window->fullscreen) { - MetaGroup *group; - meta_topic (META_DEBUG_WINDOW_OPS, "Unfullscreening %s\n", window->desc); window->fullscreen = FALSE; - meta_stack_freeze (window->screen->stack); - group = meta_window_get_group (window); - if (group) - meta_group_update_layers (group); - else - meta_stack_update_layer (window->screen->stack, window); - meta_stack_thaw (window->screen->stack); + meta_window_update_layer (window); meta_window_move_resize (window, TRUE, @@ -3732,6 +3718,9 @@ meta_window_notify_focus (MetaWindow *window, XInstallColormap (window->display->xdisplay, window->colormap); meta_error_trap_pop (window->display); + + /* move into FOCUSED_WINDOW layer */ + meta_window_update_layer (window); } } else if (event->type == FocusOut || @@ -3765,6 +3754,9 @@ meta_window_notify_focus (MetaWindow *window, XUninstallColormap (window->display->xdisplay, window->colormap); meta_error_trap_pop (window->display); + + /* move out of FOCUSED_WINDOW layer */ + meta_window_update_layer (window); } } @@ -5234,7 +5226,7 @@ recalc_window_type (MetaWindow *window) meta_window_destroy_frame (window); /* update stacking constraints */ - meta_stack_update_layer (window->screen->stack, window); + meta_window_update_layer (window); } } @@ -6606,8 +6598,9 @@ meta_window_begin_grab_op (MetaWindow *window, y + y_offset); } -void meta_window_update_resize_grab_op (MetaWindow *window, - gboolean update_cursor) +void +meta_window_update_resize_grab_op (MetaWindow *window, + gboolean update_cursor) { int x, y, x_offset, y_offset; @@ -6634,3 +6627,16 @@ void meta_window_update_resize_grab_op (MetaWindow *window, } } +void +meta_window_update_layer (MetaWindow *window) +{ + MetaGroup *group; + + meta_stack_freeze (window->screen->stack); + group = meta_window_get_group (window); + if (group) + meta_group_update_layers (group); + else + meta_stack_update_layer (window->screen->stack, window); + meta_stack_thaw (window->screen->stack); +} diff --git a/src/window.h b/src/window.h index 847204c67..dc48bfe4c 100644 --- a/src/window.h +++ b/src/window.h @@ -421,4 +421,6 @@ void meta_window_begin_grab_op (MetaWindow *window, void meta_window_update_resize_grab_op (MetaWindow *window, gboolean update_cursor); +void meta_window_update_layer (MetaWindow *window); + #endif