1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-27 04:28:52 -05:00

Clarify WNDPROC window pointer handling

This commit is contained in:
Camilla Berglund 2015-11-03 15:16:00 +01:00
parent 12903ee9b5
commit 1bf33a7402

View File

@ -255,16 +255,19 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam) WPARAM wParam, LPARAM lParam)
{ {
_GLFWwindow* window = (_GLFWwindow*) GetWindowLongPtrW(hWnd, 0); _GLFWwindow* window = (_GLFWwindow*) GetWindowLongPtrW(hWnd, 0);
if (!window)
switch (uMsg)
{ {
case WM_NCCREATE: if (uMsg == WM_NCCREATE)
{ {
CREATESTRUCTW* cs = (CREATESTRUCTW*) lParam; CREATESTRUCTW* cs = (CREATESTRUCTW*) lParam;
SetWindowLongPtrW(hWnd, 0, (LONG_PTR) cs->lpCreateParams); SetWindowLongPtrW(hWnd, 0, (LONG_PTR) cs->lpCreateParams);
break;
} }
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
}
switch (uMsg)
{
case WM_SETFOCUS: case WM_SETFOCUS:
{ {
if (window->cursorMode == GLFW_CURSOR_DISABLED) if (window->cursorMode == GLFW_CURSOR_DISABLED)
@ -529,9 +532,6 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
int xoff, yoff; int xoff, yoff;
MINMAXINFO* mmi = (MINMAXINFO*) lParam; MINMAXINFO* mmi = (MINMAXINFO*) lParam;
if (!window)
break;
getFullWindowSize(getWindowStyle(window), getWindowExStyle(window), getFullWindowSize(getWindowStyle(window), getWindowExStyle(window),
0, 0, &xoff, &yoff); 0, 0, &xoff, &yoff);