Skip to content

Commit

Permalink
JBR-7993 Menus are not displayed directly underneath main menu if off…
Browse files Browse the repository at this point in the history
…set in monitor configuration exists
  • Loading branch information
mkartashev committed Dec 9, 2024
1 parent a820116 commit a3b5d3f
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/java.desktop/unix/classes/sun/awt/wl/WLComponentPeer.java
Original file line number Diff line number Diff line change
Expand Up @@ -614,12 +614,23 @@ public Point getLocationOnScreen() {
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();
}

/**
Expand Down

0 comments on commit a3b5d3f

Please sign in to comment.