Browse Source

Fixed window too large when maximized.

Signed-off-by: weisj <weisj@arcor.de>
pull/16/head v1.3.1.5
weisj 5 years ago
parent
commit
8dd459bb70
  1. 22
      src/jniplatform/cpp/JNIDecorations.cpp
  2. BIN
      src/main/resources/com/github/weisj/darklaf/platform/windows/x64/jniplatform.dll
  3. BIN
      src/main/resources/com/github/weisj/darklaf/platform/windows/x86/jniplatform.dll

22
src/jniplatform/cpp/JNIDecorations.cpp

@ -106,13 +106,23 @@ LRESULT CALLBACK WindowWrapper::WindowProc(_In_ HWND hwnd, _In_ UINT uMsg, _In_
} }
else if (uMsg == WM_GETMINMAXINFO) else if (uMsg == WM_GETMINMAXINFO)
{ {
HMONITOR hPrimaryMonitor = MonitorFromWindow(nullptr, MONITOR_DEFAULTTOPRIMARY);
HMONITOR hTargetMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
MONITORINFO primaryMonitorInfo{sizeof(MONITORINFO)};
MONITORINFO targetMonitorInfo{sizeof(MONITORINFO)};
GetMonitorInfo(hPrimaryMonitor, &primaryMonitorInfo);
GetMonitorInfo(hTargetMonitor, &targetMonitorInfo);
MINMAXINFO *min_max_info = reinterpret_cast<MINMAXINFO *>(lParam); MINMAXINFO *min_max_info = reinterpret_cast<MINMAXINFO *>(lParam);
RECT max_rect; RECT max_rect = primaryMonitorInfo.rcWork;
SystemParametersInfo(SPI_GETWORKAREA, 0, &max_rect, 0); RECT target_rect = targetMonitorInfo.rcWork;
min_max_info->ptMaxSize.x = max_rect.right - max_rect.left; int indent = 2;
min_max_info->ptMaxSize.y = max_rect.bottom - max_rect.top; min_max_info->ptMaxSize.x = target_rect.right - target_rect.left - 2 * indent;
min_max_info->ptMaxPosition.x = max_rect.left; min_max_info->ptMaxSize.y = target_rect.bottom - target_rect.top - 2 + indent;
min_max_info->ptMaxPosition.y = max_rect.top; min_max_info->ptMaxPosition.x = max_rect.left + indent;
min_max_info->ptMaxPosition.y = max_rect.top + indent;
return 0; return 0;
} }

BIN
src/main/resources/com/github/weisj/darklaf/platform/windows/x64/jniplatform.dll

Binary file not shown.

BIN
src/main/resources/com/github/weisj/darklaf/platform/windows/x86/jniplatform.dll

Binary file not shown.
Loading…
Cancel
Save