/*
- * freeglut_window_x11.c
+ * fg_window_x11.c
*
* Window management methods for X11
*
#include "x11/fg_window_x11_glx.h"
#endif
+/* Motif window hints, only define needed ones */
+typedef struct
+{
+ unsigned long flags;
+ unsigned long functions;
+ unsigned long decorations;
+ long input_mode;
+ unsigned long status;
+} MotifWmHints;
+#define MWM_HINTS_DECORATIONS (1L << 1)
+#define MWM_DECOR_BORDER (1L << 1)
+
static int fghResizeFullscrToggle(void)
{
XWindowAttributes attributes;
XEvent eventReturnBuffer; /* return buffer required for a call */
unsigned long mask;
unsigned int current_DisplayMode = fgState.DisplayMode ;
- XConfigureEvent fakeEvent = {0};
+ XEvent fakeEvent = {0};
/* Save the display mode if we are creating a menu window */
if( window->IsMenu && ( ! fgStructure.MenuContext ) )
/* Fake configure event to force viewport setup
* even with no window manager.
*/
- fakeEvent.type = ConfigureNotify;
- fakeEvent.display = fgDisplay.pDisplay.Display;
- fakeEvent.window = window->Window.Handle;
- fakeEvent.x = x;
- fakeEvent.y = y;
- fakeEvent.width = w;
- fakeEvent.height = h;
- XPutBackEvent(fgDisplay.pDisplay.Display, (XEvent*)&fakeEvent);
+ fakeEvent.xconfigure.type = ConfigureNotify;
+ fakeEvent.xconfigure.display = fgDisplay.pDisplay.Display;
+ fakeEvent.xconfigure.window = window->Window.Handle;
+ fakeEvent.xconfigure.x = x;
+ fakeEvent.xconfigure.y = y;
+ fakeEvent.xconfigure.width = w;
+ fakeEvent.xconfigure.height = h;
+ XPutBackEvent(fgDisplay.pDisplay.Display, &fakeEvent);
/*
* The GLX context creation, possibly trying the direct context rendering
XSetWMProtocols( fgDisplay.pDisplay.Display, window->Window.Handle,
&fgDisplay.pDisplay.DeleteWindow, 1 );
+ 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)