There is a single unambiguous way to detect if there currently is a GNOME compliant Window Manager running. It is the job of the Window Manager to set up a few things to make this possible. Using the following method it is also possible for applications to detect compliance by receiving an event when the Window Manager exits.
To do this the Window Manager should create a Window, that is a child of the root window. There is no need to map it, just create it. The Window Manager may reuse ANY window it has for this purpose - even if it is mapped, just as long as the window is never destroyed while the Window Manager is running.
Once the Window is created the Window Manager should set a property on the root window of the name _WIN_SUPPORTING_WM_CHECK, and type CARDINAL. The atom's data would be a CARDINAL that is the Window ID of the window that was created above. The window that was created would ALSO have this property set on it with the same values and type.
Example:
Display *disp;
Window root_window;
Atom atom_set;
CARD32 val;
Window win;
atom_set = XInternAtom(disp, "_WIN_SUPPORTING_WM_CHECK", False);
win = XCreateSimpleWindow(disp, root_window, -200, -200, 5, 5, 0, 0, 0);
val = win;
XChangeProperty(disp, root_window, atom_set, XA_CARDINAL, 32,
PropModeReplace, (unsigned char *), 1);
XChangeProperty(disp, win, atom_set, XA_CARDINAL, 32, PropModeReplace,
(unsigned char *), 1); |