Skip to content

Commit 248c57d

Browse files
Destroying unnecessary zoom level handles
Add display change event triggered by display zoom changes, regardless of window presence on the monitor
1 parent e4a4d28 commit 248c57d

File tree

2 files changed

+10
-0
lines changed
  • bundles/org.eclipse.swt
    • Eclipse SWT PI/win32/org/eclipse/swt/internal/win32
    • Eclipse SWT/win32/org/eclipse/swt/widgets

2 files changed

+10
-0
lines changed

bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,6 +1752,7 @@ public class OS extends C {
17521752
public static final int WM_DEADCHAR = 0x103;
17531753
public static final int WM_DESTROY = 0x2;
17541754
public static final int WM_DPICHANGED = 0x02E0;
1755+
public static final int WM_DISPLAYCHANGE = 0x7E;
17551756
public static final int WM_DRAWITEM = 0x2b;
17561757
public static final int WM_ENDSESSION = 0x16;
17571758
public static final int WM_ENTERIDLE = 0x121;

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4856,6 +4856,7 @@ long windowProc (long hwnd, int msg, long wParam, long lParam) {
48564856
case OS.WM_XBUTTONDOWN: result = WM_XBUTTONDOWN (wParam, lParam); break;
48574857
case OS.WM_XBUTTONUP: result = WM_XBUTTONUP (wParam, lParam); break;
48584858
case OS.WM_DPICHANGED: result = WM_DPICHANGED (wParam, lParam); break;
4859+
case OS.WM_DISPLAYCHANGE: result = WM_DISPLAYCHANGE(wParam, lParam); break;
48594860
}
48604861
if (result != null) return result.value;
48614862
// widget could be disposed at this point
@@ -4967,6 +4968,14 @@ LRESULT WM_DPICHANGED (long wParam, long lParam) {
49674968
return LRESULT.ONE;
49684969
}
49694970

4971+
LRESULT WM_DISPLAYCHANGE (long wParam, long lParam) {
4972+
if (getDisplay().isRescalingAtRuntime()) {
4973+
Device.win32_destroyUnusedHandles(getDisplay());
4974+
return LRESULT.ZERO;
4975+
}
4976+
return LRESULT.ONE;
4977+
}
4978+
49704979
LRESULT WM_DRAWITEM (long wParam, long lParam) {
49714980
DRAWITEMSTRUCT struct = new DRAWITEMSTRUCT ();
49724981
OS.MoveMemory (struct, lParam, DRAWITEMSTRUCT.sizeof);

0 commit comments

Comments
 (0)