Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -300,18 +300,9 @@ public Shell (Display display, int style) {
if (handle != 0 && !embedded) {
state |= FOREIGN_HANDLE;
}

int shellNativeZoom;
if (parent != null) {
shellNativeZoom = parent.nativeZoom;
} else {
int mappedDPIZoom = getMonitor().getZoom();
shellNativeZoom = mappedDPIZoom;
}
this.nativeZoom = shellNativeZoom;

reskinWidget();
createWidget ();
this.nativeZoom = DPIUtil.mapDPIToZoom(OS.GetDpiForWindow(this.handle));
}

/**
Expand Down Expand Up @@ -2728,26 +2719,6 @@ LRESULT WM_WINDOWPOSCHANGING (long wParam, long lParam) {
return result;
}

@Override
LRESULT WM_WINDOWPOSCHANGED (long wParam, long lParam) {
LRESULT result = super.WM_WINDOWPOSCHANGED(wParam, lParam);
// When the process is started with System DPI awareness and
// only the thread is PerMonitorV2 aware, there are some scenarios, when the
// OS does not send a DPI change event when a child Shell is positioned and
// opened on another monitor as its parent Shell. To work around that limitation
// this check is added to trigger a dpi change event if an unexpected DPI value is
// detected.
if (display.isRescalingAtRuntime()) {
int dpiForWindow = DPIUtil.mapDPIToZoom(OS.GetDpiForWindow(getShell().handle));
if (dpiForWindow != nativeZoom) {
WINDOWPOS lpwp = new WINDOWPOS ();
OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof);
handleMonitorSpecificDpiChange(dpiForWindow, new Rectangle(lpwp.x, lpwp.y, lpwp.cx, lpwp.cy));
}
}
return result;
}

private static void handleDPIChange(Widget widget, int newZoom, float scalingFactor) {
if (!(widget instanceof Shell shell)) {
return;
Expand Down
Loading