mirror of
https://github.com/raysan5/raylib.git
synced 2026-04-09 16:59:09 -04:00
REVIEWED: Window messages WM_SIZING, WM_SIZE, WM_WINDOWPOSCHANGED #5720
This commit is contained in:
@ -1063,14 +1063,14 @@ Vector2 GetMonitorPosition(int monitor)
|
|||||||
// Get selected monitor width (currently used by monitor)
|
// Get selected monitor width (currently used by monitor)
|
||||||
int GetMonitorWidth(int monitor)
|
int GetMonitorWidth(int monitor)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "GetMonitorWidth not implemented");
|
//TRACELOG(LOG_WARNING, "GetMonitorWidth not implemented");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get selected monitor height (currently used by monitor)
|
// Get selected monitor height (currently used by monitor)
|
||||||
int GetMonitorHeight(int monitor)
|
int GetMonitorHeight(int monitor)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "GetMonitorHeight not implemented");
|
//TRACELOG(LOG_WARNING, "GetMonitorHeight not implemented");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1105,7 +1105,7 @@ const char *GetMonitorName(int monitor)
|
|||||||
// Get window position XY on monitor
|
// Get window position XY on monitor
|
||||||
Vector2 GetWindowPosition(void)
|
Vector2 GetWindowPosition(void)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "GetWindowPosition not implemented");
|
//TRACELOG(LOG_WARNING, "GetWindowPosition not implemented");
|
||||||
return (Vector2){ 0, 0 };
|
return (Vector2){ 0, 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1760,13 +1760,31 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
|||||||
memset(CORE.Input.Keyboard.previousKeyState, 0, sizeof(CORE.Input.Keyboard.previousKeyState));
|
memset(CORE.Input.Keyboard.previousKeyState, 0, sizeof(CORE.Input.Keyboard.previousKeyState));
|
||||||
memset(CORE.Input.Keyboard.currentKeyState, 0, sizeof(CORE.Input.Keyboard.currentKeyState));
|
memset(CORE.Input.Keyboard.currentKeyState, 0, sizeof(CORE.Input.Keyboard.currentKeyState));
|
||||||
} break;
|
} break;
|
||||||
case WM_SIZING:
|
case WM_SIZING: // Sent to a window that the user is resizing
|
||||||
{
|
{
|
||||||
if (!(CORE.Window.flags & FLAG_WINDOW_RESIZABLE))
|
if (CORE.Window.flags & FLAG_WINDOW_RESIZABLE)
|
||||||
TRACELOG(LOG_WARNING, "WIN32: WINDOW: Trying to resize a non-resizable window");
|
{
|
||||||
|
//HandleWindowResize(hwnd, &platform.appScreenWidth, &platform.appScreenHeight);
|
||||||
|
}
|
||||||
|
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
} break;
|
} break;
|
||||||
|
case WM_SIZE:
|
||||||
|
{
|
||||||
|
// WARNING: Don't trust the docs, they say this message can not be obtained if not calling DefWindowProc()
|
||||||
|
// in response to WM_WINDOWPOSCHANGED but looks like when a window is created,
|
||||||
|
// this message can be obtained without getting WM_WINDOWPOSCHANGED
|
||||||
|
|
||||||
|
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||||
|
// WARNING: Waiting two frames before resizing because software-renderer backend is initilized with swInit() later
|
||||||
|
// than InitPlatform(), that triggers WM_SIZE, so avoid crashing
|
||||||
|
if (CORE.Time.frameCounter > 2) HandleWindowResize(hwnd, &platform.appScreenWidth, &platform.appScreenHeight);
|
||||||
|
#else
|
||||||
|
// NOTE: This message is only triggered on window creation
|
||||||
|
HandleWindowResize(hwnd, &platform.appScreenWidth, &platform.appScreenHeight);
|
||||||
|
#endif
|
||||||
|
result = 0; // If an application processes WM_SIZE message, it should return zero
|
||||||
|
} break;
|
||||||
case WM_GETMINMAXINFO:
|
case WM_GETMINMAXINFO:
|
||||||
{
|
{
|
||||||
DWORD style = MakeWindowStyle(platform.desiredFlags);
|
DWORD style = MakeWindowStyle(platform.desiredFlags);
|
||||||
@ -1865,19 +1883,13 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
|||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case WM_SIZE:
|
//case WM_MOVE: break;
|
||||||
{
|
|
||||||
// WARNING: Don't trust the docs, they say this message can not be obtained if not calling DefWindowProc()
|
|
||||||
// in response to WM_WINDOWPOSCHANGED but looks like when a window is created,
|
|
||||||
// this message can be obtained without getting WM_WINDOWPOSCHANGED
|
|
||||||
// WARNING: This call fails for Software-Renderer backend
|
|
||||||
//HandleWindowResize(hwnd, &platform.appScreenWidth, &platform.appScreenHeight);
|
|
||||||
} break;
|
|
||||||
//case WM_MOVE
|
|
||||||
case WM_WINDOWPOSCHANGED:
|
case WM_WINDOWPOSCHANGED:
|
||||||
{
|
{
|
||||||
WINDOWPOS *pos = (WINDOWPOS*)lparam;
|
WINDOWPOS *pos = (WINDOWPOS*)lparam;
|
||||||
if (!(pos->flags & SWP_NOSIZE)) HandleWindowResize(hwnd, &platform.appScreenWidth, &platform.appScreenHeight);
|
if (!(pos->flags & SWP_NOSIZE)) HandleWindowResize(hwnd, &platform.appScreenWidth, &platform.appScreenHeight);
|
||||||
|
|
||||||
|
DefWindowProc(hwnd, msg, wparam, lparam);
|
||||||
} break;
|
} break;
|
||||||
case WM_GETDPISCALEDSIZE:
|
case WM_GETDPISCALEDSIZE:
|
||||||
{
|
{
|
||||||
@ -2092,9 +2104,9 @@ static void HandleWindowResize(HWND hwnd, int *width, int *height)
|
|||||||
CORE.Window.screenScale = MatrixScale( (float)CORE.Window.render.width/CORE.Window.screen.width,
|
CORE.Window.screenScale = MatrixScale( (float)CORE.Window.render.width/CORE.Window.screen.width,
|
||||||
(float)CORE.Window.render.height/CORE.Window.screen.height, 1.0f);
|
(float)CORE.Window.render.height/CORE.Window.screen.height, 1.0f);
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
#if defined(GRAPHICS_API_OPENGL_SOFTWARE)
|
||||||
swResize(clientSize.cx, clientSize.cy);
|
swResize(clientSize.cx, clientSize.cy);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update window style
|
// Update window style
|
||||||
|
|||||||
Reference in New Issue
Block a user