Skip to content

Replace getDeviceZoom() call in ImageTransfer class #194

@ShahzaibIbrahim

Description

@ShahzaibIbrahim

I have tried finding issue with the usage of getDeviceZoom in org.eclipse.swt.dnd.ImageTransfer.nativeToJava(TransferData) using example ClipboardExample class Image transfer option. No visible issue found.

Update:

While running the ClipboardExample on a primary monitor set to 150% scaling, the following behavior was observed:

  • Selecting an image from the file system and pressing the Copy button copies the image data to the clipboard with the DeviceZoom value set to 150% (the scaling of the primary monitor).

  • Moving the application shell to a secondary monitor with 100% scaling and pressing the Paste button retrieves the image data from the clipboard and displays the image based on the original DeviceZoom (150% from the primary monitor).
    This results in the pasted image appearing larger on the secondary monitor, as it is rendered with the DeviceZoom of the primary monitor instead of adapting to the scaling of the current monitor.

Steps to reproduce:

  1. Run the ClipboardExample with following VM arguments

-Dswt.autoScale.updateOnRuntime=true
-Dswt.autoScale=quarter

  1. Open an image on primary monitor (150%) and press copy button

Image

  1. Move the shell to other monitor (200%) and press paste button

Image

Observed Behavior:

The pasted image appears larger on the secondary monitor because the image data uses the DeviceZoom from the primary monitor (150%) instead of adjusting to the scaling of the current monitor (100%).

Suggested Solution:

To address this issue, the image data copied to the clipboard should not retain the zoom level from the original monitor. Instead, the application should adapt the zoom level dynamically based on the context of the monitor where the image is pasted. This ensures consistent rendering across monitors with different scaling factors.

Hint

Metadata

Metadata

Assignees

Labels

HiDPIA HiDPI-Related Issue or FeatureSWTIssue for SWT

Type

No type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions