GNOME Bugzilla – Bug 768221
Fullscreen windows get focus when a window closes, regardless of monitor
Last modified: 2016-12-07 14:41:16 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.)
(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 ...
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.
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.
(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 ...
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.
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.
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())
Created attachment 330964 [details] [review] core: Remove META_LAYER_FULLSCREEN -- Right, and there was a bit more dead code to be removed too.
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...
Review of attachment 330964 [details] [review]: LGTM
Review of attachment 330965 [details] [review]: OK
Attachment 330964 [details] pushed as fcc7501 - core: Remove META_LAYER_FULLSCREEN Attachment 330965 [details] pushed as 5ee0f24 - window: Stop updating layers on focus changes
Thanks.
*** Bug 769098 has been marked as a duplicate of this bug. ***
*** Bug 742322 has been marked as a duplicate of this bug. ***