Hi, On Thu, Feb 14, 2013 at 12:17 AM, Olivier Guillion - Myriad <oliv...@myriad-online.com> wrote: > Hi, > > I'm struggling with this problem for several days now, and can't find any > solution. > > I'm writing an application for Ubuntu using GTK in C language. > This application manages various windows (floating palettes, documents, > toolbars, etc), with a complex stacking (Z-order) strategy. > I would want to manage the stacking myself, by calling gtk_window_restack > appropriately.
Warning, here be dragons. Applications don't have full control over their stacking order or stacking policy, except if they are override redirect and the window manager does not touch them at all. > > It works well, except for one thing : when a window is clicked, it seems to be > automatically sent to front (top of the stack) by the system before my program > receives any signal. > For instance, if I put a breakpoint in the "focus_in_event" or > "button_press_event" signal callback, the window has already been sent to top > before the breakpoint is reached. > > Is there a way to prevent a clicked window from being automatically sent to > top > of the stack ? > Any help would be greatly appreciated. > There isn't really. You can set _NET_WM_STATE_BELOW to make the window manager put it on the same layer as all of the "below" windows [1]. The window manager will still freely raise any window within this layer. Then you can use WM_TRANSIENT_FOR in order to force ordering amongst your windows. That ordering won't be exclusive though - it is entirely possible that other windows can go in-between. The reason why the window is automatically raised is because the window manager has a passive grab on the parent window if its not on the top of the stack. This grab activates and prevents your application from receiving the first mouse click until the window manager has done what its wants to do, namely, place the window at the top of the stack. This is part of the reason why people want client side decorations. I'd suggest reconsidering the design of your application. There are very good reasons why window managers needs to manage the stacking order, allowing applications to override that behaviour generally results in trouble. [1] http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#STACKINGORDER > Thank you, > Olivier > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Sam Spilsbury _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list