views: Support per-accelerator priority config (fixes #3598)

This commit is contained in:
Marshall Greenblatt
2023-11-08 14:27:50 -05:00
parent 2b38e2f793
commit d3d465b32e
12 changed files with 77 additions and 40 deletions

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=f72e94f6bd63b6ea623c4d3170b5ad4333c136d6$
// $hash=bc80e7f1e467a4e0943dcbf7ea6d08366817d5ca$
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_CAPI_H_
@@ -77,13 +77,19 @@ typedef struct _cef_browser_view_t {
struct _cef_browser_view_t* self);
///
/// Sets whether accelerators registered with cef_window_t::SetAccelerator are
/// triggered before or after the event is sent to the cef_browser_t. If
/// |prefer_accelerators| is true (1) then the matching accelerator will be
/// triggered immediately and the event will not be sent to the cef_browser_t.
/// If |prefer_accelerators| is false (0) then the matching accelerator will
/// only be triggered if the event is not handled by web content or by
/// cef_keyboard_handler_t. The default value is false (0).
/// Sets whether normal priority accelerators are first forwarded to the web
/// content (`keydown` event handler) or cef_keyboard_handler_t. Normal
/// priority accelerators can be registered via cef_window_t::SetAccelerator
/// (with |high_priority|=false (0)) or internally for standard accelerators
/// supported by the Chrome runtime. If |prefer_accelerators| is true (1) then
/// the matching accelerator will be triggered immediately (calling
/// cef_window_delegate_t::OnAccelerator or
/// cef_command_handler_t::OnChromeCommand respectively) and the event will
/// not be forwarded to the web content or cef_keyboard_handler_t first. If
/// |prefer_accelerators| is false (0) then the matching accelerator will only
/// be triggered if the event is not handled by web content (`keydown` event
/// handler that calls `event.preventDefault()`) or by cef_keyboard_handler_t.
/// The default value is false (0).
///
void(CEF_CALLBACK* set_prefer_accelerators)(struct _cef_browser_view_t* self,
int prefer_accelerators);

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=4b43fe0b493d860e8b28d7a6d892db49d1135b34$
// $hash=a48904fcd0f6be07e27839922d8feb07271ed2b5$
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_
@@ -332,16 +332,25 @@ typedef struct _cef_window_t {
///
/// Set the keyboard accelerator for the specified |command_id|. |key_code|
/// can be any virtual key or character value.
/// can be any virtual key or character value. Required modifier keys are
/// specified by |shift_pressed|, |ctrl_pressed| and/or |alt_pressed|.
/// cef_window_delegate_t::OnAccelerator will be called if the keyboard
/// combination is triggered while this window has focus.
///
/// The |high_priority| value will be considered if a child cef_browser_view_t
/// has focus when the keyboard combination is triggered. If |high_priority|
/// is true (1) then the key event will not be forwarded to the web content
/// (`keydown` event handler) or cef_keyboard_handler_t first. If
/// |high_priority| is false (0) then the behavior will depend on the
/// cef_browser_view_t::SetPreferAccelerators configuration.
///
void(CEF_CALLBACK* set_accelerator)(struct _cef_window_t* self,
int command_id,
int key_code,
int shift_pressed,
int ctrl_pressed,
int alt_pressed);
int alt_pressed,
int high_priority);
///
/// Remove the keyboard accelerator for the specified |command_id|.