projects
/
freeglut
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- fallback to non-sRGB visuals if the context creation failed (GLX-only)
[freeglut]
/
src
/
x11
/
fg_window_x11.c
diff --git
a/src/x11/fg_window_x11.c
b/src/x11/fg_window_x11.c
index
a512b02
..
2736a59
100644
(file)
--- 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
*
*
* Window management methods for X11
*
@@
-40,6
+40,10
@@
#include "x11/fg_window_x11_glx.h"
#endif
#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
{
/* Motif window hints, only define needed ones */
typedef struct
{
@@
-178,6
+182,8
@@
void fgPlatformOpenWindow( SFG_Window* window, const char* title,
fgState.DisplayMode |= GLUT_DOUBLE ;
fghChooseConfig(&WINDOW_CONFIG);
fgState.DisplayMode &= ~GLUT_DOUBLE;
fgState.DisplayMode |= GLUT_DOUBLE ;
fghChooseConfig(&WINDOW_CONFIG);
fgState.DisplayMode &= ~GLUT_DOUBLE;
+
+ if( WINDOW_CONFIG ) goto done_retry;
}
#endif
}
#endif
@@
-186,8
+192,20
@@
void fgPlatformOpenWindow( SFG_Window* window, const char* title,
fgState.DisplayMode &= ~GLUT_MULTISAMPLE ;
fghChooseConfig(&WINDOW_CONFIG);
fgState.DisplayMode |= GLUT_MULTISAMPLE;
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" );
FREEGLUT_INTERNAL_ERROR_EXIT( WINDOW_CONFIG != NULL,
"FBConfig with necessary capabilities not found", "fgOpenWindow" );
@@
-352,17
+370,16
@@
void fgPlatformOpenWindow( SFG_Window* window, const char* title,
XSetWMProtocols( fgDisplay.pDisplay.Display, window->Window.Handle,
&fgDisplay.pDisplay.DeleteWindow, 1 );
XSetWMProtocols( fgDisplay.pDisplay.Display, window->Window.Handle,
&fgDisplay.pDisplay.DeleteWindow, 1 );
-
+
if (!isSubWindow && !window->IsMenu &&
((fgState.DisplayMode & GLUT_BORDERLESS) || (fgState.DisplayMode & GLUT_CAPTIONLESS)))
{
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
+ /* _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;
* 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;
- printf("%i\n",hints.decorations);
XChangeProperty(fgDisplay.pDisplay.Display, window->Window.Handle,
XInternAtom( fgDisplay.pDisplay.Display, "_MOTIF_WM_HINTS", False ),
XChangeProperty(fgDisplay.pDisplay.Display, window->Window.Handle,
XInternAtom( fgDisplay.pDisplay.Display, "_MOTIF_WM_HINTS", False ),
@@
-370,7
+387,7
@@
void fgPlatformOpenWindow( SFG_Window* window, const char* title,
PropModeReplace,
(unsigned char*) &hints,
sizeof(MotifWmHints) / sizeof(long));
PropModeReplace,
(unsigned char*) &hints,
sizeof(MotifWmHints) / sizeof(long));
- }
+ }
if (fgDisplay.pDisplay.NetWMSupported
if (fgDisplay.pDisplay.NetWMSupported