Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Giant cursors on Macbook with retina display #354

Open
kysmith-csg opened this issue Jan 12, 2024 · 5 comments
Open

Giant cursors on Macbook with retina display #354

kysmith-csg opened this issue Jan 12, 2024 · 5 comments
Milestone

Comments

@kysmith-csg
Copy link
Contributor

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
Copy link
Contributor

Phillipus commented Jan 13, 2024

The problem is here:

private static Cursor createCursor(String sourceName) {
ImageDescriptor src = ImageDescriptor.createFromFile(Internal.class, sourceName);
return new Cursor(null, src.getImageData(getDeviceZoom()), 0, 0);
}
private static int getDeviceZoom() {
if (deviceZoom == -1) {
deviceZoom = 100; // default value
String deviceZoomProperty = System.getProperty("org.eclipse.swt.internal.deviceZoom"); //$NON-NLS-1$
if (deviceZoomProperty != null) {
try {
deviceZoom = Integer.parseInt(deviceZoomProperty);
} catch (NumberFormatException ex) {
// if the property can not be parsed we keep the default 100% zoom level
}
}
}
return deviceZoom;
}

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
Copy link
Contributor

Phillipus commented Jan 13, 2024

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

Phillipus added a commit to Phillipus/gef-classic that referenced this issue Jan 13, 2024
See eclipse#354

On Mac and Linux X11 device zoom should always be 100% when creating the ImageData for the cursor.
@Phillipus
Copy link
Contributor

Phillipus commented Jan 13, 2024

Created PR #356

Phillipus added a commit to Phillipus/gef-classic that referenced this issue Jan 13, 2024
See eclipse#354

On Mac and Linux X11 device zoom should always be 100% when creating the ImageData for the cursor.
azoitl pushed a commit that referenced this issue Jan 13, 2024
See #354

On Mac and Linux X11 device zoom should always be 100% when creating the ImageData for the cursor.
@azoitl azoitl added this to the 3.19.0 milestone Jan 13, 2024
@Phillipus
Copy link
Contributor

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

@kysmith-csg
Copy link
Contributor Author

@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

@ptziegler ptziegler modified the milestones: 3.19.0, 3.20.0 Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants