fix: build (#12968)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2025-09-19 17:20:53 +08:00
committed by GitHub
parent 2d1c94f1ef
commit b11a8dfe54
2 changed files with 5 additions and 13 deletions

View File

@@ -21,7 +21,10 @@ namespace Win32Desktop
hMonitor = MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY); hMonitor = MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY);
RECT workAreaRect; RECT workAreaRect;
bool haveWorkAreaRect = false; workAreaRect.left = 0;
workAreaRect.top = 0;
workAreaRect.right = 1280;
workAreaRect.bottom = 1024 - 40; // default Windows 10 task bar height
if (hMonitor != NULL) if (hMonitor != NULL)
{ {
@@ -32,20 +35,9 @@ namespace Win32Desktop
if (GetMonitorInfoW(hMonitor, &monitorInfo)) if (GetMonitorInfoW(hMonitor, &monitorInfo))
{ {
workAreaRect = monitorInfo.rcWork; workAreaRect = monitorInfo.rcWork;
haveWorkAreaRect = true;
} }
} }
if (!haveWorkAreaRect)
{
// I don't think this is possible, but just in case, some
// reasonably sane fallbacks.
workAreaRect.left = 0;
workAreaRect.top = 0;
workAreaRect.right = 1280;
workAreaRect.bottom = 1024 - 40; // default Windows 10 task bar height
}
origin.x = workAreaRect.left; origin.x = workAreaRect.left;
origin.y = workAreaRect.top; origin.y = workAreaRect.top;

View File

@@ -9,4 +9,4 @@ namespace Win32Desktop
void FitToWorkArea(Win32Window::Point& origin, Win32Window::Size& size); void FitToWorkArea(Win32Window::Point& origin, Win32Window::Size& size);
} }
#endif // RUNNER_WIN32_DESKTOP_H_ #endif // RUNNER_WIN32_DESKTOP_H_