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" ;
@@ -5014,20 +5010,6 @@ LRESULT WM_DESTROY (long wParam, long lParam) {
50145010 return null ;
50155011}
50165012
5017- private void handleMonitorSpecificDpiChange (int newNativeZoom , Rectangle newBoundsInPixels ) {
5018- DPIUtil .setDeviceZoom (newNativeZoom );
5019- // Do not process DPI change for child shells asynchronous to avoid relayouting when
5020- // repositioning the child shell to a different monitor upon opening
5021- boolean processDpiChangeAsynchronous = getShell ().getParent () == null ;
5022- Event zoomChangedEvent = createZoomChangedEvent (newNativeZoom , processDpiChangeAsynchronous );
5023- if (currentDpiChangeEvent != null ) {
5024- currentDpiChangeEvent .doit = false ;
5025- }
5026- currentDpiChangeEvent = zoomChangedEvent ;
5027- notifyListeners (SWT .ZoomChanged , zoomChangedEvent );
5028- this .setBoundsInPixels (newBoundsInPixels .x , newBoundsInPixels .y , newBoundsInPixels .width , newBoundsInPixels .height );
5029- }
5030-
50315013Event createZoomChangedEvent (int zoom , boolean asyncExec ) {
50325014 Event event = new Event ();
50335015 event .type = SWT .ZoomChanged ;
@@ -5040,38 +5022,12 @@ Event createZoomChangedEvent(int zoom, boolean asyncExec) {
50405022 return event ;
50415023}
50425024
5043- LRESULT WM_DPICHANGED (long wParam , long lParam ) {
5044- // Map DPI to Zoom and compare
5045- int newNativeZoom = DPIUtil .mapDPIToZoom (OS .HIWORD (wParam ));
5046- if (getDisplay ().isRescalingAtRuntime ()) {
5047- Device .win32_destroyUnusedHandles (getDisplay ());
5048- RECT rect = new RECT ();
5049- COM .MoveMemory (rect , lParam , RECT .sizeof );
5050- handleMonitorSpecificDpiChange (newNativeZoom , new Rectangle (rect .left , rect .top , rect .right - rect .left , rect .bottom -rect .top ));
5051- return LRESULT .ZERO ;
5052- } else {
5053- int newZoom = DPIUtil .getZoomForAutoscaleProperty (newNativeZoom );
5054- int oldZoom = DPIUtil .getZoomForAutoscaleProperty (nativeZoom );
5055- if (newZoom != oldZoom ) {
5056- // Throw the DPI change event if zoom value changes
5057- Event event = new Event ();
5058- event .type = SWT .ZoomChanged ;
5059- event .widget = this ;
5060- event .detail = DPIUtil .getZoomForAutoscaleProperty (newNativeZoom );
5061- event .doit = true ;
5062- notifyListeners (SWT .ZoomChanged , event );
5063- return LRESULT .ZERO ;
5064- }
5065- }
5066- return LRESULT .ONE ;
5025+ LRESULT WM_DPICHANGED (long wParam , long lParam ) {
5026+ return null ;
50675027}
50685028
5069- LRESULT WM_DISPLAYCHANGE (long wParam , long lParam ) {
5070- if (getDisplay ().isRescalingAtRuntime ()) {
5071- Device .win32_destroyUnusedHandles (getDisplay ());
5072- return LRESULT .ZERO ;
5073- }
5074- return LRESULT .ONE ;
5029+ LRESULT WM_DISPLAYCHANGE (long wParam , long lParam ) {
5030+ return null ;
50755031}
50765032
50775033LRESULT WM_DRAWITEM (long wParam , long lParam ) {
@@ -5980,7 +5936,6 @@ private boolean decrement() {
59805936}
59815937
59825938void sendZoomChangedEvent (Event event , Shell shell ) {
5983- this .currentDpiChangeEvent = event ;
59845939 if (event .data instanceof DPIChangeExecution dpiExecData ) {
59855940 dpiExecData .increment ();
59865941 dpiExecData .process (this , () -> {
@@ -5993,9 +5948,6 @@ void sendZoomChangedEvent(Event event, Shell shell) {
59935948 return ;
59945949 }
59955950 if (dpiExecData .decrement ()) {
5996- if (event == currentDpiChangeEvent ) {
5997- currentDpiChangeEvent = null ;
5998- }
59995951 if (event .doit ) {
60005952 shell .WM_SIZE (0 , 0 );
60015953 }
0 commit comments