mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-01-23 07:50:44 +01:00
Translate additional CEF modifiers to EF_* flags (see issue #2597)
This commit is contained in:
parent
103fe12b72
commit
2be59f6edd
@ -1842,6 +1842,7 @@ typedef enum {
|
||||
EVENTFLAG_IS_LEFT = 1 << 10,
|
||||
EVENTFLAG_IS_RIGHT = 1 << 11,
|
||||
EVENTFLAG_ALTGR_DOWN = 1 << 12,
|
||||
EVENTFLAG_IS_REPEAT = 1 << 13,
|
||||
} cef_event_flags_t;
|
||||
|
||||
///
|
||||
|
@ -397,29 +397,33 @@ int CefBrowserPlatformDelegate::TranslateWebEventModifiers(
|
||||
uint32 cef_modifiers) {
|
||||
int result = 0;
|
||||
// Set modifiers based on key state.
|
||||
if (cef_modifiers & EVENTFLAG_CAPS_LOCK_ON)
|
||||
result |= blink::WebInputEvent::kCapsLockOn;
|
||||
if (cef_modifiers & EVENTFLAG_SHIFT_DOWN)
|
||||
result |= blink::WebInputEvent::kShiftKey;
|
||||
if (cef_modifiers & EVENTFLAG_CONTROL_DOWN)
|
||||
result |= blink::WebInputEvent::kControlKey;
|
||||
if (cef_modifiers & EVENTFLAG_ALT_DOWN)
|
||||
result |= blink::WebInputEvent::kAltKey;
|
||||
if (cef_modifiers & EVENTFLAG_COMMAND_DOWN)
|
||||
result |= blink::WebInputEvent::kMetaKey;
|
||||
if (cef_modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
|
||||
result |= blink::WebInputEvent::kLeftButtonDown;
|
||||
if (cef_modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)
|
||||
result |= blink::WebInputEvent::kMiddleButtonDown;
|
||||
if (cef_modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON)
|
||||
result |= blink::WebInputEvent::kRightButtonDown;
|
||||
if (cef_modifiers & EVENTFLAG_CAPS_LOCK_ON)
|
||||
result |= blink::WebInputEvent::kCapsLockOn;
|
||||
if (cef_modifiers & EVENTFLAG_COMMAND_DOWN)
|
||||
result |= blink::WebInputEvent::kMetaKey;
|
||||
if (cef_modifiers & EVENTFLAG_NUM_LOCK_ON)
|
||||
result |= blink::WebInputEvent::kNumLockOn;
|
||||
if (cef_modifiers & EVENTFLAG_IS_KEY_PAD)
|
||||
result |= blink::WebInputEvent::kIsKeyPad;
|
||||
if (cef_modifiers & EVENTFLAG_IS_LEFT)
|
||||
result |= blink::WebInputEvent::kIsLeft;
|
||||
if (cef_modifiers & EVENTFLAG_IS_RIGHT)
|
||||
result |= blink::WebInputEvent::kIsRight;
|
||||
if (cef_modifiers & EVENTFLAG_IS_KEY_PAD)
|
||||
result |= blink::WebInputEvent::kIsKeyPad;
|
||||
if (cef_modifiers & EVENTFLAG_ALTGR_DOWN)
|
||||
result |= blink::WebInputEvent::kAltGrKey;
|
||||
if (cef_modifiers & EVENTFLAG_IS_REPEAT)
|
||||
result |= blink::WebInputEvent::kIsAutoRepeat;
|
||||
return result;
|
||||
}
|
||||
|
@ -38,6 +38,14 @@ bool GetCefKeyEvent(const content::NativeWebKeyboardEvent& event,
|
||||
cef_event.modifiers |= EVENTFLAG_COMMAND_DOWN;
|
||||
if (event.GetModifiers() & blink::WebKeyboardEvent::kIsKeyPad)
|
||||
cef_event.modifiers |= EVENTFLAG_IS_KEY_PAD;
|
||||
if (event.GetModifiers() & blink::WebKeyboardEvent::kIsLeft)
|
||||
cef_event.modifiers |= EVENTFLAG_IS_LEFT;
|
||||
if (event.GetModifiers() & blink::WebKeyboardEvent::kIsRight)
|
||||
cef_event.modifiers |= EVENTFLAG_IS_RIGHT;
|
||||
if (event.GetModifiers() & blink::WebKeyboardEvent::kAltGrKey)
|
||||
cef_event.modifiers |= EVENTFLAG_ALTGR_DOWN;
|
||||
if (event.GetModifiers() & blink::WebKeyboardEvent::kIsAutoRepeat)
|
||||
cef_event.modifiers |= EVENTFLAG_IS_REPEAT;
|
||||
|
||||
cef_event.windows_key_code = event.windows_key_code;
|
||||
cef_event.native_key_code = event.native_key_code;
|
||||
|
@ -192,26 +192,30 @@ int CefBrowserPlatformDelegateNativeAura::TranslateUiEventModifiers(
|
||||
uint32 cef_modifiers) {
|
||||
int result = 0;
|
||||
// Set modifiers based on key state.
|
||||
if (cef_modifiers & EVENTFLAG_CAPS_LOCK_ON)
|
||||
result |= ui::EF_CAPS_LOCK_ON;
|
||||
if (cef_modifiers & EVENTFLAG_SHIFT_DOWN)
|
||||
result |= ui::EF_SHIFT_DOWN;
|
||||
if (cef_modifiers & EVENTFLAG_CONTROL_DOWN)
|
||||
result |= ui::EF_CONTROL_DOWN;
|
||||
if (cef_modifiers & EVENTFLAG_ALT_DOWN)
|
||||
result |= ui::EF_ALT_DOWN;
|
||||
if (cef_modifiers & EVENTFLAG_COMMAND_DOWN)
|
||||
result |= ui::EF_COMMAND_DOWN;
|
||||
if (cef_modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
|
||||
result |= ui::EF_LEFT_MOUSE_BUTTON;
|
||||
if (cef_modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)
|
||||
result |= ui::EF_MIDDLE_MOUSE_BUTTON;
|
||||
if (cef_modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON)
|
||||
result |= ui::EF_RIGHT_MOUSE_BUTTON;
|
||||
if (cef_modifiers & EVENTFLAG_CAPS_LOCK_ON)
|
||||
result |= ui::EF_CAPS_LOCK_ON;
|
||||
if (cef_modifiers & EVENTFLAG_COMMAND_DOWN)
|
||||
result |= ui::EF_COMMAND_DOWN;
|
||||
if (cef_modifiers & EVENTFLAG_NUM_LOCK_ON)
|
||||
result |= ui::EF_NUM_LOCK_ON;
|
||||
if (cef_modifiers & EVENTFLAG_IS_KEY_PAD)
|
||||
result |= ui::EF_IS_EXTENDED_KEY;
|
||||
if (cef_modifiers & EVENTFLAG_ALTGR_DOWN)
|
||||
result |= ui::EF_ALTGR_DOWN;
|
||||
if (cef_modifiers & EVENTFLAG_IS_REPEAT)
|
||||
result |= ui::EF_IS_REPEAT;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user