diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2024-11-09 15:35:06 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2024-11-09 15:35:06 +0100 |
| commit | 018c3b19f5644a68cc6fc22a1a3bc6f616b8a1ac (patch) | |
| tree | 8c0e61446f542de41efdbc406237879f3c900ae8 /src/drivers/WinAPI | |
| parent | 85c23539fde5c81290c7cfe653f78982ed389707 (diff) | |
Fix Windows: fullscreen_off does not correctly preserve window size (#1116)
Diffstat (limited to 'src/drivers/WinAPI')
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx index b930719a6..08804e705 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx @@ -577,24 +577,32 @@ void Fl_WinAPI_Window_Driver::fullscreen_on() { } +static void delayed_maximize(Fl_Window *win){ + Fl::remove_check((Fl_Timeout_Handler)delayed_maximize, win); + win->un_maximize(); + win->maximize(); +} + + void Fl_WinAPI_Window_Driver::fullscreen_off(int X, int Y, int W, int H) { pWindow->_clear_fullscreen(); DWORD style = GetWindowLong(fl_xid(pWindow), GWL_STYLE); + if (pWindow->border()) style |= WS_THICKFRAME | WS_SYSMENU | WS_MAXIMIZEBOX | WS_CAPTION; // Remove the xid temporarily so that Fl_WinAPI_Window_Driver::fake_X_wm() behaves like it // does in Fl_WinAPI_Window_Driver::makeWindow(). HWND xid = fl_xid(pWindow); Fl_X::flx(pWindow)->xid = 0; int wx, wy, bt, bx, by; - switch (fake_X_wm(wx, wy, bt, bx, by)) { + switch (fake_X_wm(wx, wy, bt, bx, by, style)) { case 0: break; case 1: style |= WS_CAPTION; break; case 2: - if (border()) { + /*if (border()) { style |= WS_THICKFRAME | WS_CAPTION; - } + }*/ break; } Fl_X::flx(pWindow)->xid = (fl_uintptr_t)xid; @@ -610,10 +618,10 @@ void Fl_WinAPI_Window_Driver::fullscreen_off(int X, int Y, int W, int H) { scaledW += bx*2; scaledH += by*2+bt; SetWindowLong(fl_xid(pWindow), GWL_STYLE, style); - if (pWindow->maximize_active()) return this->maximize(); SetWindowPos(fl_xid(pWindow), 0, scaledX, scaledY, scaledW, scaledH, SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED); Fl::handle(FL_FULLSCREEN, pWindow); + if (pWindow->maximize_active()) Fl::add_check((Fl_Timeout_Handler)delayed_maximize, pWindow); } |
