2626import org .eclipse .swt .graphics .*;
2727import org .eclipse .swt .internal .*;
2828import org .eclipse .swt .internal .gdip .*;
29- import org .eclipse .swt .internal .ole .win32 .*;
3029import org .eclipse .swt .internal .win32 .*;
3130import org .eclipse .swt .ole .win32 .*;
3231
@@ -80,9 +79,6 @@ public abstract class Control extends Widget implements Drawable {
8079 int drawCount , foreground , background , backgroundAlpha = 255 ;
8180 boolean autoScaleDisabled = false ;
8281
83- /** Cache for currently processed DPI change event to be able to cancel it if a new one is triggered */
84- Event currentDpiChangeEvent ;
85-
8682 private static final String DATA_SHELL_ZOOM = "SHELL_ZOOM" ;
8783
8884 private static final String DATA_AUTOSCALE_DISABLED = "AUTOSCALE_DISABLED" ;
@@ -5006,20 +5002,6 @@ LRESULT WM_DESTROY (long wParam, long lParam) {
50065002 return null ;
50075003}
50085004
5009- private void handleMonitorSpecificDpiChange (int newNativeZoom , Rectangle newBoundsInPixels ) {
5010- DPIUtil .setDeviceZoom (newNativeZoom );
5011- // Do not process DPI change for child shells asynchronous to avoid relayouting when
5012- // repositioning the child shell to a different monitor upon opening
5013- boolean processDpiChangeAsynchronous = getShell ().getParent () == null ;
5014- Event zoomChangedEvent = createZoomChangedEvent (newNativeZoom , processDpiChangeAsynchronous );
5015- if (currentDpiChangeEvent != null ) {
5016- currentDpiChangeEvent .doit = false ;
5017- }
5018- currentDpiChangeEvent = zoomChangedEvent ;
5019- notifyListeners (SWT .ZoomChanged , zoomChangedEvent );
5020- this .setBoundsInPixels (newBoundsInPixels .x , newBoundsInPixels .y , newBoundsInPixels .width , newBoundsInPixels .height );
5021- }
5022-
50235005Event createZoomChangedEvent (int zoom , boolean asyncExec ) {
50245006 Event event = new Event ();
50255007 event .type = SWT .ZoomChanged ;
@@ -5032,38 +5014,12 @@ Event createZoomChangedEvent(int zoom, boolean asyncExec) {
50325014 return event ;
50335015}
50345016
5035- LRESULT WM_DPICHANGED (long wParam , long lParam ) {
5036- // Map DPI to Zoom and compare
5037- int newNativeZoom = DPIUtil .mapDPIToZoom (OS .HIWORD (wParam ));
5038- if (getDisplay ().isRescalingAtRuntime ()) {
5039- Device .win32_destroyUnusedHandles (getDisplay ());
5040- RECT rect = new RECT ();
5041- COM .MoveMemory (rect , lParam , RECT .sizeof );
5042- handleMonitorSpecificDpiChange (newNativeZoom , new Rectangle (rect .left , rect .top , rect .right - rect .left , rect .bottom -rect .top ));
5043- return LRESULT .ZERO ;
5044- } else {
5045- int newZoom = DPIUtil .getZoomForAutoscaleProperty (newNativeZoom );
5046- int oldZoom = DPIUtil .getZoomForAutoscaleProperty (nativeZoom );
5047- if (newZoom != oldZoom ) {
5048- // Throw the DPI change event if zoom value changes
5049- Event event = new Event ();
5050- event .type = SWT .ZoomChanged ;
5051- event .widget = this ;
5052- event .detail = DPIUtil .getZoomForAutoscaleProperty (newNativeZoom );
5053- event .doit = true ;
5054- notifyListeners (SWT .ZoomChanged , event );
5055- return LRESULT .ZERO ;
5056- }
5057- }
5058- return LRESULT .ONE ;
5017+ LRESULT WM_DPICHANGED (long wParam , long lParam ) {
5018+ return null ;
50595019}
50605020
5061- LRESULT WM_DISPLAYCHANGE (long wParam , long lParam ) {
5062- if (getDisplay ().isRescalingAtRuntime ()) {
5063- Device .win32_destroyUnusedHandles (getDisplay ());
5064- return LRESULT .ZERO ;
5065- }
5066- return LRESULT .ONE ;
5021+ LRESULT WM_DISPLAYCHANGE (long wParam , long lParam ) {
5022+ return null ;
50675023}
50685024
50695025LRESULT WM_DRAWITEM (long wParam , long lParam ) {
@@ -5972,7 +5928,6 @@ private boolean decrement() {
59725928}
59735929
59745930void sendZoomChangedEvent (Event event , Shell shell ) {
5975- this .currentDpiChangeEvent = event ;
59765931 if (event .data instanceof DPIChangeExecution dpiExecData ) {
59775932 dpiExecData .increment ();
59785933 dpiExecData .process (this , () -> {
@@ -5985,9 +5940,6 @@ void sendZoomChangedEvent(Event event, Shell shell) {
59855940 return ;
59865941 }
59875942 if (dpiExecData .decrement ()) {
5988- if (event == currentDpiChangeEvent ) {
5989- currentDpiChangeEvent = null ;
5990- }
59915943 if (event .doit ) {
59925944 shell .WM_SIZE (0 , 0 );
59935945 }
0 commit comments