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 534752 - new windows are put in background when a window has always on top set
new windows are put in background when a window has always on top set
Product: metacity
Classification: Other
Component: Focus
Other All
: Normal normal
: ---
Assigned To: Thomas Thurman
Metacity maintainers list
: 548809 (view as bug list)
Depends on:
Reported: 2008-05-25 11:35 UTC by unggnu
Modified: 2014-06-04 06:23 UTC
See Also:
GNOME target: ---
GNOME version: 2.25/2.26

Don't put window in background (2.52 KB, patch)
2009-03-11 22:36 UTC, Matthew Martin
reviewed Details | Review
updated patch against 2.34.3 (2.41 KB, patch)
2012-06-21 16:28 UTC, Tails developers
committed Details | Review

Description unggnu 2008-05-25 11:35:50 UTC
Please describe the problem:
If one window is set to stay always on top all new windows are opened behind the last activated one. This is no problem if only one window or a short one is opened but if e.g. Firefox or an other application is maximized and activated all new opened windows doesn't appear except of the panel. This is very confusing especially with Popups or newly started apps since there seems no response at all.
Another very annoying thing is that if you mark e.g. the video player VLC to stay on top and then make it full screen the original window and the panels still cover the full screen. This could be work around through clicking on the covering vlc window and then back to the video full screen.

Steps to reproduce:
1. Open Calculator and set it to be always on top
2. Open Firefox or another full screen program and maximize it
3. Open a link in a new window or just start other windowed applications

Actual results:
All new windows are opened behind the last focused app.

Expected results:
Newly started apps should appear in foreground (except in the area of the always on top application of course)

Does this happen every time?
Yes it does happen every time.

Other information:
The problem doesn't appear with Compiz. It happens with Ubuntu Hardy 8.04 and in Debian Sid.
Comment 1 Zachary Dovel 2008-10-17 06:38:49 UTC
I'm going to give some more detail on this bug and hopefully it will help the developers understand where in the code the problem is. It has been around for at least a year or two. Maybe more.

When "stay on top" is enabled for any single window, all new windows from that point on will always be placed immediately behind the currently focused window without stealing focus.  This fact is only evident when using sloppy focused mode, where a window of any z-index can have focus.

The best way to test out the problem is to:
1. Change the mouse mode to sloppy focus
2. Open a bunch of normal windows (Firefox, gnome-terminal, whatever.)
3. Move the windows to different positions a bit haphazardly so they overlap a bit on eachother.  
4. Move one window into a corner by itself, make is fairly small, and set it to stay on top.
5. Do the alt-f2 key combination and see where the application execute dialog pops up.
6. Try it again with different windows focused by mousing around. The z-index level at which the application execute dialog pops up should be different.

When you hit alt-f2, you expect to be able to start typing in a program name immediately.  But you can't because the window is hidden behind focused window and it didn't steal focus.  This can cause havoc because the program that the user thinks the keyboard input is going to is actually a different mplayer *shutter*.  
Comment 2 Steven Brown 2008-10-18 00:23:01 UTC

My common use-case: watching a video in Totem which is always-on-top in a corner while browsing the internet in a maximized Epiphany window.  When a link opens in a window, it *should* be raised above the existing Epiphany windows and below the always-on-top Totem window, but it is placed somewhere behind the existing Epiphany window.  The only indication a new window is opened is provided by the task-bar flashing.
Comment 3 Sascha Heid 2008-10-20 13:31:16 UTC

If you have any application set to be always on top, applications started later will be in the sternmost background.
Not just in the background relative to the "always on top" window, but in the background relative to ALL open windows.

Its very annoying in my scenario where i have a small window always on top (handwriting recognition input) and a maximized window below.
When i now start another application it will not be visible and only show up in the panel because it is not only started in the background of the "always-on-top" window but also in the background of the maximized window (which is NOT set to always-on-top).

Comment 4 Forest Hale 2009-03-06 12:37:21 UTC

This bug drives me nuts with cookie confirmations in firefox, simply because I have xmms running (window shade + always on top).
Comment 5 Matthew Martin 2009-03-11 22:36:11 UTC
Created attachment 130489 [details] [review]
Don't put window in background

This patch should fix this bug, but I have not hacked a lot on 
metacity before. So, I may have broken other focus related things in it
by accident. Just a warning for the maintainers :-). 

