Supporting shortcut keys

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.

Re: Supporting shortcut keys

Postby Czarek » Mon Mar 18, 2013 5:49 pm

dreijer wrote:For instance, I'd like backspace to browse to the previous page,
like most browsers do.


In CEF 1 there is an option named "history_disabled" [1] in CefBrowserSettings
that affects the backspace key, but I don't see it in CEF 3.

[1] https://code.google.com/p/chromiumembed ... r=1148#268
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Supporting shortcut keys

Postby magreenblatt » Mon Mar 18, 2013 6:49 pm

dreijer wrote:
magreenblatt wrote:OnFocusedNodeChanged is a more generic solution that provides a higher level of detail.

Sure, but you're already letting the client know about some part of focused editable fields (when keyboard input is happening), so why not cover the other end where the focus changes by a different means of input, such as the mouse? I mean, you're already handling this internally in the browser process and passing it on to the client "sometimes", so why not pass it on at other times. It sounds like a pretty ordinary use-case for the client wanting to know if the browser has focused an editable field or not.

I don't personally think that this use case is common enough that it makes sense to add a dedicated callback. For example, the only usage of NOTIFICATION_FOCUS_CHANGED_IN_PAGE in Chromium is for a single unit test file. That information and a lot more is already available via the existing OnFocusedNodeChanged callback if people need it.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Supporting shortcut keys

Postby dreijer » Mon Mar 18, 2013 7:00 pm

magreenblatt wrote:I don't personally think that this use case is common enough that it makes sense to add a dedicated callback. For example, the only usage of NOTIFICATION_FOCUS_CHANGED_IN_PAGE in Chromium is for a single unit test file. That information and a lot more is already available via the existing OnFocusedNodeChanged callback if people need it.

I guess I misunderstood how the code worked then. :) How does CEF know that keyboard input is in an editable field if it doesn't look at OnFocusedNodeChanged? Does Chromium tell it when it fires the input event?
dreijer
Expert
 
Posts: 201
Joined: Mon Apr 11, 2011 10:09 pm

Re: Supporting shortcut keys

Postby magreenblatt » Mon Mar 18, 2013 7:15 pm

dreijer wrote:
magreenblatt wrote:I don't personally think that this use case is common enough that it makes sense to add a dedicated callback. For example, the only usage of NOTIFICATION_FOCUS_CHANGED_IN_PAGE in Chromium is for a single unit test file. That information and a lot more is already available via the existing OnFocusedNodeChanged callback if people need it.

I guess I misunderstood how the code worked then. :) How does CEF know that keyboard input is in an editable field if it doesn't look at OnFocusedNodeChanged? Does Chromium tell it when it fires the input event?

CEF listens for the NOTIFICATION_FOCUS_CHANGED_IN_PAGE notification but it's not used inside Chromium outside of the unit tests (CEF != Chromium). Given the very limited use of this notification inside Chromium there's a reasonable chance that it will disappear in the future and CEF will then need to use the same OnFocusedNodeChanged approach internally.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Supporting shortcut keys

Postby dreijer » Mon Mar 18, 2013 7:46 pm

magreenblatt wrote:CEF listens for the NOTIFICATION_FOCUS_CHANGED_IN_PAGE notification but it's not used inside Chromium outside of the unit tests (CEF != Chromium). Given the very limited use of this notification inside Chromium there's a reasonable chance that it will disappear in the future and CEF will then need to use the same OnFocusedNodeChanged approach internally.

Right, I understand CEF != Chromium, of course. I wasn't aware NOTIFICATION_FOCUS_CHANGED_IN_PAGE was a Chromium notification that you just piggy-backed on (I'm not familiar with the internals at all). From the brief look I had earlier, it just looked like you (CEF) was already using NOTIFICATION_FOCUS_CHANGED_IN_PAGE to set focus_on_editable_field_, which I assumed was what you used when when firing CefKeyboardHandler::OnKeyEvent.
dreijer
Expert
 
Posts: 201
Joined: Mon Apr 11, 2011 10:09 pm

Previous

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 186 guests