< prev index next >

src/java.desktop/unix/classes/sun/awt/X11/XMouseInfoPeer.java

Print this page

        

@@ -28,10 +28,11 @@
 import java.awt.Point;
 import java.awt.Window;
 import java.awt.GraphicsEnvironment;
 import java.awt.GraphicsDevice;
 import java.awt.peer.MouseInfoPeer;
+import sun.awt.X11GraphicsDevice;
 
 import sun.awt.AWTAccessor;
 
 public class XMouseInfoPeer implements MouseInfoPeer {
 

@@ -62,10 +63,16 @@
                                            XlibWrapper.larg6,  // yw_return
                                            XlibWrapper.larg7); // mask_return
                 if (pointerFound) {
                     point.x = Native.getInt(XlibWrapper.larg3);
                     point.y = Native.getInt(XlibWrapper.larg4);
+                    GraphicsDevice device = gds[i];
+                    if (device instanceof X11GraphicsDevice) {
+                        int scale = ((X11GraphicsDevice) device).getScaleFactor();
+                        point.x = XlibUtil.scaleDown(point.x, scale);
+                        point.y = XlibUtil.scaleDown(point.y, scale);
+                    }
                     return i;
                 }
             }
         } finally {
             XToolkit.awtUnlock();
< prev index next >