Skip to content

Commit 7228a41

Browse files
committed
Fixed issue of Windows not accounting for window frame sizes
1 parent 34423e3 commit 7228a41

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.4.0-beta.2
2+
3+
* Fixed an issue with Windows not accounting for the frames when creating a window.
4+
15
# 0.4.0-beta
26

37
* Fixed a bug that caused x11 to lock up until new event is generated.

source/iota/window/oswindow.d

+6-3
Original file line numberDiff line numberDiff line change
@@ -354,14 +354,17 @@ public class OSWindow {
354354
if (x <= 0) x = CW_USEDEFAULT;
355355
if (y <= 0) y = CW_USEDEFAULT;
356356
if (w <= 0) w = CW_USEDEFAULT;
357-
else if ((flags & WindowCfgFlags.NoDecorations) == 0) w += GetSystemMetrics(SM_CXSIZEFRAME);
357+
// else if ((flags & WindowCfgFlags.NoDecorations) == 0) w += GetSystemMetrics(SM_CXSIZEFRAME);
358358
if (h <= 0) h = CW_USEDEFAULT;
359-
else if ((flags & WindowCfgFlags.NoDecorations) == 0) h += GetSystemMetrics(SM_CYSIZEFRAME);
359+
// else if ((flags & WindowCfgFlags.NoDecorations) == 0) h += GetSystemMetrics(SM_CYSIZEFRAME);
360+
RECT windowRect = RECT(0,0,w,h);
361+
AdjustWindowRect(&windowRect, dwStyle, FALSE);
360362
windowname = toUTF16z(title);
361363
HWND parentHndl = null;
362364
if (parent !is null)
363365
parentHndl = parent.getHandle();
364-
windowHandle = CreateWindowW(classname, windowname, dwStyle, x, y, w, h, parentHndl, null, mainInst, null);
366+
windowHandle = CreateWindowW(classname, windowname, dwStyle, x, y, windowRect.right - windowRect.left,
367+
windowRect.bottom - windowRect.top, parentHndl, null, mainInst, null);
365368
if (!windowHandle) {
366369
auto errorCode = GetLastError();
367370
throw new WindowCreationException("Failed to create window!", errorCode);

0 commit comments

Comments
 (0)