-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows: Browser window always keeps focus #297
Comments
Original comment by Andrei Pivkine (Bitbucket: andreiPiv, GitHub: andreiPiv). Much thanks, I will give the workaround a try. I also found some issues between 1 Browser in 1 Java window focus issue The current workaround I'm using in Java:
|
Original comment by János Gerevich (Bitbucket: JohnTheHun, GitHub: JohnTheHun). I commented it the line you were referring to, but getting focus in a multi-window environment is still not working good: i have to click multiple times until the other window finally receives focus and comes to front. (I didn't use / do anything with your attached patch file, I just ran the following under java-cef\src\tools run.bat win64 Release detailed and used the test menu / new window My Java_org_cef_browser_CefBrowser_1N_N_1SetFocus looks like this:
|
Original comment by János Gerevich (Bitbucket: JohnTheHun, GitHub: JohnTheHun). Can any of you upload or send me a 64bit jcef.dll which by your experience handles window focus with multiple browser windows correctly? So I can test it in my environment. |
Original comment by Mike van Afferden (Bitbucket: locosmike, GitHub: locosmike). We've had a similar issue to this one in our JCEF app (we only use a single Java window in our app): Once the JCEF browser window looses focus, the app icon on the task bar at the bottom of the screen (Windows 10 Pro x64) starts blinking. This usually happens, when an application in the background requests focus. We fixed the issues by changing the if condition in line 1270 of Java_org_cef_browser_CefBrowser_1N_N_1SetFocus to if (enable != JNI_FALSE). We guess that it was a typo in the code as this change fixed the behaviour of our JCEF app. You can see the change in our forked repository at GitHub. We also cloned the AppVeyor project of guusdk so you can check out the resulting binary distribution files too. |
Original comment by János Gerevich (Bitbucket: JohnTheHun, GitHub: JohnTheHun). Many thanks, Mike's solution seems to work for me. I hope this doesn't ruin anything important. |
Original comment by Andrei Pivkine (Bitbucket: andreiPiv, GitHub: andreiPiv). There is also another FocusParent code in focus_handler.cpp There is also an issue where FocusParent might be called on a component that is not visible. This can cause an issue with focus and appear to hang the Java application. My solution was to remove both FocusParent calls and handling setting focus to the parent in Java |
Original comment by János Gerevich (Bitbucket: JohnTheHun, GitHub: JohnTheHun). Andrei, is this focus handling java code the code you pasted a few comments before? |
Issue #310 was marked as a duplicate of this issue. |
Original report by me.
What steps will reproduce the problem?
What is the expected output? What do you see instead?
It should be possible to switch focus between the Java windows. Instead, the browser window always keeps focus.
What version of the product are you using? On what operating system?
Current master build on Windows 10.
The problem is due to the FocusParent call in Java_org_cef_browser_CefBrowser_1N_N_1SetFocus: https://bitbucket.org/chromiumembedded/java-cef/src/694bda5a7d1c006c982fd0254a2195d28e2f7074/native/CefBrowser_N.cpp?at=master&fileviewer=file-view-default#CefBrowser_N.cpp-1269
Commenting out that call will work around the problem.
The text was updated successfully, but these errors were encountered: