Native widgets don't receive keyboard input

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Native widgets don't receive keyboard input

Postby chellio » Fri Oct 07, 2016 6:57 pm

Problem is that my native widgets don't receive keyboard input because it is intercepted all time by CefBrowser. In other words CefBrowser never loss focus. I think problem is caused by poor integration of message loops. I use wxwidgets on Ubuntu and call CefDoMessageLoopWork on timer. One time when keyboard input is passed back to my native widgets is when I switch to antother window and then back to my application window. Can you give my any tips how to solve that problem?
Regards.
Last edited by chellio on Mon Oct 10, 2016 5:41 pm, edited 2 times in total.
chellio
Techie
 
Posts: 27
Joined: Fri May 20, 2016 9:26 am
Location: Poland

Re: Native widgets don't receive keyboard input

Postby Czarek » Sat Oct 08, 2016 1:12 am

I have similar problems in cefpython in the tkinter example that I've recently created. After I use keyboard in CEF browser I can't switch back to other Tk controls. Also when I move window without even using keyboard in CEF browser, the same thing happens, keyboard focus can no more be given to Tk controls. I've tried calling SetFocus(False) and SendFocusEvent, but CEF never loses focus. I've also implemented CefFocusHandler and tried many things, but couldn't make it work.

In cefclient switching focus between browser <> navigation bar works fine, but there is an issue with cursor when switching to url entry, there should be a blinking cursor for typing visibile, but it's not appearing.

I'm also calling CefDoMessageLoopWork in a timer. I've implemented external message pump, but it's buggy on Linux, I've reported Issue #2002.

Using Ubuntu 14.04 and CEF branch 2785.

Updated.
Available for contract work, see my resume. Maintainer of the CEF Python, PHP Desktop and CEF C API projects.
User avatar
Czarek
Virtuoso
 
Posts: 1526
Joined: Sun Nov 06, 2011 2:12 am

Re: Native widgets don't receive keyboard input

Postby chellio » Mon Oct 10, 2016 4:14 pm

I found solution.
To restore keyboard input to my native widgets I call gtk_window_present(1) with my top level window as parameter in respond to left-mouse click event. (little tricky).
To remove caret from native widgets when CefBrowser is focused I call wxwidgets specific SetFocus as a method of inner panel where CefBrowser is embedded. ( From CefFocusHandler::OnGotFocus ).
chellio
Techie
 
Posts: 27
Joined: Fri May 20, 2016 9:26 am
Location: Poland

Re: Native widgets don't receive keyboard input

Postby Czarek » Mon Oct 10, 2016 11:50 pm

I followed your solution and also got it working, however there is still one issue. When my mouse is over url widget everything works fine, but when I hover mouse over CEF browser then keyboard focus on native url widget is lost, nothing reacts to my typing, neither the native widget, nor CEF browser, also none of the CefFocusHandler methods are being called at such time. When I hover the mouse back to url widget keyboard focus is restored. Calling CEF browser.SetFocus(False) doesn't help.
Available for contract work, see my resume. Maintainer of the CEF Python, PHP Desktop and CEF C API projects.
User avatar
Czarek
Virtuoso
 
Posts: 1526
Joined: Sun Nov 06, 2011 2:12 am

Re: Native widgets don't receive keyboard input

Postby Czarek » Fri Oct 28, 2016 4:40 am

Reported this along with a few other keyboard focus issues in the tracker: https://bitbucket.org/chromiumembedded/ ... -issues-on
Available for contract work, see my resume. Maintainer of the CEF Python, PHP Desktop and CEF C API projects.
User avatar
Czarek
Virtuoso
 
Posts: 1526
Joined: Sun Nov 06, 2011 2:12 am


Return to Support Forum

Who is online

Users browsing this forum: GieltjE, Google [Bot] and 12 guests