Bug 1351

Summary: NEWT: Custom pointer pixels doubled on High-DPI Retina Display on OS X only
Product: [JogAmp] Newt Reporter: antoine.dutot <antoine.dutot>
Component: macosxAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P4    
Version: 2.4.0   
Hardware: All   
OS: macosx   
Type: DEFECT SCM Refs:
Workaround: ---
Bug Depends on:    
Bug Blocks: 1373    

Description antoine.dutot@gmail.com 2017-02-18 10:35:20 CET
Hi all,

When specifying a custom window pointer with Window.setPointerIcon() the pointer image is correct on HiDPI displays in Windows 10 (at 200% scale) and Linux but its size is doubled on MacOS X when using a retina display.

This does not happen on MacOS X on a standard, non HiDPI, display. 

The pointer is created like this :

win.setPointerIcon(win.getScreen().getDisplay().createPointerIcon(new PixelRectangle.GenericPixelRect(format, new Dimension(width, height), width*4, true, buffer, hotx, hoty))

Thanks a lot for your help.
Comment 1 Sven Gothel 2019-03-30 06:17:10 CET
I assume this is a NEWT Window.
Set for version 2.5.0
Comment 2 Sven Gothel 2020-01-05 04:16:27 CET
tested w/ v2.4.0-rc-20200104
<http://forum.jogamp.org/JogAmp-Jbeil-RC-Build-2-4-0-rc-20200104-td4040241.html>

java -jar fat/jogamp-fat-test.jar
com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2SimpleNEWT

pressing 'c' to change pointer to custom pointer/arrow icon and 
when I move the pointer out of the window (OSX icong)
and back in (custom icon) I see the same size.
Comment 3 Sven Gothel 2020-01-05 14:17:28 CET
NEWT MacOS native code shows the pointer bitmaps are defined by pixelSize:

Java_jogamp_newt_driver_macosx_DisplayDriver_createPointerIcon0:

NSBitmapImageRep initWithBitmapDataPlanes(..,pixelsWide, pixelsHigh, ..) 
-> NSImage  initWithCGImage(..)
-> [[NSCursor alloc] initWithImage: nsImage hotSpot: hotP];

+++

Demo in comment 2 uses
- newt/data/pointer-grey-alpha-16x24.png
- arrow-red-alpha-64x64.png
- .. 

so: 16x24 and then all 64x64 sized bitmaps.

If at all, the pointer bitmap should be presented smaller in high-dpi mode
than expected, but this doesn't seem to be the case here.

Therefor the NSCursor seems to be upscaled by OSX to be same size.

some other discussions https://stackoverflow.com/questions/12021812/nscursor-images-on-a-retina-display


Please reopen this bug if you can reproduce and provide a unit test for me to reproduce this issue.