Does anyone know how to determine which windows in a GTK application are "top level windows". What I mean by this is windows that would normally come along with a border (which includes a title and a minimize/maximize button as well as a red 'x'/close button) in any common window manager e.g. text tool tips would not be a top level window because those never get borders, never the less they are still considered windows in x11 (or at least in GTK they are). I have a GTK application running on top of xvfb without any window managers and I noticed that every window is a direct child of the root window for some reason making finding the "top level windows" difficult to find.
Thanks a bunch!
A popup like you describe is a top-level window precisely because it floats above the window that generated the popup. It can't be a child since then it would be clipped.
What you should check are the hints given to the window manager, more specifically the _NET_WM_WINDOW_TYPE atom(s). (see this link at freedesktop.org or this one at gnome.org). What every application these days does (or should do) is tell the window manager "Hey, I'm a window of type X, please make sure I get decorated properly." A 'normal' window for an application should set the property to _NET_WM_WINDOW_TYPE_NORMAL, while a menu would have _NET_WM_TYPE_POPUP_MENU, a tooltip _NET_WM_TYPE_TOOLTIP, et cetera.
Even though you are not running a window manager the application will still set the property and you can still query it.
Note that a window can have multiple types though in practice this is rarely done; the intent was to have a preferred window type followed by fallback type(s) in case the window manager doesn't support your type of window. So if you get the list of types you must check them all. I'm not sure there's a way to determine which type the window manager eventually uses. At least your 'normal' window should have a supported type.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments