Ticket #13173: fix-13173-mouse-cursor-hotspot-offset-for-hidpi.patch

File fix-13173-mouse-cursor-hotspot-offset-for-hidpi.patch, 1.1 KB (added by johsin18, 4 years ago)

Patch 1

  • src/org/openstreetmap/josm/tools/ImageProvider.java

    diff --git a/src/org/openstreetmap/josm/tools/ImageProvider.java b/src/org/openstreetmap/josm/tools/ImageProvider.java
    index 9351a47..7f41b35 100644
    a b public class ImageProvider {  
    13281328            Logging.debug("Cursors are not available in headless mode. Returning null for ''{0}''", name);
    13291329            return null;
    13301330        }
     1331        Point hotSpot = "crosshair".equals(name) ? new Point(10, 10) : new Point(3, 2);
     1332        float scaling = 1.0f;
     1333        if (GraphicsEnvironment.getLocalGraphicsEnvironment().getClass().getName().equals("sun.awt.Win32GraphicsEnvironment"))
     1334            scaling = Toolkit.getDefaultToolkit().getScreenResolution() / 96.0f;
    13311335        return Toolkit.getDefaultToolkit().createCustomCursor(img.getImage(),
    1332                 "crosshair".equals(name) ? new Point(10, 10) : new Point(3, 2), "Cursor");
     1336                new Point(Math.round(hotSpot.x * scaling), Math.round(hotSpot.y * scaling)), name);
    13331337    }
    13341338
    13351339    /** 90 degrees in radians units */