Commit 9d1d8fa0 authored by Elijah Newren's avatar Elijah Newren Committed by Elijah Newren
Browse files

Make choice of focus window be consistent for each focus mode. Fixes

2004-06-24  Elijah Newren  <newren@math.utah.edu>

	Make choice of focus window be consistent for each focus mode.
	Fixes #135810.

	* src/delete.c: (meta_window_delete): In some #if 0'ed code,
	replace meta_workspace_focus_mru_window with
	meta_workspace_focus_default_window (just in case the code becomes
	un-#if 0'ed out).

	* src/screen.c, src/screen.h: Change
	meta_screen_focus_mouse_window to meta_screen_get_mouse_window,
	and don't focus the window when found but rather return it.

	* src/window.c: (meta_window_free, meta_window_minimize): replace
	meta_workspace_focus_mru_window with
	meta_workspace_focus_default_window.

	* src/workspace.c: (meta_workspace_focus_default_window): Focus
	appropriately for the given focus method:
	   click-to-focus: focus MRU window (== toplevel window)
	   sloppy focus:   focus the window under the pointer if there is
	                   such a window, otherwise focus the mru window
	   mouse focus:    focus the window under the pointer if there is
	                   such a window, otherwise don't focus anything
parent 702a4c0d
2004-06-24 Elijah Newren <newren@math.utah.edu>
Make choice of focus window be consistent for each focus mode.
Fixes #135810.
* src/delete.c: (meta_window_delete): In some #if 0'ed code,
replace meta_workspace_focus_mru_window with
meta_workspace_focus_default_window (just in case the code becomes
un-#if 0'ed out).
* src/screen.c, src/screen.h: Change
meta_screen_focus_mouse_window to meta_screen_get_mouse_window,
and don't focus the window when found but rather return it.
* src/window.c: (meta_window_free, meta_window_minimize): replace
meta_workspace_focus_mru_window with
meta_workspace_focus_default_window.
* src/workspace.c: (meta_workspace_focus_default_window): Focus
appropriately for the given focus method:
click-to-focus: focus MRU window (== toplevel window)
sloppy focus: focus the window under the pointer if there is
such a window, otherwise focus the mru window
mouse focus: focus the window under the pointer if there is
such a window, otherwise don't focus anything
2004-06-24 Elijah Newren <newren@math.utah.edu>
* src/window.c: Avoid a race condition on the choice of window to
......
......@@ -396,10 +396,10 @@ meta_window_delete (MetaWindow *window,
* I don't know how to avoid that though.
*/
meta_topic (META_DEBUG_FOCUS,
"Focusing MRU window because focus window %s was deleted/killed\n",
"Focusing default window because focus window %s was deleted/killed\n",
window->desc);
meta_workspace_focus_mru_window (window->screen->active_workspace,
window);
meta_workspace_focus_default_window (window->screen->active_workspace,
window);
#else
meta_topic (META_DEBUG_FOCUS,
"Not unfocusing %s on delete/kill\n",
......
......@@ -1224,9 +1224,9 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen)
/* don't show tab popup, since proper space isn't selected yet */
}
void
meta_screen_focus_mouse_window (MetaScreen *screen,
MetaWindow *not_this_one)
MetaWindow*
meta_screen_get_mouse_window (MetaScreen *screen,
MetaWindow *not_this_one)
{
MetaWindow *window;
Window root_return, child_return;
......@@ -1256,22 +1256,7 @@ meta_screen_focus_mouse_window (MetaScreen *screen,
root_x_return,
root_y_return);
/* FIXME I'm a loser on the CurrentTime front */
if (window)
{
meta_topic (META_DEBUG_FOCUS,
"Focusing mouse window %s\n", window->desc);
meta_window_focus (window, meta_display_get_current_time (screen->display));
/* Also raise the window if in click-to-focus */
if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK)
meta_window_raise (window);
}
else
{
meta_topic (META_DEBUG_FOCUS, "No mouse window to focus found\n");
}
return window;
}
const MetaXineramaScreenInfo*
......
......@@ -148,7 +148,7 @@ void meta_screen_ensure_tab_popup (MetaScreen *scree
void meta_screen_ensure_workspace_popup (MetaScreen *screen);
void meta_screen_focus_mouse_window (MetaScreen *screen,
MetaWindow* meta_screen_get_mouse_window (MetaScreen *screen,
MetaWindow *not_this_one);
const MetaXineramaScreenInfo* meta_screen_get_current_xinerama (MetaScreen *screen);
......
......@@ -925,17 +925,17 @@ meta_window_free (MetaWindow *window)
if (window->has_focus)
{
meta_topic (META_DEBUG_FOCUS,
"Focusing top window since we're unmanaging %s\n",
"Focusing default window since we're unmanaging %s\n",
window->desc);
meta_workspace_focus_mru_window (window->screen->active_workspace, window);
meta_workspace_focus_default_window (window->screen->active_workspace, window);
}
else if (window->display->expected_focus_window == window)
{
meta_topic (META_DEBUG_FOCUS,
"Focusing top window since expected focus window freed %s\n",
"Focusing default window since expected focus window freed %s\n",
window->desc);
window->display->expected_focus_window = NULL;
meta_workspace_focus_mru_window (window->screen->active_workspace, window);
meta_workspace_focus_default_window (window->screen->active_workspace, window);
}
else
{
......@@ -1380,7 +1380,7 @@ idle_calc_showing (gpointer data)
GSList *should_hide;
GSList *unplaced;
GSList *displays;
meta_topic (META_DEBUG_WINDOW_STATE,
"Clearing the calc_showing queue\n");
......@@ -1902,9 +1902,9 @@ meta_window_minimize (MetaWindow *window)
if (window->has_focus)
{
meta_topic (META_DEBUG_FOCUS,
"Focusing top window due to minimization of focus window %s\n",
"Focusing default window due to minimization of focus window %s\n",
window->desc);
meta_workspace_focus_mru_window (window->screen->active_workspace, window);
meta_workspace_focus_default_window (window->screen->active_workspace, window);
}
else
{
......
......@@ -784,7 +784,21 @@ meta_workspace_focus_default_window (MetaWorkspace *workspace,
if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK)
meta_workspace_focus_mru_window (workspace, not_this_one);
else
meta_screen_focus_mouse_window (workspace->screen, not_this_one);
{
MetaWindow * window;
window = meta_screen_get_mouse_window (workspace->screen, not_this_one);
if (window)
{
meta_topic (META_DEBUG_FOCUS,
"Focusing mouse window %s\n", window->desc);
meta_window_focus (window, meta_display_get_current_time (workspace->screen->display));
}
else if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_SLOPPY)
meta_workspace_focus_mru_window (workspace, not_this_one);
else if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_MOUSE)
meta_topic (META_DEBUG_FOCUS, "No mouse window to focus found\n");
}
}
/* Focus MRU window (or top window if failed) on active workspace */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment