fix window size on windows

This commit is contained in:
NishiOwO 2025-03-30 11:14:20 +09:00
parent 5710975dfd
commit 304aa97bea
No known key found for this signature in database
GPG Key ID: 27EF69B208EB9343

View File

@ -78,6 +78,7 @@ void _nb_draw_create(nb_draw_t** pdraw) {
PFNWGLSWAPINTERVALPROC wglSwapIntervalEXT;
RECT rect;
int fmt;
DWORD style;
draw->instance = (HINSTANCE)GetModuleHandle(NULL);
if(draw->instance == NULL) {
nb_function_log("Failed to get the instance", "");
@ -113,6 +114,11 @@ void _nb_draw_create(nb_draw_t** pdraw) {
return;
}
SetRect(&rect, 0, 0, draw->width, draw->height);
style = (DWORD)GetWindowLongPtr(draw->window, GWL_STYLE);
AdjustWindowRect(&rect, style, FALSE);
SetWindowPos(draw->window, NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOMOVE);
SetWindowLongPtr(draw->window, GWLP_USERDATA, (LONG_PTR)draw);
GetClientRect(draw->window, &rect);