Keyboard events "eaten" by browser

Having problems with building or using the CefGlue .NET/Mono binding? Ask your questions here.

Moderator: fddima

Keyboard events "eaten" by browser

Postby uwekeim » Thu Jun 27, 2013 7:42 am

The following applies to both my own WinForms application as well as the CefGlue WinForms examples:

When the browser control has the focus, any keys being pressed seem to be eaten by the browser control, no matter whether they also can be handled by the browser control or not.

Example:

Image

Here, I would expect that the browser control behaves the same way as the IE-based WinForms WebBrowser control:

When the key can be handled by the browser, it is processed and not forwared; when the can cannot be handled, it is being forwared to the parent control.

My question:

How can I tell the CefGlue client to not eat all keyboard events but only those which can be handled?

Notes:

- I already tried my own CefKeyboardHandler implementation without any real success
- This seems to be a similar question without any help for me
- Using the SendInput function to manually forward in a CefKeyboardHandler doesn't seem to work, because I cannot specify the target window
Last edited by uwekeim on Thu Jun 27, 2013 8:11 am, edited 1 time in total.
User avatar
uwekeim
Techie
 
Posts: 17
Joined: Wed Jun 05, 2013 12:34 pm

Re: Keyboard events "eaten" by browser

Postby fddima » Thu Jun 27, 2013 8:10 am

Hi.

Did you trying handle CefKeyboardHandler.OnKeyEvent ?

CefGlue's sample controls is do not have any sort of event forwaring, so it just must do not work, as you expecting.

Also note, that when you are using multi-threaded mode - browser's window message loop located on separate thread (i.e. it is differs from message loop which dispatch messages for main window / menu / etc...).
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: Keyboard events "eaten" by browser

Postby uwekeim » Thu Jun 27, 2013 8:14 am

Thanks, I did try.

I found no way to forward this event to my parent control/window.

I just found a way to get notfied by using this function, not on how to tell the browser to forward.
User avatar
uwekeim
Techie
 
Posts: 17
Joined: Wed Jun 05, 2013 12:34 pm

Re: Keyboard events "eaten" by browser

Postby uwekeim » Thu Jun 27, 2013 8:23 am

Just tried the following:

- Setting CefSettings.MultiThreadedMessageLoop to FALSE.
- Calling DoMessageLoopWork() in the Application.Idle event;

This actually helps resolving it; now keyboard events actually get bubbled up to the parent control/form.

Question:

Are there any drawbacks when having a single-threaded message loop only?
User avatar
uwekeim
Techie
 
Posts: 17
Joined: Wed Jun 05, 2013 12:34 pm

Re: Keyboard events "eaten" by browser

Postby fddima » Thu Jun 27, 2013 8:41 am

uwekeim wrote:Are there any drawbacks when having a single-threaded message loop only?

It is good idea use single-threaded mode whenever is possible.

Drawback of single-threaded mode in WinForms world - you must find optimal way to call DoMessageLoopWork.
Calling from .Idle can be not enough. Calling from message filter - can be too expensive.
Alternative - is using CEF's message loop, instead of Application.Run, but in this case some part's of WinForms can be potentially broken.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: Keyboard events "eaten" by browser

Postby fddima » Thu Jun 27, 2013 8:45 am

And in addition - win32 did not have event capturing and bubbling concept at all.
So everything that looks like bubbling (like menu) - it is maden by some amount of simple crutches.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: Keyboard events "eaten" by browser

Postby satishjha » Mon Sep 29, 2014 9:46 am

Hi,

I am facing the same keyboard issue [keyboard events are eaten by browser].
I am running in the multi-thread mode.

Do we have any other solution now other than making MultiThreadedMessageLoop to false?
satishjha
Newbie
 
Posts: 1
Joined: Mon Sep 29, 2014 9:36 am


Return to CefGlue Forum

Who is online

Users browsing this forum: No registered users and 16 guests