[mutter/wip/3v1n0/run-tests-in-ci: 10/14] window-x11: Focus the default window waiting for take focus
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/3v1n0/run-tests-in-ci: 10/14] window-x11: Focus the default window waiting for take focus
- Date: Wed, 14 Nov 2018 08:20:44 +0000 (UTC)
commit 8652ec9ee280e3b44e248501f5d13062f41453da
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Tue Nov 13 17:08:34 2018 -0600
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.
.../closed-transient-no-input-parent.metatest | 13 ++++++++++---
src/x11/window-x11.c | 22 ++++++++++++++++++----
2 files changed, 28 insertions(+), 7 deletions(-)
---
diff --git a/src/tests/stacking/closed-transient-no-input-parent.metatest
b/src/tests/stacking/closed-transient-no-input-parent.metatest
index af24a1072..bb652c1cb 100644
--- a/src/tests/stacking/closed-transient-no-input-parent.metatest
+++ b/src/tests/stacking/closed-transient-no-input-parent.metatest
@@ -1,3 +1,8 @@
+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
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
index bfcbc7ad5..b0b071f73 100644
--- a/src/x11/window-x11.c
+++ b/src/x11/window-x11.c
@@ -789,13 +789,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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]