mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-23 10:48:51 -05:00
Cleanup.
This commit is contained in:
parent
a17dad4f44
commit
4883073b91
|
@ -84,19 +84,18 @@ int _glfwPlatformInit(void)
|
|||
changeToResourcesDirectory();
|
||||
#endif
|
||||
|
||||
_glfwInitTimer();
|
||||
|
||||
_glfwInitJoysticks();
|
||||
|
||||
if (!_glfwInitContextAPI())
|
||||
return GL_FALSE;
|
||||
|
||||
_glfw.ns.eventSource = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
|
||||
if (!_glfw.ns.eventSource)
|
||||
return GL_FALSE;
|
||||
|
||||
CGEventSourceSetLocalEventsSuppressionInterval(_glfw.ns.eventSource, 0.0);
|
||||
|
||||
if (!_glfwInitContextAPI())
|
||||
return GL_FALSE;
|
||||
|
||||
_glfwInitTimer();
|
||||
_glfwInitJoysticks();
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
@ -121,7 +120,6 @@ void _glfwPlatformTerminate(void)
|
|||
free(_glfw.ns.clipboardString);
|
||||
|
||||
_glfwTerminateJoysticks();
|
||||
|
||||
_glfwTerminateContextAPI();
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ static GLboolean initLibraries(void)
|
|||
|
||||
// Unload used libraries (DLLs)
|
||||
//
|
||||
static void freeLibraries(void)
|
||||
static void terminateLibraries(void)
|
||||
{
|
||||
#ifndef _GLFW_NO_DLOAD_WINMM
|
||||
if (_glfw.win32.winmm.instance != NULL)
|
||||
|
@ -204,7 +204,6 @@ int _glfwPlatformInit(void)
|
|||
return GL_FALSE;
|
||||
|
||||
_glfwInitTimer();
|
||||
|
||||
_glfwInitJoysticks();
|
||||
|
||||
return GL_TRUE;
|
||||
|
@ -218,18 +217,16 @@ void _glfwPlatformTerminate(void)
|
|||
_glfw.win32.classAtom = 0;
|
||||
}
|
||||
|
||||
free(_glfw.win32.clipboardString);
|
||||
|
||||
_glfwTerminateContextAPI();
|
||||
|
||||
_glfwTerminateJoysticks();
|
||||
|
||||
freeLibraries();
|
||||
|
||||
// Restore previous FOREGROUNDLOCKTIMEOUT system setting
|
||||
// Restore previous foreground lock timeout system setting
|
||||
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0,
|
||||
UIntToPtr(_glfw.win32.foregroundLockTimeout),
|
||||
SPIF_SENDCHANGE);
|
||||
|
||||
free(_glfw.win32.clipboardString);
|
||||
|
||||
_glfwTerminateJoysticks();
|
||||
_glfwTerminateContextAPI();
|
||||
terminateLibraries();
|
||||
}
|
||||
|
||||
const char* _glfwPlatformGetVersionString(void)
|
||||
|
|
|
@ -420,21 +420,10 @@ static void detectEWMH(void)
|
|||
|
||||
// Initialize X11 display and look for supported X11 extensions
|
||||
//
|
||||
static GLboolean initDisplay(void)
|
||||
static GLboolean initExtensions(void)
|
||||
{
|
||||
Bool supported;
|
||||
|
||||
_glfw.x11.display = XOpenDisplay(NULL);
|
||||
if (!_glfw.x11.display)
|
||||
{
|
||||
_glfwInputError(GLFW_API_UNAVAILABLE, "X11: Failed to open X display");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
_glfw.x11.screen = DefaultScreen(_glfw.x11.display);
|
||||
_glfw.x11.root = RootWindow(_glfw.x11.display, _glfw.x11.screen);
|
||||
_glfw.x11.context = XUniqueContext();
|
||||
|
||||
// Find or create window manager atoms
|
||||
_glfw.x11.WM_STATE = XInternAtom(_glfw.x11.display, "WM_STATE", False);
|
||||
_glfw.x11.WM_DELETE_WINDOW = XInternAtom(_glfw.x11.display,
|
||||
|
@ -602,20 +591,28 @@ int _glfwPlatformInit(void)
|
|||
{
|
||||
XInitThreads();
|
||||
|
||||
if (!initDisplay())
|
||||
_glfw.x11.display = XOpenDisplay(NULL);
|
||||
if (!_glfw.x11.display)
|
||||
{
|
||||
_glfwInputError(GLFW_API_UNAVAILABLE, "X11: Failed to open X display");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
_glfwInitGammaRamp();
|
||||
_glfw.x11.screen = DefaultScreen(_glfw.x11.display);
|
||||
_glfw.x11.root = RootWindow(_glfw.x11.display, _glfw.x11.screen);
|
||||
_glfw.x11.context = XUniqueContext();
|
||||
|
||||
if (!_glfwInitContextAPI())
|
||||
if (!initExtensions())
|
||||
return GL_FALSE;
|
||||
|
||||
_glfw.x11.cursor = createNULLCursor();
|
||||
|
||||
if (!_glfwInitJoysticks())
|
||||
if (!_glfwInitContextAPI())
|
||||
return GL_FALSE;
|
||||
|
||||
_glfwInitTimer();
|
||||
_glfwInitJoysticks();
|
||||
_glfwInitGammaRamp();
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
@ -631,9 +628,7 @@ void _glfwPlatformTerminate(void)
|
|||
free(_glfw.x11.selection.string);
|
||||
|
||||
_glfwTerminateJoysticks();
|
||||
|
||||
_glfwTerminateContextAPI();
|
||||
|
||||
terminateDisplay();
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ static void pollJoystickEvents(void)
|
|||
|
||||
// Initialize joystick interface
|
||||
//
|
||||
int _glfwInitJoysticks(void)
|
||||
void _glfwInitJoysticks(void)
|
||||
{
|
||||
#ifdef __linux__
|
||||
int i, joy = 0;
|
||||
|
@ -174,7 +174,7 @@ int _glfwInitJoysticks(void)
|
|||
if (regcomp(®ex, "^js[0-9]\\+$", 0) != 0)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to compile regex");
|
||||
return GL_FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(dirs) / sizeof(dirs[0]); i++)
|
||||
|
@ -203,8 +203,6 @@ int _glfwInitJoysticks(void)
|
|||
|
||||
regfree(®ex);
|
||||
#endif // __linux__
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
// Close all opened joystick handles
|
||||
|
|
|
@ -238,7 +238,7 @@ void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
|
|||
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
|
||||
|
||||
// Joystick input
|
||||
int _glfwInitJoysticks(void);
|
||||
void _glfwInitJoysticks(void);
|
||||
void _glfwTerminateJoysticks(void);
|
||||
|
||||
// Unicode support
|
||||
|
|
Loading…
Reference in New Issue
Block a user