ifener / javachromiumembedded

Automatically exported from code.google.com/p/javachromiumembedded
0 stars 0 forks source link

Fix for properly closing open Java menus when user clicks on browser area #117

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the Detailed MainFrame sample app
2. Click on a menu to open it up e.g. the Bookmarks menu
3. Click on the browser area

What is the expected output? What do you see instead?
Bookmarks menu should close and go away. Instead it stays there while focus is 
given to the CefBrowser widget.

What version of the product are you using? On what operating system?
Latest JCEF, windows 7, 1.7 64 bit, default window rendering mode

Please provide any additional information below.

This pb can be worked around by adding the one-liner below.

CefBrowserWr.java
...
      public void focusGained(FocusEvent e) {
        setFocus(true);
+       MenuSelectionManager.defaultManager().clearSelectedPath();
      }
...

Explanations: if you put a breakpoint on 
MenuSelectionManager.clearSelectedPath, you'll see it is invoked by AWT when 
user performs a mouse click on a lightweight or heavyweight (canvas) widget. 
When user clicks on the native CEF in window rendering mode, this Java mouse 
event isn't happening. Instead we can manually clear the selected menus from 
the CEF focusGained callback.

Original issue reported on code.google.com by christop...@gmail.com on 17 Sep 2014 at 1:27

GoogleCodeExporter commented 9 years ago
Thanks, fixed in revision 103.

Original comment by magreenb...@gmail.com on 18 Sep 2014 at 3:42