Commit 2ddd7059 authored by Marco Trevisan's avatar Marco Trevisan 🎺

window-x11: Focus the default window waiting for take focus

It's not guaranteed that a focus window will require the focus (this doesn't
happen for no-input gtk windows in fact [to be fixed there too]).
And in such case instead of unsetting the focus, while waiting the take focus
request to arrive, we should focus the current workspace default focus window
instead.

GNOME/mutter!307
parent 2b9bfddb
new_client 2 x11
create 2/1
show 2/1
wait
new_client 1 x11
create 1/1
show 1/1
......@@ -14,9 +19,11 @@ set_parent 1/3 2
show 1/3
wait
assert_stacking 1/1 1/2 1/3
assert_focused 1/3
assert_stacking 2/1 1/1 1/2 1/3
destroy 1/3
wait
assert_stacking 1/1 1/2
assert_focused 1/1
assert_stacking 2/1 1/1 1/2
......@@ -827,13 +827,27 @@ meta_window_x11_focus (MetaWindow *window,
* Normally, we want to just leave the focus undisturbed until
* the window responds to WM_TAKE_FOCUS, but if we're unmanaging
* the current focus window we *need* to move the focus away, so
* we focus the no_focus_window now (and set
* display->focus_window to that) before sending WM_TAKE_FOCUS.
* we focus the default focus window excluding this one,
* before sending WM_TAKE_FOCUS.
*/
if (window->display->focus_window != NULL &&
window->display->focus_window->unmanaging)
meta_x11_display_focus_the_no_focus_window (window->display->x11_display,
timestamp);
{
MetaWindow *focus_window = window;
MetaWorkspace *workspace = window->workspace;
do
{
focus_window = meta_stack_get_default_focus_window (workspace->display->stack,
workspace,
focus_window);
}
while (!(!focus_window || focus_window->input ||
(focus_window->frame && focus_window->shaded)));
if (focus_window)
meta_window_x11_focus (focus_window, timestamp);
}
}
request_take_focus (window, timestamp);
......
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