only move on MRU list if the window belongs on the workspace, since the

2004-02-27  Rob Adams  <readams@readams.net>

	* src/window.c (meta_window_notify_focus): only move on MRU list
	if the window belongs on the workspace, since the FocusIn event
	could be for a window whose workspace we've since switched away
	from.  Possible fix for #122016.

	* src/workspace.c (meta_workspace_contains_window): search for the
	workspace in window->workspaces rather than the window in
	workspace->windows.  Since the number of workspaces is at most 36,
	this is a O(1) lookup rather than a O(n) lookup.  Sorry; couldn't
	resist.
This commit is contained in:
Rob Adams 2004-02-28 02:53:56 +00:00 committed by Rob Adams
parent 036a61d198
commit 16a8add6f8
3 changed files with 32 additions and 13 deletions

View File

@ -1,3 +1,16 @@
2004-02-27 Rob Adams <readams@readams.net>
* src/window.c (meta_window_notify_focus): only move on MRU list
if the window belongs on the workspace, since the FocusIn event
could be for a window whose workspace we've since switched away
from. Possible fix for #122016.
* src/workspace.c (meta_workspace_contains_window): search for the
workspace in window->workspaces rather than the window in
workspace->windows. Since the number of workspaces is at most 36,
this is a O(1) lookup rather than a O(n) lookup. Sorry; couldn't
resist.
2004-02-27 Rob Adams <readams@readams.net> 2004-02-27 Rob Adams <readams@readams.net>
* src/metacity.schemas.in: Change * src/metacity.schemas.in: Change

View File

@ -4126,11 +4126,17 @@ meta_window_notify_focus (MetaWindow *window,
window->display->focus_window = window; window->display->focus_window = window;
window->has_focus = TRUE; window->has_focus = TRUE;
/* Move to the front of the focusing workspace's MRU list We /* Move to the front of the focusing workspace's MRU list.
* should only be "removing" it from the MRU list if it's * We should only be "removing" it from the MRU list if it's
* not already there. * not already there. Note that it's possible that we might
* be processing this FocusIn after we've changed to a
* different workspace; we should therefore update the MRU
* list only if the window is actually on the active
* workspace.
*/ */
if (window->screen->active_workspace) if (window->screen->active_workspace &&
meta_window_visible_on_workspace (window,
window->screen->active_workspace))
{ {
GList* link; GList* link;
link = g_list_find (window->screen->active_workspace->mru_list, link = g_list_find (window->screen->active_workspace->mru_list,

View File

@ -240,7 +240,7 @@ gboolean
meta_workspace_contains_window (MetaWorkspace *workspace, meta_workspace_contains_window (MetaWorkspace *workspace,
MetaWindow *window) MetaWindow *window)
{ {
return g_list_find (workspace->windows, window) != NULL; return g_list_find (window->workspaces, workspace) != NULL;
} }
void void