JBR-1278 allow native border and shadow for custom decoration mode

(cherry picked from commit a879ad5739)
This commit is contained in:
Anton Tarasov
2021-03-19 17:12:36 +03:00
committed by jbrbot
parent 9acef5809e
commit dd1544ef0f
3 changed files with 27 additions and 11 deletions

View File

@@ -177,7 +177,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBAWT, \
LIBS_windows := kernel32.lib user32.lib gdi32.lib winspool.lib \
imm32.lib ole32.lib uuid.lib shell32.lib \
comdlg32.lib winmm.lib comctl32.lib shlwapi.lib \
delayimp.lib jvm.lib $(WIN_JAVA_LIB) advapi32.lib, \
delayimp.lib jvm.lib $(WIN_JAVA_LIB) advapi32.lib dwmapi.lib, \
VERSIONINFO_RESOURCE := $(LIBAWT_VERSIONINFO_RESOURCE), \
EXTRA_RCFLAGS := $(LIBAWT_RCFLAGS), \
))

View File

@@ -37,6 +37,7 @@
#include <shlobj.h>
#include "math.h"
#include <dwmapi.h>
// WDesktopProperties fields
jfieldID AwtDesktopProperties::pDataID = 0;
@@ -510,6 +511,16 @@ void AwtDesktopProperties::GetColorParameters() {
SetColorProperty(TEXT("win.frame.activeCaptionColor"), GetSysColor(COLOR_ACTIVECAPTION));
SetColorProperty(TEXT("win.frame.activeBorderColor"), GetSysColor(COLOR_ACTIVEBORDER));
BOOL enabled;
DwmIsCompositionEnabled(&enabled);
if (enabled) {
DWORD color;
BOOL opaque = FALSE;
// [tav] todo: listen WM_DWMCOLORIZATIONCOLORCHANGED
DwmGetColorizationColor(&color, &opaque);
SetColorProperty(TEXT("win.dwm.colorizationColor"), RGB(GetBValue(color), GetGValue(color), GetRValue(color)));
}
// ?? ?? ??
SetColorProperty(TEXT("win.frame.color"), GetSysColor(COLOR_WINDOWFRAME)); // ?? WHAT THE HECK DOES THIS MEAN ??
// ?? ?? ??

View File

@@ -1743,18 +1743,23 @@ MsgRouting AwtFrame::WmNcCalcSize(BOOL wParam, LPNCCALCSIZE_PARAMS lpncsp, LRESU
if (!wParam || !HasCustomDecoration()) {
return AwtWindow::WmNcCalcSize(wParam, lpncsp, retVal);
}
if (::IsZoomed(GetHWnd())) {
RECT insets;
GetSysInsets(&insets);
static int xBorder = ::GetSystemMetrics(SM_CXBORDER);
static int yBorder = ::GetSystemMetrics(SM_CYBORDER);
// When maximized we should include insets or otherwise the client area edges get out of a screen
lpncsp->rgrc[0].left = lpncsp->rgrc[0].left + insets.left - xBorder;
lpncsp->rgrc[0].top = lpncsp->rgrc[0].top + insets.bottom - yBorder; // do not count caption
lpncsp->rgrc[0].right = lpncsp->rgrc[0].right - insets.right + xBorder;
lpncsp->rgrc[0].bottom = lpncsp->rgrc[0].bottom - insets.bottom + yBorder;
RECT insets;
GetSysInsets(&insets);
RECT* rect = &lpncsp->rgrc[0];
rect->left = rect->left + insets.left;
if (::IsZoomed(GetHWnd())) {
lpncsp->rgrc[0].top = lpncsp->rgrc[0].top + insets.bottom;
}
else {
// this makes the native caption go uncovered
// int yBorder = ::GetSystemMetrics(SM_CYBORDER);
// lpncsp->rgrc[0].top = lpncsp->rgrc[0].top + yBorder;
}
rect->right = rect->right - insets.right;
rect->bottom = rect->bottom - insets.bottom;
retVal = 0L;
return mrConsume;
}