Commit Graph

15 Commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
6944839ab6 window-props: Read WM_TRANSIENT_FOR for override-redirect windows
As per the Extended Window Manager Hints standard version 1.3 [1] an
override-redirect window can set a transient-for window per compositing and
app-matching purposes.

So just read the WM_TRASIENT_FOR property also for such windows, adapting
the error in case they are transient for another O-R window and adding a
test to check such case.

[1] https://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472512128

https://gitlab.gnome.org/GNOME/mutter/merge_requests/920
2019-11-07 18:43:16 +00:00
Marco Trevisan (Treviño)
bacbbbd628 window-props: Don't set override redirect windows as top-level parent
Java applications might use override-redirect windows as parent windows for
top-level windows, although this is not following the standard [1].

In such case, the first non-override-redirect child window that is created
was marked as being on_all_workspaces since the call to
should_be_on_all_workspaces() returns TRUE for its parent, and this even
though the on_all_workspaces_requested bit is unset.
When a further child of this window was added, it was set as not having a
workspace and not being on_all_workspaces, since the call to
should_be_on_all_workspaces() for its parent would return FALSE (unless if
it is in a different monitor, and the multiple-monitors workspaces are
disabled).

Since per commit 09bab98b we don't recompute the workspace if the
on_all_workspaces bit is unset, we could end up in a case where a window can
be nor in all the workspaces or in a specific workspace.

So let's just ignore the transient_for bit for a window if that points to an
override-redirect, using the x11 root window instead.

Add a stacking test to verify this scenario (was failing before of this
commit).

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/885
https://gitlab.gnome.org/GNOME/mutter/merge_requests/895

[1] https://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472512128
2019-11-07 16:04:19 +00:00
Marco Trevisan (Treviño)
6d8293a422 window-x11: Use any focusable window as fallback delayed focus window
As per commit f71151a5 we focus an input window if no take-focus-window accepts
it. This might lead to an infinite loop if there are various focusable but
non-input windows in the stack.

When the current focus window is unmanaging and we're trying to focus a
WM_TAKE_FOCUS window, we intent to give the focus to the first focusable input
window in the stack.

However, if an application (such as the Java ones) only uses non-input
WM_TAKE_FOCUS windows, are not requesting these ones to get the focus. This
might lead to a state where no window is focused, or a wrong one is.

So, instead of only focus the first eventually input window available, try to
request to all the take-focus windows that are in the stack between the
destroyed one and the first input one to acquire the input focus.
Use a queue to keep track of those windows, that is passed around stealing
ownership, while we protect for unmanaged queued windows.

Also, reduce the default timeout value, as the previous one might lead to an
excessive long wait.

Added metatests verifying these situations.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/660
https://gitlab.gnome.org/GNOME/mutter/merge_requests/669
2019-07-08 11:46:52 +02:00
Marco Trevisan (Treviño)
c327b2df95 window-x11: Accept any focusable window as fallback focus
As per commit f71151a5 we were ignoring WM_TAKE_FOCUS-only windows as focus
targets, however this might end-up in an infinite loop if there are multiple
non-input windows stacked.

So, accept any focusable window as fallback focus target even if it's a
take-focus one (that might not reply to the request).

Added a stacking test to verify this.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/660
https://gitlab.gnome.org/GNOME/mutter/merge_requests/669
2019-07-08 11:21:17 +02:00
Marco Trevisan (Treviño)
ecf7e53206 metatest: Dispatch the destruction instead of sleeping after it
https://gitlab.gnome.org/GNOME/mutter/merge_requests/669/
2019-07-08 11:21:17 +02:00
Marco Trevisan (Treviño)
f71151a5dd window-x11: Focus the default window with delay while waiting for take-focus
When requesting to a take-focus window to acquire the input, the client may or
may not respond with a SetInputFocus (this doesn't happen for no-input gtk
windows in fact [to be fixed there too]), in such case we were unsetting the
focus while waiting the reply.

