Skip to content

Commit d1ae47b

Browse files
authored
Fixed a non-resizable window issue[#428] (#429)
Non-resizable window appears with white borders when they are created and moved. I found that the reason is that the code does not notify the system when the border style of the window's frame is changed.
1 parent 663dcdb commit d1ae47b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/host/windows/window.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,23 @@ namespace cycfi::elements
4343
void disable_minimize(HWND hwnd)
4444
{
4545
SetWindowLongW(hwnd, GWL_STYLE,
46-
GetWindowLongW(hwnd, GWL_STYLE) & ~WS_MINIMIZEBOX);
46+
GetWindowLongW(hwnd, GWL_STYLE) & ~WS_MINIMIZEBOX);
47+
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);
4748
}
4849

50+
[[maybe_unused]]
4951
void disable_maximize(HWND hwnd)
5052
{
5153
SetWindowLongW(hwnd, GWL_STYLE,
52-
GetWindowLongW(hwnd, GWL_STYLE) & ~WS_MAXIMIZEBOX);
54+
GetWindowLongW(hwnd, GWL_STYLE) & ~WS_MAXIMIZEBOX);
55+
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);
5356
}
5457

5558
void disable_resize(HWND hwnd)
5659
{
5760
SetWindowLongW(hwnd, GWL_STYLE,
58-
GetWindowLongW(hwnd, GWL_STYLE) & ~WS_SIZEBOX);
59-
disable_maximize(hwnd);
61+
GetWindowLongW(hwnd, GWL_STYLE) & ~WS_SIZEBOX & ~WS_MAXIMIZEBOX);
62+
SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);
6063
}
6164

6265
LRESULT on_close(window* win)

0 commit comments

Comments
 (0)