After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 768221 - Fullscreen windows get focus when a window closes, regardless of monitor
Fullscreen windows get focus when a window closes, regardless of monitor
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
: 742322 769098 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-06-30 02:51 UTC by Daniel Benoy
Modified: 2016-12-07 14:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
core: Remove META_LAYER_FULLSCREEN (4.18 KB, patch)
2016-07-05 18:03 UTC, Rui Matos
none Details | Review
core: Remove META_LAYER_FULLSCREEN (5.14 KB, patch)
2016-07-06 16:58 UTC, Rui Matos
committed Details | Review
window: Stop updating layers on focus changes (1.51 KB, patch)
2016-07-06 16:58 UTC, Rui Matos
committed Details | Review

Description Daniel Benoy 2016-06-30 02:51:34 UTC
If you open (in order) a fullscreen window A, and a separate window B, then a third window C, then closing window C will bring you back to window A (the fullscreen one), not window B as you might expect.

I imagine this is intentional, however, it happens even in multi-monitor setups, drawing the window focus all the way to another screen, perhaps one you're not looking at, every time the focused window closes.

This comes as a surprise not just to me, but to software like KeePass as well, which will minimize away and start autotyping, only to have its focus pulled to a completely different monitor.

I like having my IRC window fullscreened. Multiple times I've accidentally typed my password into an IRC channel. Also, it's common for many people to have their web browser fullscreen on one of their monitors, potentially leading them to start typing into web pages by surprise (Pausing videos, possibly typing sensitive information into malicious javascript, etc.)
Comment 1 Florian Müllner 2016-06-30 12:31:08 UTC
(In reply to Daniel Benoy from comment #0)
> If you open (in order) a fullscreen window A, and a separate window B, then
> a third window C, then closing window C will bring you back to window A (the
> fullscreen one), not window B as you might expect.

What version are you using? This issue is supposed to be fixed by http://git.gnome.org/browse/mutter/commit?id=1ea8efdedac587, but that landed before 3.18.0. For what it's worth, I cannot reproduce the issue here on master/3.20 ...
Comment 2 Daniel Benoy 2016-06-30 19:48:13 UTC
Ah, really? Okay. I'll try upgrading, and see if I still have the problem.

FYI, if it matters, I have four 1920x1080 screens in a horizontal row.
Comment 3 Daniel Benoy 2016-06-30 19:54:44 UTC
Hm, looks like my distro only goes up to 3.18.2. Hm probably more trouble than it's worth to try to upgrade. I guess if you can't reproduce it in 3.20 then great :) Sorry to be a bother. You can close this ticket if you'd like.
Comment 4 Florian Müllner 2016-07-01 08:55:30 UTC
(In reply to Daniel Benoy from comment #3)
> Hm, looks like my distro only goes up to 3.18.2. [...] I guess if you can't
> reproduce it in 3.20 then great

Not really. As mentioned in comment #1, the commit that should fix the issue landed before 3.18.0. So if you're still seeing this in 3.18.2, there's something else at play. Does your reproducer work for you with any applications, or just some specific ones? FWIW, I've tried firefox and gnome-terminal as fullscreen windows, and other apps like nautilus, eog, gnome-terminal as non-fullscreen windows ...
Comment 5 Daniel Benoy 2016-07-01 19:01:04 UTC
Oh, wow, you're right. I can't replicate it either on another computer. In fact, if I turn off my other screens, it stops happening even on this one.

Tried it with two screens, though, and got the problem to come back. I've narrowed it down a bit, too. The fullscreen window actually *must* be on a different screen for the problem to manifest. I've tried this with all other windows closed, with just two screens and it reproduces it reliably:

1) Open a window A on screen 1 (In my most recent test I used Firefox and hit F11)
2) Open a window B on screen 2 (In my most recent test I used gedit)
3) Open a window C on screen 2 (In my most recent test I used gnome calculator)
4) Close window C, and focus shifts to window A

If you do it all on the same screen, the issue doesn't seem to happen.


To answer your question, yes, every fullscreen application is affected, it seems. Firefox, Chrome, Kodi, and gnome terminal are the ones I've tried so far and it affects all of them.
Comment 6 Rui Matos 2016-07-05 18:03:50 UTC
Created attachment 330916 [details] [review]
core: Remove META_LAYER_FULLSCREEN

This layer isn't really being used and in fact, it causes
meta_stack_get_default_focus_window() to return a fullscreen window
even if the naturally topmost window in the stack isn't a fullscreen
one.

Note that commit a3bf9b01aa7019798924b618160fcb184e096a3c changed how
we choose the default focus window from the MRU to the topmost in the
stack.
Comment 7 Florian Müllner 2016-07-05 18:38:36 UTC
Review of attachment 330916 [details] [review]:

Makes sense to me

::: src/core/window.c
@@ +3266,3 @@
                                           &old_frame_rect, &old_buffer_rect);
 
       meta_window_update_layer (window);

Do we still need this? (Same in make_fullscreen_internal())
Comment 8 Rui Matos 2016-07-06 16:58:02 UTC
Created attachment 330964 [details] [review]
core: Remove META_LAYER_FULLSCREEN

--

Right, and there was a bit more dead code to be removed too.
Comment 9 Rui Matos 2016-07-06 16:58:47 UTC
Created attachment 330965 [details] [review]
window: Stop updating layers on focus changes

Commit 3a4ae679ea398dba437b9750910b17891894899e removed the
FOCUSED_WINDOW layer definition but it was already unused for a long
time. There's no layers to update on focus changes.
--

While searching for other users...
Comment 10 Florian Müllner 2016-07-06 17:01:28 UTC
Review of attachment 330964 [details] [review]:

LGTM
Comment 11 Florian Müllner 2016-07-06 17:02:10 UTC
Review of attachment 330965 [details] [review]:

OK
Comment 12 Rui Matos 2016-07-06 17:11:52 UTC
Attachment 330964 [details] pushed as fcc7501 - core: Remove META_LAYER_FULLSCREEN
Attachment 330965 [details] pushed as 5ee0f24 - window: Stop updating layers on focus changes
Comment 13 Daniel Benoy 2016-07-06 17:13:54 UTC
Thanks.
Comment 14 Florian Müllner 2016-07-22 22:29:30 UTC
*** Bug 769098 has been marked as a duplicate of this bug. ***
Comment 15 Rui Matos 2016-12-07 14:41:16 UTC
*** Bug 742322 has been marked as a duplicate of this bug. ***