From 1ffd8f667f40dd971fd79a5824399e0acecc8e59 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 16 Apr 2013 23:19:58 +0200 Subject: [PATCH] Cleanup. --- src/cocoa_init.m | 2 -- src/cocoa_joystick.m | 9 --------- src/cocoa_window.m | 2 -- src/egl_context.c | 2 -- src/win32_window.c | 30 +++++++++++++----------------- 5 files changed, 13 insertions(+), 32 deletions(-) diff --git a/src/cocoa_init.m b/src/cocoa_init.m index b17d572e..2491e7eb 100644 --- a/src/cocoa_init.m +++ b/src/cocoa_init.m @@ -111,8 +111,6 @@ int _glfwPlatformInit(void) void _glfwPlatformTerminate(void) { - // TODO: Probably other cleanup - if (_glfw.ns.eventSource) { CFRelease(_glfw.ns.eventSource); diff --git a/src/cocoa_joystick.m b/src/cocoa_joystick.m index 8540e6db..c218cc0d 100644 --- a/src/cocoa_joystick.m +++ b/src/cocoa_joystick.m @@ -444,10 +444,7 @@ void _glfwTerminateJoysticks(void) int _glfwPlatformGetJoystickParam(int joy, int param) { if (!_glfw.ns.joysticks[joy].present) - { - // TODO: Figure out if this is an error return GL_FALSE; - } switch (param) { @@ -478,10 +475,7 @@ int _glfwPlatformGetJoystickAxes(int joy, float* axes, int numaxes) _GLFWjoy joystick = _glfw.ns.joysticks[joy]; if (!joystick.present) - { - // TODO: Figure out if this is an error return 0; - } numaxes = numaxes < joystick.numAxes ? numaxes : joystick.numAxes; @@ -518,10 +512,7 @@ int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons, _GLFWjoy joystick = _glfw.ns.joysticks[joy]; if (!joystick.present) - { - // TODO: Figure out if this is an error return 0; - } // Update joystick state pollJoystickEvents(); diff --git a/src/cocoa_window.m b/src/cocoa_window.m index ebaf9396..6e781723 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -794,8 +794,6 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window) [window->ns.object close]; window->ns.object = nil; - - // TODO: Probably more cleanup } void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char *title) diff --git a/src/egl_context.c b/src/egl_context.c index 6e362cea..b1abe6bc 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -345,8 +345,6 @@ int _glfwCreateContext(_GLFWwindow* window, if (window->egl.context == EGL_NO_CONTEXT) { - // TODO: Handle all the various error codes here - _glfwInputError(GLFW_PLATFORM_ERROR, "EGL: Failed to create context: %s", getErrorString(eglGetError())); diff --git a/src/win32_window.c b/src/win32_window.c index d0fca337..504d3348 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -671,11 +671,8 @@ static void getFullWindowSize(_GLFWwindow* window, int* fullWidth, int* fullHeight) { RECT rect = { 0, 0, clientWidth, clientHeight }; - - // Adjust according to window styles - AdjustWindowRectEx(&rect, window->win32.dwStyle, FALSE, window->win32.dwExStyle); - - // Calculate width and height of full window + AdjustWindowRectEx(&rect, window->win32.dwStyle, + FALSE, window->win32.dwExStyle); *fullWidth = rect.right - rect.left; *fullHeight = rect.bottom - rect.top; } @@ -688,21 +685,21 @@ static ATOM registerWindowClass(void) ATOM classAtom; // Set window class parameters - wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // Redraw on... - wc.lpfnWndProc = (WNDPROC) windowProc; // Message handler - wc.cbClsExtra = 0; // No extra class data - wc.cbWndExtra = sizeof(void*) + sizeof(int); // Make room for one pointer - wc.hInstance = GetModuleHandle(NULL); // Set instance - wc.hCursor = LoadCursor(NULL, IDC_ARROW); // Load arrow pointer - wc.hbrBackground = NULL; // No background - wc.lpszMenuName = NULL; // No menu - wc.lpszClassName = _GLFW_WNDCLASSNAME; // Set class name + wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; + wc.lpfnWndProc = (WNDPROC) windowProc; + wc.cbClsExtra = 0; // No extra class data + wc.cbWndExtra = sizeof(void*) + sizeof(int); // Make room for one pointer + wc.hInstance = GetModuleHandle(NULL); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = NULL; // No background + wc.lpszMenuName = NULL; // No menu + wc.lpszClassName = _GLFW_WNDCLASSNAME; // Load user-provided icon if available wc.hIcon = LoadIcon(GetModuleHandle(NULL), L"GLFW_ICON"); if (!wc.hIcon) { - // User-provided icon not found; load default icon + // No user-provided icon found, load default icon wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); } @@ -735,7 +732,6 @@ static int createWindow(_GLFWwindow* window, window->win32.dwStyle |= WS_POPUP; _glfwPlatformGetMonitorPos(wndconfig->monitor, &xpos, &ypos); - fullWidth = wndconfig->width; fullHeight = wndconfig->height; } @@ -782,7 +778,7 @@ static int createWindow(_GLFWwindow* window, NULL, // No parent window NULL, // No window menu GetModuleHandle(NULL), - window); // Pass GLFW window to WM_CREATE + window); // Pass object to WM_CREATE free(wideTitle);