In case the client won't respond, we wait for a small delay (set to 250 ms) for
the take-focus window to grab the input focus before setting it to the default
window.

Added a test for this behavior and for the case in which a window takes the
focus meanwhile we're waiting to focus the default window.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
fcb408ad5d tests: Verify focused window in closed-transient tests
Ensure that we have a focused window when closing transient windows with
no-focus or no-take-focus atoms

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Marco Trevisan (Treviño)
2fc7760cee tests, stacking: Add tests with no-input and no-take-focus windows
When a window with no frame, that doesn't accept focus and that has no
take-focus atom set is destroyed, we ended up in not changing the current_focus
window, causing a crash.

Added test cases that verify this situation.

Related to https://gitlab.gnome.org/GNOME/mutter/issues/308
https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
Florian Müllner
e283cd7b91 tests: Add "closed-transient" test
When a transient window is destroyed, the expected behavior is that
focus is passed to the ancestor if possible. This was broken for
quite a while until the previous commit, so add a test case to make
sure it doesn't happen again.

https://gitlab.gnome.org/GNOME/mutter/issues/15
2018-07-30 17:48:42 +00:00
Olivier Fourdan
7749f4d983 tests: Add the "parent_exported" test
This test aims at checking that the transient relationship set using the
xdg-foreign API is respected by mutter and that no crash occurs, such as
the one in issue !174.

Note: the crash from issue !174 occurs only if "attach_modal_dialogs" is
set, so one has to change that default value to "true" to be able to
trigger the crash:

    gsettings set org.gnome.mutter attach-modal-dialogs true

Related: https://gitlab.gnome.org/GNOME/mutter/issues/174
2018-07-18 14:31:38 +02:00
Jonas Ådahl
75b992c7d0 tests: Add test for testing that setting a parent affects the stack
A new test is added that tests that xdg_surface.set_parent (referred to
as "transient for" in X11 terminology) affects the stack immediately.

https://bugzilla.gnome.org/show_bug.cgi?id=755606
2015-12-23 14:59:36 +08:00
Owen W. Taylor
cdfb301200 Add a test for stacking vs. minimization
Test that the guard window is in the right place.

https://bugzilla.gnome.org/show_bug.cgi?id=737233
2014-09-24 16:51:20 -04:00
Owen W. Taylor
7616881afa test-runner: represent the guard window as '|' for assert_stacking
Allow putting '|' into the list of windows for assert_stacking to
represent the position of the guard window. Not present is the same
as at the beginning (bottom) of the list.

https://bugzilla.gnome.org/show_bug.cgi?id=737233
2014-09-24 16:26:17 -04:00
Owen W. Taylor
21f123c69f Don't restack windows while we are unmanaging them
Restacking the frame for a window while unmanaging the window is
harmless, but for undecorated (in particular, client-side-decorated)
windows, this causes problems because the window is typically
destroyed by the client immediately after withredrawing the window.

Skip windows flagged as being unmanaged when assembling the new
stack and when comparing the old order to the new stack.

Add a stacking test for this.
2014-09-16 13:44:42 -04:00
Owen W. Taylor
2f63c39fa6 Add a test framework and stacking tests
Add a basic framework for tests of Mutter handling of client behavior;
mutter-test-runner is a Mutter-based compositor that forks off instances
of mutter-test-client and sends commands to them based on scripts.
The scripts also include assertions.

mutter-test-runner always runs in nested-Wayland mode since the separate
copy of Xwayland is helpful in giving a reliably clean X server to
test against.

Initially the commands and assertions are designed to test the stacking
behavior of Mutter, but the framework should be extensible to test other
parts of client behavior like focus.

The tests are installed according to:

https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests

if --enable-installed-tests is passed to configure. You can run them
uninstalled with:

 cd src && make run-tests

(Not in 'make check' to avoid breaking 'make distcheck' if Mutter can't be
run nested.)

https://bugzilla.gnome.org/show_bug.cgi?id=736505
2014-09-12 13:14:51 -04:00