ソースを参照

Win32: Fix maximization of undecorated windows

Fixes #899.
Camilla Löwy 7 年 前
コミット
80d181f12d
2 ファイル変更17 行追加0 行削除
  1. 1 0
      README.md
  2. 16 0
      src/win32_window.c

+ 1 - 0
README.md

@@ -200,6 +200,7 @@ information on what to include when reporting a bug.
 - [Win32] Bugfix: Disabled cursor mode prevented use of caption buttons
                   (#650,#1071)
 - [Win32] Bugfix: Returned key names did not match other platforms (#943)
+- [Win32] Bugfix: Undecorated windows did not maximize to workarea (#899)
 - [X11] Moved to XI2 `XI_RawMotion` for disable cursor mode motion input (#125)
 - [X11] Replaced `_GLFW_HAS_XF86VM` compile-time option with dynamic loading
 - [X11] Bugfix: `glfwGetVideoMode` would segfault on Cygwin/X

+ 16 - 0
src/win32_window.c

@@ -951,6 +951,22 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
                 mmi->ptMaxTrackSize.y = window->maxheight + yoff;
             }
 
+            if (!window->decorated)
+            {
+                MONITORINFO mi;
+                const HMONITOR mh = MonitorFromWindow(window->win32.handle,
+                                                      MONITOR_DEFAULTTONEAREST);
+
+                ZeroMemory(&mi, sizeof(mi));
+                mi.cbSize = sizeof(mi);
+                GetMonitorInfo(mh, &mi);
+
+                mmi->ptMaxPosition.x = mi.rcWork.left - mi.rcMonitor.left;
+                mmi->ptMaxPosition.y = mi.rcWork.top - mi.rcMonitor.top;
+                mmi->ptMaxSize.x = mi.rcWork.right - mi.rcWork.left;
+                mmi->ptMaxSize.y = mi.rcWork.bottom - mi.rcWork.top;
+            }
+
             return 0;
         }