X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fx11%2Ffg_window_x11.c;h=2736a5925a6ffb5932b37f9554fcb5a072e9797a;hb=207c3128bf025b5e025bace5c0425d380dd72aa9;hp=cea4ba2fa417c90ec98b6be5a5024c7732490636;hpb=d32fddc67143e6fe637f0aefef741e32fc666b86;p=freeglut diff --git a/src/x11/fg_window_x11.c b/src/x11/fg_window_x11.c index cea4ba2..2736a59 100644 --- a/src/x11/fg_window_x11.c +++ b/src/x11/fg_window_x11.c @@ -1,5 +1,5 @@ /* - * freeglut_window_x11.c + * fg_window_x11.c * * Window management methods for X11 * @@ -40,6 +40,22 @@ #include "x11/fg_window_x11_glx.h" #endif +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 255 +#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; @@ -166,6 +182,8 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, fgState.DisplayMode |= GLUT_DOUBLE ; fghChooseConfig(&WINDOW_CONFIG); fgState.DisplayMode &= ~GLUT_DOUBLE; + + if( WINDOW_CONFIG ) goto done_retry; } #endif @@ -174,8 +192,20 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, fgState.DisplayMode &= ~GLUT_MULTISAMPLE ; fghChooseConfig(&WINDOW_CONFIG); fgState.DisplayMode |= GLUT_MULTISAMPLE; + + if( WINDOW_CONFIG ) goto done_retry; + } + + if( fgState.DisplayMode & GLUT_SRGB ) + { + fgState.DisplayMode &= ~GLUT_SRGB ; + fghChooseConfig(&WINDOW_CONFIG); + fgState.DisplayMode |= GLUT_SRGB; + + if( WINDOW_CONFIG ) goto done_retry; } } +done_retry: FREEGLUT_INTERNAL_ERROR_EXIT( WINDOW_CONFIG != NULL, "FBConfig with necessary capabilities not found", "fgOpenWindow" ); @@ -341,6 +371,25 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, 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)