I was asked on IRC to explain why it is that programs mostly cannot raise their own windows.
The mechanism:
gtk_window_show() indirectly calls XRaiseWindow. This causes a ConfigureRequest X event. Metacity will only honour this if:
- the window belongs to the active application (but if there is no active application, any application can raise its windows), or
- there has been user activity in the new window more recently than in the active window
In all other cases it will ignore the request. If the request is to raise a window (rather than to lower it), it will set the attention hint on the window which was trying to raise itself.
The policy:
- Havoc noted in r460 that:
…in fact all client attempts to deal with stacking order are essentially broken, since they have no idea what other clients are involved or how the stack looks.
although that changeset did allow clients to raise themselves.
- After a discussion based partly on this, GNOME bug 166395 in February 2005 established a consensus that client attempts to deal with stacking order should be ignored; this was implemented in r1936.
- However, this left the program believing that it had alerted the user but with no change in the display, which was unhelpful. Therefore, in GNOME bug 305882 it was decided that when client attempts to deal with stacking order were ignored, the attention flag should be set instead; this was implemented in r2045.
This is not just GNOME being weird: here’s Lubos Lunak (the kwin maintainer) saying the same thing last year.
If you think this is a bad idea, figure out which part of it you think is a bad idea and then complain on that bug, or on wm-spec-list.