+ if (!isSubWindow && !window->IsMenu &&
+ ((fgState.DisplayMode & GLUT_BORDERLESS) || (fgState.DisplayMode & GLUT_CAPTIONLESS)))
+ {
+ /* _MOTIF_WM_HINTS is replaced by _NET_WM_WINDOW_TYPE, but that property does not allow precise
+ * control over the visual style of the window, which is what we are trying to achieve here.
+ * Stick with Motif and hope for the best... */
+ MotifWmHints hints = {0};
+ hints.flags = MWM_HINTS_DECORATIONS;
+ hints.decorations = (fgState.DisplayMode & GLUT_CAPTIONLESS) ? MWM_DECOR_BORDER:0;
+
+ XChangeProperty(fgDisplay.pDisplay.Display, window->Window.Handle,
+ XInternAtom( fgDisplay.pDisplay.Display, "_MOTIF_WM_HINTS", False ),
+ XInternAtom( fgDisplay.pDisplay.Display, "_MOTIF_WM_HINTS", False ), 32,
+ PropModeReplace,
+ (unsigned char*) &hints,
+ sizeof(MotifWmHints) / sizeof(long));
+ }
+
+
+ if (fgDisplay.pDisplay.NetWMSupported
+ && fgDisplay.pDisplay.NetWMPid != None
+ && fgDisplay.pDisplay.ClientMachine != None)
+ {
+ char hostname[HOST_NAME_MAX];
+ pid_t pid = getpid();
+
+ if (pid > 0 && gethostname(hostname, sizeof(hostname)) > -1)
+ {
+ hostname[sizeof(hostname) - 1] = '\0';
+
+ XChangeProperty(
+ fgDisplay.pDisplay.Display,
+ window->Window.Handle,
+ fgDisplay.pDisplay.NetWMPid,
+ XA_CARDINAL,
+ 32,
+ PropModeReplace,
+ (unsigned char *) &pid,
+ 1
+ );
+
+ XChangeProperty(
+ fgDisplay.pDisplay.Display,
+ window->Window.Handle,
+ fgDisplay.pDisplay.ClientMachine,
+ XA_STRING,
+ 8,
+ PropModeReplace,
+ (unsigned char *) hostname,
+ strlen(hostname)
+ );
+ }
+ }
+