Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Unified Diff: ui/events/x/events_x.cc

Issue 492863002: mojo: Plumb through sufficient context to make real blink::WebInputEvents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final sky nits Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/win/events_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/x/events_x.cc
diff --git a/ui/events/x/events_x.cc b/ui/events/x/events_x.cc
index 19ce00fdb99381aa2b3a5bebd20d6d36bc298854..b0f444e9d0d858756b215ced0bdf129910d914c9 100644
--- a/ui/events/x/events_x.cc
+++ b/ui/events/x/events_x.cc
@@ -684,6 +684,54 @@ bool IsCharFromNative(const base::NativeEvent& native_event) {
return false;
}
+uint32 WindowsKeycodeFromNative(const base::NativeEvent& native_event) {
+ int windows_key_code = ui::KeyboardCodeFromXKeyEvent(native_event);
+ if (windows_key_code == ui::VKEY_SHIFT ||
+ windows_key_code == ui::VKEY_CONTROL ||
+ windows_key_code == ui::VKEY_MENU) {
+ // To support DOM3 'location' attribute, we need to lookup an X KeySym and
+ // set ui::VKEY_[LR]XXX instead of ui::VKEY_XXX.
+ KeySym keysym = XK_VoidSymbol;
+ XLookupString(&native_event->xkey, NULL, 0, &keysym, NULL);
+ switch (keysym) {
+ case XK_Shift_L:
+ return ui::VKEY_LSHIFT;
+ case XK_Shift_R:
+ return ui::VKEY_RSHIFT;
+ case XK_Control_L:
+ return ui::VKEY_LCONTROL;
+ case XK_Control_R:
+ return ui::VKEY_RCONTROL;
+ case XK_Meta_L:
+ case XK_Alt_L:
+ return ui::VKEY_LMENU;
+ case XK_Meta_R:
+ case XK_Alt_R:
+ return ui::VKEY_RMENU;
+ }
+ }
+ return windows_key_code;
+}
+
+uint16 TextFromNative(const base::NativeEvent& native_event) {
+ int flags = EventFlagsFromNative(native_event);
+ if ((flags & ui::EF_CONTROL_DOWN) != 0) {
+ int windows_key_code = WindowsKeycodeFromNative(native_event);
+ return ui::GetControlCharacterForKeycode(windows_key_code,
+ flags & ui::EF_SHIFT_DOWN);
+ }
+
+ return UnmodifiedTextFromNative(native_event);
+}
+
+uint16 UnmodifiedTextFromNative(const base::NativeEvent& native_event) {
+ uint32 keycode = WindowsKeycodeFromNative(native_event);
+ if (keycode == ui::VKEY_RETURN)
+ return '\r';
+ else
+ return ui::GetCharacterFromXEvent(native_event);
+}
+
int GetChangedMouseButtonFlagsFromNative(
const base::NativeEvent& native_event) {
switch (native_event->type) {
« no previous file with comments | « ui/events/win/events_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698