Skip to content

Commit

Permalink
Fixed issue of Windows not accounting for window frame sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
ZILtoid1991 committed Nov 14, 2024
1 parent 34423e3 commit 7228a41
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.4.0-beta.2

* Fixed an issue with Windows not accounting for the frames when creating a window.

# 0.4.0-beta

* Fixed a bug that caused x11 to lock up until new event is generated.
Expand Down
9 changes: 6 additions & 3 deletions source/iota/window/oswindow.d
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,17 @@ public class OSWindow {
if (x <= 0) x = CW_USEDEFAULT;
if (y <= 0) y = CW_USEDEFAULT;
if (w <= 0) w = CW_USEDEFAULT;
else if ((flags & WindowCfgFlags.NoDecorations) == 0) w += GetSystemMetrics(SM_CXSIZEFRAME);
// else if ((flags & WindowCfgFlags.NoDecorations) == 0) w += GetSystemMetrics(SM_CXSIZEFRAME);
if (h <= 0) h = CW_USEDEFAULT;
else if ((flags & WindowCfgFlags.NoDecorations) == 0) h += GetSystemMetrics(SM_CYSIZEFRAME);
// else if ((flags & WindowCfgFlags.NoDecorations) == 0) h += GetSystemMetrics(SM_CYSIZEFRAME);
RECT windowRect = RECT(0,0,w,h);
AdjustWindowRect(&windowRect, dwStyle, FALSE);
windowname = toUTF16z(title);
HWND parentHndl = null;
if (parent !is null)
parentHndl = parent.getHandle();
windowHandle = CreateWindowW(classname, windowname, dwStyle, x, y, w, h, parentHndl, null, mainInst, null);
windowHandle = CreateWindowW(classname, windowname, dwStyle, x, y, windowRect.right - windowRect.left,
windowRect.bottom - windowRect.top, parentHndl, null, mainInst, null);
if (!windowHandle) {
auto errorCode = GetLastError();
throw new WindowCreationException("Failed to create window!", errorCode);
Expand Down

0 comments on commit 7228a41

Please sign in to comment.