eclipse / gef-classic

Eclipse GEF(tm) Classic code
Eclipse Public License 2.0
21 stars 48 forks source link

Giant cursors on Macbook with retina display #354

Open kysmith-csg opened 5 months ago

kysmith-csg commented 5 months ago

Hello, I think this must be new as a result of the latest cursor updates, but the custom gef cursors are huge now on high-resolution displays (at least for Macs).

Normal cursor:

normalcursor

Giant plug cursor:

giantplug

Giant add cursor:

giantadd

GEF is correctly loading the 2x versions of the cursors, but it seems that they are not being displayed in the correct size. I.e., a 2x version of a 16 bit icon should take up the same amount of physical screen space on a retina display as a 1x 16 bit icon on a normal display, not just be twice as big.

I'm not very familiar with cursors. Are they designed to scale with the display resolution?


Eclipse GEF GEF Classic Draw2d 3.14.100.202311222042 org.eclipse.draw2d Eclipse GEF GEF Classic GEF (MVC) 3.16.0.202311222042 org.eclipse.gef

Macbook Pro 2021 macOS Sonoma 14.2.1 16" Retina (resolution 3456 x 2234) Apple M1 Max

Phillipus commented 5 months ago

The problem is here:

https://github.com/eclipse/gef-classic/blob/586bead1bb52bba21210349ab6be90d4f11780aa/org.eclipse.gef/src/org/eclipse/gef/SharedCursors.java#L56-L74

On Mac and Linux X11 the device zoom for cursors should always be 100. On Windows and Linux Wayland the device zoom for cursors should be as reported.

This is how I implemented it in Archi:

https://github.com/archimatetool/archi/blob/master/com.archimatetool.editor/src/com/archimatetool/editor/diagram/tools/ExtCombinedTemplateCreationEntry.java

and

https://github.com/archimatetool/archi/blob/b5a2eef733d7c3a933d69f58d6452274ae0a5842/com.archimatetool.editor/src/com/archimatetool/editor/ui/ImageFactory.java#L72-L80

Phillipus commented 5 months ago

So a check needs to added in getDeviceZoom to return 100 if on Mac or Linux X11.

Phillipus commented 5 months ago

Created PR https://github.com/eclipse/gef-classic/pull/356

Phillipus commented 5 months ago

@kysmith-csg Can you test the latest code to see if this fixes the issue?

kysmith-csg commented 5 months ago

@Phillipus thank you for the very quick fix! With the nightly build it seems to be fixed. Looks much more normal now!

normal add plug

(is it just me or is the + cursor bigger than the others?)

Eclipse GEF GEF Classic GEF (MVC) 3.17.0.202401141938 org.eclipse.gef Eclipse GEF GEF Classic Draw2d 3.15.0.202401141938 org.eclipse.draw2d