<Swing Dev> Swing dev>[10] Review request for JDK-8189253: [macos] JPopupMenu is inadvertently shown when using setComponentPopupMenu

Manajit Halder manajit.halder at oracle.com
Thu Jan 4 18:22:44 UTC 2018


Hi Semyon,

Fix for issue JDK-8080729 <https://bugs.openjdk.java.net/browse/JDK-8080729> has caused this regression due to changes in method setVisible(boolean visible) in file CPlatformWindow.java
orderWindow is causing the issue here, if we revert to addChildWindow then the issue is not observed but then the fix for issue JDK-8080729 fails.
Before this change the child window used to be added on to the parent as shown below in the commented code. But after the change child window is ordered above the parent.

Below code causes the regression:

CWrapper.NSWindow.orderWindow(ptr, CWrapper.NSWindow.NSWindowAbove, ownerPtr);
//CWrapper.NSWindow.addChildWindow(ownerPtr, ptr, CWrapper.NSWindow.NSWindowAbove);

Debugging further I found that if we use orderWindow then the new window is considered as new graphics device in the method notifyReshape in LWWindowPeer.java (the method updateGraphicsDevice() returns true) and is the difference between using orderWindow and addChildWindow.

Since the option to add child window is between choosing oderWindow and addChildWindow we don’t have any option to do the fix in the Mac OS native code.

Regards,
Manajit


> On 02-Jan-2018, at 11:30 PM, Semyon Sadetsky <semyon.sadetsky at oracle.com> wrote:
> 
> Hi Manajit,
> 
> JDK-8080729 bug was Mac OS specific issue and its fix changed the Mac OS code only. Nevertheless you are suggesting to fix the regression in generic code. This need to be explained somehow.
> 
> --Semyon
> On 12/25/2017 02:42 AM, Manajit Halder wrote:
>> Hi Semyon,
>> 
>> Regression is cause by JDK-8080729 <https://bugs.openjdk.java.net/browse/JDK-8080729>. The fix can’t be reversed since it is the choice between addChildWindow or orderWindow. Went through code flow related to the issue but didn’t find any other better place in code to handle this issue. The best way to fix the issue would be to avoid retargeting of events (MOUSE_ENTER and MOUSE_EXIT) between MOUSE_PRESS and MOUSE_RELEASE on the parent window (when the mouse is actually on the child window). Therefore request you to review the webrev.00.
>> 
>> Regards,
>> Manajit
>> 
>>> On 08-Dec-2017, at 9:55 PM, semyon.sadetsky at oracle.com <mailto:semyon.sadetsky at oracle.com> wrote:
>>> 
>>> Hi Manajit,
>>> 
>>> Can you provide information which fix caused the regression?
>>> 
>>> --Semyon
>>> 
>>> On 12/8/17 5:53 AM, Manajit Halder wrote:
>>>> Hi All,
>>>> 
>>>> Kindly review the following Swing fix.
>>>> 
>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8189253 <https://bugs.openjdk.java.net/browse/JDK-8189253>
>>>> Webrev: http://cr.openjdk.java.net/~mhalder/8189253/webrev.00/ <http://cr.openjdk.java.net/%7Emhalder/8189253/webrev.00/>
>>>> 
>>>> Cause: 
>>>> 	Issue was due to retargeting of mouse enter exit events. 
>>>> 	MOUSE_ENTER and MOUSE_EXIT events were sent on the parent window (JFrame) in between MOUSE_PRESS and MOUSE_RELEASE events on the modeless JDialog.
>>>> 
>>>> Fix:
>>>> 	Retargeting of events is not done in-between MOUSE_PRESS and MOUSE_RELEASE.
>>>> 
>>>> Regards,
>>>> Manajit
>>>> 
>>> 
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20180104/dae426af/attachment.html>


More information about the swing-dev mailing list