On Thu, 30 May 2024 12:05:25 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> wrote:
> Issue is in macosx, when a JMenu or JPopupmenu is opened and then window is > resized from the lower right corner, then the Menu / JPopupmenu stays open > unlike in native osx apps like Notes, Mail etc.. > > This is because when LMouseButton is pressed on non-client area, the window > should get a UngrabEvent for it to close/cancel the popupmenu (as is done in > [windows](https://github.com/openjdk/jdk/blob/f608918df3f887277845db383cf07b0863bba615/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp#L618-L620)) > but it was seen that the mac AWTWindow code only recognizes the title-bar as > the non-client area so > [notifyNCMouseDown](https://github.com/openjdk/jdk/blob/f608918df3f887277845db383cf07b0863bba615/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java#L797-L804) > is not called. > Fix is made to recognize the edges of the window as non-client area src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m line 1029: > 1027: // Also, non-client area includes the edges at left, right > and botton of frame > 1028: if ((p.y >= (frame.origin.y + contentRect.size.height)) || > 1029: (p.x >= (frame.origin.x + contentRect.size.width)) || Suggestion: (p.x >= (frame.origin.x + contentRect.size.width - 3)) || >From my testing there is a 3 pixel dead zone at the right window border, when >the resize cursor is displayed, but `deliverNCMouseDown` is not called. Please check this on your system as well. src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m line 1031: > 1029: (p.x >= (frame.origin.x + contentRect.size.width)) || > 1030: (fabs(frame.origin.x - p.x) < 4) || > 1031: (fabs(frame.origin.y - p.y) < 4)) { Suggestion: (fabs(frame.origin.x - p.x) < 3) || (fabs(frame.origin.y - p.y) < 3)) { It is not critical here, but it calls `deliverNCMouseDown` even if the resize cursor is not shown for the left and bottom window borders. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19474#discussion_r1622142865 PR Review Comment: https://git.openjdk.org/jdk/pull/19474#discussion_r1622149888