JBR-7993 Menus are not displayed directly underneath main menu if offset in monitor configuration exists

This commit is contained in:
Maxim Kartashev
2024-12-04 13:56:58 +04:00
parent 0665558bcc
commit 6b2a8b03f7

View File

@@ -614,12 +614,23 @@ public class WLComponentPeer implements ComponentPeer {
try {
return WLRobotPeer.getLocationOfWLSurface(wlSurfacePtr);
} catch (UnsupportedOperationException ignore) {
return new Point();
return getFakeLocationOnScreen();
}
} else {
return new Point();
return getFakeLocationOnScreen();
}
}, Point::new);
}, this::getFakeLocationOnScreen);
}
private Point getFakeLocationOnScreen() {
// If we can't learn the real location from WLRobotPeer, we can at least
// return a reasonable fake. This fake location places all windows in the top-left
// corner of their respective screen.
GraphicsConfiguration graphicsConfig = target.getGraphicsConfiguration();
if (graphicsConfig != null) {
return graphicsConfig.getBounds().getLocation();
}
return new Point();
}
/**