+
+ // FIXME: In the future WMNormalHints should be set ... e.g see the
+ // gtk/gdk code (gdk/x11/gdksurface-x11.c) for the setup_top_level
+ // method. But for now (as it would require some significant changes)
+ // leave the code as is.
+
+ // The following is borrowed from the above gdk source for setting top
+ // level windows. The source indicates and the Xlib docs suggest that
+ // this will set the WM_CLIENT_MACHINE and WM_LOCAL_NAME. This will not
+ // set the WM_CLIENT_MACHINE to a Fully Qualified Domain Name (FQDN) which is
+ // required by the Extended Window Manager Hints (EWMH) spec when setting
+ // the _NET_WM_PID (see further down) but running Minetest in an env
+ // where the window manager is on another machine from Minetest (therefore
+ // making the PID useless) is not expected to be a problem. Further
+ // more, using gtk/gdk as the model it would seem that not using a FQDN is
+ // not an issue for modern Xorg window managers.
+
+ verbosestream << "Client: Setting Xorg window manager Properties"
+ << std::endl;
+
+ XSetWMProperties (x11_dpl, x11_win, NULL, NULL, NULL, 0, NULL, NULL, NULL);
+
+ // Set the _NET_WM_PID window property according to the EWMH spec. _NET_WM_PID
+ // (in conjunction with WM_CLIENT_MACHINE) can be used by window managers to
+ // force a shutdown of an application if it doesn't respond to the destroy
+ // window message.
+
+ verbosestream << "Client: Setting Xorg _NET_WM_PID extened window manager property"
+ << std::endl;
+
+ Atom NET_WM_PID = XInternAtom(x11_dpl, "_NET_WM_PID", false);
+
+ pid_t pid = getpid();
+ infostream << "Client: PID is '" << static_cast<long>(pid) << "'"
+ << std::endl;
+
+ XChangeProperty(x11_dpl, x11_win, NET_WM_PID,
+ XA_CARDINAL, 32, PropModeReplace,
+ reinterpret_cast<unsigned char *>(&pid),1);
+
+ // Set the WM_CLIENT_LEADER window property here. Minetest has only one
+ // window and that window will always be the leader.
+
+ verbosestream << "Client: Setting Xorg WM_CLIENT_LEADER property"
+ << std::endl;
+
+ Atom WM_CLIENT_LEADER = XInternAtom(x11_dpl, "WM_CLIENT_LEADER", false);
+
+ XChangeProperty (x11_dpl, x11_win, WM_CLIENT_LEADER,
+ XA_WINDOW, 32, PropModeReplace,
+ reinterpret_cast<unsigned char *>(&x11_win), 1);
+
+ verbosestream << "Client: Finished configuring Xorg specific top level"
+ << " window properties"
+ << std::endl;