The Ancient Forbidden Knowledge of X11
The most interesting thing about the development of Leadwerks is digging into low-level X11 libraries that no one really understands. If the stock answers of "use GTK" or "use QT" were sufficient, this project would not be necessary. No one really knows how X11 works anymore, so it's like we are exploring an archaeological ruin and discovering ancient forbidden knowledge.
Here's me looking at the X11 documentation.
X11 doesn't really have a concept of non-embedded child windows like Win32 and Mac have. The desired behavior has two characteristics:
- A child window always appears on top of the parent.
- A child window does not appear in the taskbar.
Here's how we do it:
//Make it act like it's parented to the parent window, but not really
if (parent) XSetTransientForHint(display, window->handle, parent->handle);
//Hide from taskbar
window_type = XInternAtom(display, "_NET_WM_STATE", false);
value = XInternAtom(display, "_NET_WM_STATE_SKIP_TASKBAR", false);
XChangeProperty(display,window->handle, window_type, XA_ATOM, 32, PropModeReplace, (unsigned char *) &value, 1);
(The child window should actually be parented to the desktop window, not the intended parent.)
Here is the result. Notice the main window is the active one, but the subwindow and its child still appear on top, in the correct order.
So at this point I think it's safe to say this design will work with Linux, with an absolute minimum of external libraries installed. (Possibly working on SteamOS.) I frankly have more confidence that Mac will provide everything we need, so at this point I think we're going to be good.
If you've tried the Game Launcher on Linux, you'll know that LeadwerksGUI is a huge upgrade over GTK. Our user experience for Linux users is about to get a lot better. It's been a slow gradual process, but moving away from Windows dependency is really happening, and other options are becoming more viable.
- 8
6 Comments
Recommended Comments