From d080f816b6f693871ab69ad2f5f50cba25135bc9 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Thu, 25 Oct 2001 04:51:25 +0000 Subject: [PATCH] I was using meta_workspace_contains_window() in a number of places where 2001-10-25 Havoc Pennington * src/window.c (meta_window_visible_on_workspace): I was using meta_workspace_contains_window() in a number of places where on_all_workspaces should also have been considered, thus this new function. Fixes bugs such as pinned windows not appearing in the tab order. (meta_window_client_message): use meta_window_visible_on_workspace * src/stack.c (find_tab_forward): ditto (find_tab_backward): ditto (meta_stack_get_tab_next): ditto (meta_stack_get_tab_list): ditto * src/place.c (get_windows_on_same_workspace): ditto * src/keybindings.c (handle_focus_previous): ditto (handle_focus_previous): ditto --- ChangeLog | 19 +++++++++++++++++++ src/keybindings.c | 8 ++++---- src/place.c | 4 ++-- src/stack.c | 12 ++++++------ src/window.c | 21 +++++++++++++-------- src/window.h | 3 +++ src/workspace.h | 1 + 7 files changed, 48 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc580d6d2..8f53a448f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2001-10-25 Havoc Pennington + + * src/window.c (meta_window_visible_on_workspace): + I was using meta_workspace_contains_window() in a number of + places where on_all_workspaces should also have been considered, + thus this new function. Fixes bugs such as pinned windows + not appearing in the tab order. + (meta_window_client_message): use meta_window_visible_on_workspace + + * src/stack.c (find_tab_forward): ditto + (find_tab_backward): ditto + (meta_stack_get_tab_next): ditto + (meta_stack_get_tab_list): ditto + + * src/place.c (get_windows_on_same_workspace): ditto + + * src/keybindings.c (handle_focus_previous): ditto + (handle_focus_previous): ditto + 2001-10-24 Havoc Pennington * src/frames.c (meta_frames_expose_event): use bg/fg not base/text diff --git a/src/keybindings.c b/src/keybindings.c index 6417ed8db..5e4e15a42 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -1046,8 +1046,8 @@ handle_focus_previous (MetaDisplay *display, window = display->prev_focus_window; if (window && - !meta_workspace_contains_window (screen->active_workspace, - window)) + !meta_window_visible_on_workspace (window, + screen->active_workspace)) window = NULL; if (window == NULL) @@ -1060,8 +1060,8 @@ handle_focus_previous (MetaDisplay *display, } if (window && - !meta_workspace_contains_window (screen->active_workspace, - window)) + !meta_window_visible_on_workspace (window, + screen->active_workspace)) window = NULL; if (window) diff --git a/src/place.c b/src/place.c index 1c5232339..23026c827 100644 --- a/src/place.c +++ b/src/place.c @@ -350,8 +350,8 @@ get_windows_on_same_workspace (MetaWindow *window, if (!w->minimized && w != window && - meta_workspace_contains_window (window->screen->active_workspace, - w)) + meta_window_visible_on_workspace (w, + window->screen->active_workspace)) { windows = g_slist_prepend (windows, w); ++i; diff --git a/src/stack.c b/src/stack.c index 6905e5c83..f586577f6 100644 --- a/src/stack.c +++ b/src/stack.c @@ -894,7 +894,7 @@ find_tab_forward (MetaStack *stack, if (window && IN_TAB_CHAIN (window) && (workspace == NULL || - meta_workspace_contains_window (workspace, window))) + meta_window_visible_on_workspace (window, workspace))) return window; ++i; @@ -910,7 +910,7 @@ find_tab_forward (MetaStack *stack, if (window && IN_TAB_CHAIN (window) && (workspace == NULL || - meta_workspace_contains_window (workspace, window))) + meta_window_visible_on_workspace (window, workspace))) return window; ++i; @@ -939,7 +939,7 @@ find_tab_backward (MetaStack *stack, if (window && IN_TAB_CHAIN (window) && (workspace == NULL || - meta_workspace_contains_window (workspace, window))) + meta_window_visible_on_workspace (window, workspace))) return window; --i; @@ -955,7 +955,7 @@ find_tab_backward (MetaStack *stack, if (window && IN_TAB_CHAIN (window) && (workspace == NULL || - meta_workspace_contains_window (workspace, window))) + meta_window_visible_on_workspace (window, workspace))) return window; --i; @@ -980,7 +980,7 @@ meta_stack_get_tab_next (MetaStack *stack, * you get a key shortcut or something on a window just as you * are moving workspaces to one the window isn't on */ - if (!meta_workspace_contains_window (workspace, window)) + if (!meta_window_visible_on_workspace (window, workspace)) return NULL; } @@ -1037,7 +1037,7 @@ meta_stack_get_tab_list (MetaStack *stack, if (window && IN_TAB_CHAIN (window) && (workspace == NULL || - meta_workspace_contains_window (workspace, window))) + meta_window_visible_on_workspace (window, workspace))) list = g_slist_prepend (list, window); ++i; diff --git a/src/window.c b/src/window.c index 0005dbb47..f89f61f5f 100644 --- a/src/window.c +++ b/src/window.c @@ -798,6 +798,14 @@ set_net_wm_state (MetaWindow *window) return meta_error_trap_pop (window->display); } +gboolean +meta_window_visible_on_workspace (MetaWindow *window, + MetaWorkspace *workspace) +{ + return window->on_all_workspaces || + meta_workspace_contains_window (workspace, window); +} + void meta_window_calc_showing (MetaWindow *window) { @@ -805,8 +813,8 @@ meta_window_calc_showing (MetaWindow *window) meta_verbose ("Calc showing for window %s\n", window->desc); - on_workspace = g_list_find (window->workspaces, - window->screen->active_workspace) != NULL; + on_workspace = meta_window_visible_on_workspace (window, + window->screen->active_workspace); if (!on_workspace) meta_verbose ("Window %s is not on workspace %d\n", @@ -818,10 +826,7 @@ meta_window_calc_showing (MetaWindow *window) meta_workspace_index (window->screen->active_workspace)); if (window->on_all_workspaces) - { - on_workspace = TRUE; - meta_verbose ("Window %s is on all workspaces\n", window->desc); - } + meta_verbose ("Window %s is on all workspaces\n", window->desc); if (on_workspace && window->display->showing_desktop && @@ -2479,8 +2484,8 @@ meta_window_client_message (MetaWindow *window, meta_verbose ("_NET_ACTIVE_WINDOW request for window '%s'", window->desc); /* Get window on current workspace */ - if (!meta_workspace_contains_window (window->screen->active_workspace, - window)) + if (!meta_window_visible_on_workspace (window, + window->screen->active_workspace)) meta_window_change_workspace (window, window->screen->active_workspace); diff --git a/src/window.h b/src/window.h index 91c4ad043..f3118d8dd 100644 --- a/src/window.h +++ b/src/window.h @@ -335,4 +335,7 @@ void meta_window_set_gravity (MetaWindow *window, void meta_window_handle_mouse_grab_op_event (MetaWindow *window, XEvent *event); +gboolean meta_window_visible_on_workspace (MetaWindow *window, + MetaWorkspace *workspace); + #endif diff --git a/src/workspace.h b/src/workspace.h index e949dd1fb..6620eeeda 100644 --- a/src/workspace.h +++ b/src/workspace.h @@ -39,6 +39,7 @@ void meta_workspace_add_window (MetaWorkspace *workspace, MetaWindow *window); void meta_workspace_remove_window (MetaWorkspace *workspace, MetaWindow *window); +/* don't confuse with meta_window_visible_on_workspace() */ gboolean meta_workspace_contains_window (MetaWorkspace *workspace, MetaWindow *window); void meta_workspace_activate (MetaWorkspace *workspace);