This will make the new window appear below the always on top window. However,
it will not grab focus. Because the window could be completely covered
by an always on top window. (See comment in would_be_covered) I think this is correct, but it does feel rather awkward if only a small piece of the window is covered. Should we also calculate how much of the window is covered in would_be_covered? Then if it is only a small piece, return like it is not covered at all?
Comment 6 Austriaco 2009-03-18 09:55:28 UTC
I don't know whether or not this patch solves this problem, but I wanted to add that in my case the focus problem is not related to any window being "always on top".

First my scenario description: I have a firefox window open and maximized and a Liferea (feed reader) window open where I'm browsing through several feeds. When I find an interesting feed item I want to read I want the link to open on a NEW firefox window so that when I close this newly opened window I will be back into the liferea window. The new firefox window is opened but in the background, so I have to switch to it by Alt+Tab.

Metacity version I'm using: 2.4.0-0ubuntu1
Comment 7 Olav Vitters 2009-03-31 17:35:48 UTC
*** Bug 548809 has been marked as a duplicate of this bug. ***
Comment 8 Christoph Reiter (lazka) 2009-04-01 09:24:09 UTC
Also confirming. This is extremely annoying.
Comment 9 Martin von Wittich 2009-08-26 17:24:52 UTC
I'd vote for this instead of spamming, but as voting seems to be disabled here: confirmed :P

If you regularly work with 'always on top' windows (I like to have my console window on top), this is extremely annoying.
Comment 10 Thomas Thurman 2010-05-08 20:01:22 UTC
Review of attachment 130489 [details] [review]:


Could you explain briefly how this works?  I don't see how it's intended to solve the problem, but maybe I'm missing something.  You want windows *not* to be stacked below the focus window if they're covered?  And why do you add the check for whether the windows are minimised?
Comment 11 Thomas Thurman 2010-05-08 20:03:34 UTC
(In reply to comment #0)
> Steps to reproduce:
> 1. Open Calculator and set it to be always on top
> 2. Open Firefox or another full screen program and maximize it
> 3. Open a link in a new window or just start other windowed applications
> Actual results:
> All new windows are opened behind the last focused app.

I'm not seeing this (with 2.30.1).  If anyone can confirm that this is still a problem, please re-open the bug.
Comment 12 Christoph Reiter (lazka) 2010-05-09 07:04:37 UTC
> I'm not seeing this (with 2.30.1).  If anyone can confirm that this is still a
> problem, please re-open the bug.


If the "always on top" window is minimised and you show a hidden window (usecase: show a window which was hidden by a tray icon) the window will be placed behind all other windows.

Please reopen.
Comment 13 Martin von Wittich 2010-10-31 14:45:30 UTC
This is not resolved for me. I always have an always-on-top minimized gnome-terminal window running all the time, and all windows open up in the background.

I'm running Ubuntu 10.10 with metacity 1:2.30.2-0ubuntu1.
Comment 14 Sascha Heid 2010-10-31 14:54:37 UTC
Not resolved for me either.
Comment 15 intrigeri 2011-01-03 18:16:02 UTC
This bug is demonstrated in the T(A)ILS ( Live CD that ships the onBoard virtual keyboard. Matthew's patch fixes it (Debian Squeeze's package 1:2.30.1-3).

Thomas told to reopen the bug in case it was still a problem, but I don't seem to have the needed credentials to do so.
Comment 16 Marcel Telka 2011-02-16 12:54:31 UTC
Comment 17 intrigeri 2011-04-24 22:08:52 UTC
As mentionned on bug 571969, this bug is still reproducible on 2.30.1.
Matthew's patch still fixes it. We've been shipping a patched Metacity
in Tails ( for ages, without any bug report.

I just checked Matthew's patch still applies against current Git (8c40702),
without testing it though; on the other hand the parts of the code it touches
have not changed for, well, many years.

For the record, this issue is tracked as Debian bug #515577; it was confirmed
there by two people, not including me.
Comment 18 Forest Hale 2011-04-24 23:34:51 UTC
Just an anecdotal comment, this affects OpenSUSE 11.4 in GNOME2 and somehow KDE4 has acquired the issue (or something similar) as well.  I hope this bug does not spread to more desktops :)
Comment 19 Tails developers 2012-06-21 16:28:22 UTC
Created attachment 216942 [details] [review]
updated patch against 2.34.3

This is Matthew's patch, updated to apply cleanly on metacity 2.34.3. Please consider applying it.
Comment 20 Alberts Muktupāvels 2014-06-04 06:22:39 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.