Refuse to focus a window with a modal transient, and focus the transient

2005-01-25  Elijah Newren  <newren@gmail.com>

	Refuse to focus a window with a modal transient, and focus the
	transient instead.  Fixes #164716.

	* src/window.c: (get_modal_transient): new function,
	(meta_window_focus): if the window has a modal transient, make
	sure it is on the current workspace and then focus it instead.
This commit is contained in:
Elijah Newren 2005-01-25 17:26:06 +00:00 committed by Elijah Newren
parent 3afcb9c963
commit f31c57a049
2 changed files with 62 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2005-01-25 Elijah Newren <newren@gmail.com>
Refuse to focus a window with a modal transient, and focus the
transient instead. Fixes #164716.
* src/window.c: (get_modal_transient): new function,
(meta_window_focus): if the window has a modal transient, make
sure it is on the current workspace and then focus it instead.
2005-01-24 Elijah Newren <newren@gmail.com>
* configure.in: post-release version bump to 2.9.13

View File

@ -3245,10 +3245,50 @@ meta_window_get_startup_id (MetaWindow *window)
return window->startup_id;
}
static MetaWindow*
get_modal_transient (MetaWindow *window)
{
GSList *windows;
GSList *tmp;
MetaWindow *modal_transient;
/* A window can't be the transient of itself, but this is just for
* convenience in the loop below; we manually fix things up at the
* end if no real modal transient was found.
*/
modal_transient = window;
windows = meta_display_list_windows (window->display);
tmp = windows;
while (tmp != NULL)
{
MetaWindow *transient = tmp->data;
if (transient->xtransient_for == modal_transient->xwindow &&
transient->wm_state_modal)
{
modal_transient = transient;
tmp = windows;
continue;
}
tmp = tmp->next;
}
g_slist_free (windows);
if (window == modal_transient)
modal_transient = NULL;
return modal_transient;
}
void
meta_window_focus (MetaWindow *window,
Time timestamp)
{
MetaWindow *modal_transient;
meta_topic (META_DEBUG_FOCUS,
"Setting input focus to window %s, input: %d take_focus: %d\n",
window->desc, window->input, window->take_focus);
@ -3262,6 +3302,19 @@ meta_window_focus (MetaWindow *window,
return;
}
modal_transient = get_modal_transient (window);
if (modal_transient != NULL)
{
meta_topic (META_DEBUG_FOCUS,
"%s has %s as a modal transient, so focusing it instead.\n",
window->desc, modal_transient->desc);
if (!modal_transient->on_all_workspaces &&
modal_transient->workspace != window->screen->active_workspace)
meta_window_change_workspace (modal_transient,
window->screen->active_workspace);
window = modal_transient;
}
meta_window_flush_calc_showing (window);
if (!window->mapped && !window->shaded)