Skip to content

Commit e534f14

Browse files
authored
Fix window width calculation by adding wOffset (#5457)
1 parent 9b183e0 commit e534f14

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/external/RGFW.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6522,8 +6522,8 @@ LRESULT CALLBACK WndProcW(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
65226522
if (win->src.aspectRatio.w != 0 && win->src.aspectRatio.h != 0) {
65236523
double aspectRatio = (double)win->src.aspectRatio.w / win->src.aspectRatio.h;
65246524

6525-
int width = windowRect.right - windowRect.left;
6526-
int height = windowRect.bottom - windowRect.top;
6525+
int width = (windowRect.right - windowRect.left) - win->src.wOffset;
6526+
int height = (windowRect.bottom - windowRect.top) - win->src.hOffset;
65276527
int newHeight = (int)(width / aspectRatio);
65286528
int newWidth = (int)(height * aspectRatio);
65296529

@@ -6968,6 +6968,7 @@ RGFW_window* RGFW_createWindowPtr(const char* name, RGFW_rect rect, RGFW_windowF
69686968
DestroyWindow(dummyWin);
69696969

69706970
win->src.hOffset = (u32)(windowRect.bottom - windowRect.top) - (u32)(clientRect.bottom - clientRect.top);
6971+
win->src.wOffset = (u32)(windowRect.right - windowRect.left) - (u32)(clientRect.right - clientRect.left);
69716972
win->src.window = CreateWindowW(Class.lpszClassName, (wchar_t*)wide_name, window_style, win->r.x, win->r.y, win->r.w, win->r.h + (i32)win->src.hOffset, 0, 0, inh, 0);
69726973
SetPropW(win->src.window, L"RGFW", win);
69736974
RGFW_window_resize(win, RGFW_AREA(win->r.w, win->r.h)); /* so WM_GETMINMAXINFO gets called again */

0 commit comments

Comments
 (0)