"fghGetWindowProperty");
if (type_returned != type)
- {
- number_of_elements = 0;
- }
+ {
+ number_of_elements = 0;
+ }
return number_of_elements;
}
XA_WINDOW,
(unsigned char **) window_ptr_1);
if (number_of_windows == 1)
- {
- Window ** window_ptr_2;
-
- window_ptr_2 = malloc(sizeof(Window *));
+ {
+ Window ** window_ptr_2;
- /* Check that the window has the same property set to the same value. */
- number_of_windows = fghGetWindowProperty(**window_ptr_1,
- wm_check,
- XA_WINDOW,
- (unsigned char **) window_ptr_2);
- if ((number_of_windows == 1) && (**window_ptr_1 == **window_ptr_2))
- {
- /* NET WM compliant */
- net_wm_supported = 1;
- }
+ window_ptr_2 = malloc(sizeof(Window *));
- XFree(*window_ptr_2);
- free(window_ptr_2);
+ /* Check that the window has the same property set to the same value. */
+ number_of_windows = fghGetWindowProperty(**window_ptr_1,
+ wm_check,
+ XA_WINDOW,
+ (unsigned char **) window_ptr_2);
+ if ((number_of_windows == 1) && (**window_ptr_1 == **window_ptr_2))
+ {
+ /* NET WM compliant */
+ net_wm_supported = 1;
}
- XFree(*window_ptr_1);
- free(window_ptr_1);
+ XFree(*window_ptr_2);
+ free(window_ptr_2);
+ }
+
+ XFree(*window_ptr_1);
+ free(window_ptr_1);
- return net_wm_supported;
+ return net_wm_supported;
}
/* Check if "hint" is present in "property" for "window". */
if( fgDisplay.pDisplay.Display == NULL )
fgError( "failed to open display '%s'", XDisplayName( displayName ) );
+ if ( fgState.XSyncSwitch )
+ XSynchronize(fgDisplay.pDisplay.Display, True);
+
#ifdef EGL_VERSION_1_0
fghPlatformInitializeEGL();
#else
if( !glXQueryExtension( fgDisplay.pDisplay.Display, NULL, NULL ) )
fgError( "OpenGL GLX extension not supported by display '%s'",
XDisplayName( displayName ) );
+
+ /* This forces AMD Catalyst drivers to initialize and register a shutdown
+ * function, which must be done before our own call to atexit to prevent
+ * a crash if glutMainLoop is not called or is not exited cleanly.
+ * (see bug #206)
+ */
+ glXQueryExtensionsString( fgDisplay.pDisplay.Display,
+ DefaultScreen( fgDisplay.pDisplay.Display ));
#endif
fgDisplay.pDisplay.Screen = DefaultScreen( fgDisplay.pDisplay.Display );
/* Create the state and full screen atoms */
fgDisplay.pDisplay.State = None;
fgDisplay.pDisplay.StateFullScreen = None;
+ fgDisplay.pDisplay.NetWMPid = None;
+ fgDisplay.pDisplay.ClientMachine = None;
- if (fghNetWMSupported())
+ fgDisplay.pDisplay.NetWMSupported = fghNetWMSupported();
+
+ if (fgDisplay.pDisplay.NetWMSupported)
{
const Atom supported = fghGetAtom("_NET_SUPPORTED");
const Atom state = fghGetAtom("_NET_WM_STATE");
fgDisplay.pDisplay.StateFullScreen = full_screen;
}
}
+
+ fgDisplay.pDisplay.NetWMPid = fghGetAtom("_NET_WM_PID");
+ fgDisplay.pDisplay.ClientMachine = fghGetAtom("WM_CLIENT_MACHINE");
}
+ /* Get start time */
+ fgState.Time = fgSystemTime();
+
fgState.Initialised = GL_TRUE;