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

Side by Side Diff: ui/events/x/events_x.cc

Issue 1312833006: Remove ui::KeyEvent::platform_keycode_ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « ui/events/win/events_win.cc ('k') | ui/platform_window/android/platform_window_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/events/event_constants.h" 5 #include "ui/events/event_constants.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <X11/extensions/XInput.h> 8 #include <X11/extensions/XInput.h>
9 #include <X11/extensions/XInput2.h> 9 #include <X11/extensions/XInput2.h>
10 #include <X11/XKBlib.h> 10 #include <X11/XKBlib.h>
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 } 639 }
640 640
641 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { 641 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) {
642 return KeyboardCodeFromXKeyEvent(native_event); 642 return KeyboardCodeFromXKeyEvent(native_event);
643 } 643 }
644 644
645 DomCode CodeFromNative(const base::NativeEvent& native_event) { 645 DomCode CodeFromNative(const base::NativeEvent& native_event) {
646 return CodeFromXEvent(native_event); 646 return CodeFromXEvent(native_event);
647 } 647 }
648 648
649 uint32 PlatformKeycodeFromNative(const base::NativeEvent& native_event) {
650 XKeyEvent* xkey = NULL;
651 XEvent xkey_from_xi2;
652 switch (native_event->type) {
653 case KeyPress:
654 case KeyRelease:
655 xkey = &native_event->xkey;
656 break;
657 case GenericEvent: {
658 XIDeviceEvent* xievent =
659 static_cast<XIDeviceEvent*>(native_event->xcookie.data);
660 switch (xievent->evtype) {
661 case XI_KeyPress:
662 case XI_KeyRelease:
663 // Build an XKeyEvent corresponding to the XI2 event,
664 // so that we can call XLookupString on it.
665 InitXKeyEventFromXIDeviceEvent(*native_event, &xkey_from_xi2);
666 xkey = &xkey_from_xi2.xkey;
667 break;
668 default:
669 NOTREACHED();
670 break;
671 }
672 break;
673 }
674 default:
675 NOTREACHED();
676 break;
677 }
678 KeySym keysym = XK_VoidSymbol;
679 if (xkey)
680 XLookupString(xkey, NULL, 0, &keysym, NULL);
681 return keysym;
682 }
683
684 bool IsCharFromNative(const base::NativeEvent& native_event) { 649 bool IsCharFromNative(const base::NativeEvent& native_event) {
685 return false; 650 return false;
686 } 651 }
687 652
688 int GetChangedMouseButtonFlagsFromNative( 653 int GetChangedMouseButtonFlagsFromNative(
689 const base::NativeEvent& native_event) { 654 const base::NativeEvent& native_event) {
690 switch (native_event->type) { 655 switch (native_event->type) {
691 case ButtonPress: 656 case ButtonPress:
692 case ButtonRelease: 657 case ButtonRelease:
693 return GetEventFlagsForButton(native_event->xbutton.button); 658 return GetEventFlagsForButton(native_event->xbutton.button);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 xievent->detail = 873 xievent->detail =
909 UpdateX11EventButton(event->changed_button_flags(), xievent->detail); 874 UpdateX11EventButton(event->changed_button_flags(), xievent->detail);
910 break; 875 break;
911 } 876 }
912 default: 877 default:
913 break; 878 break;
914 } 879 }
915 } 880 }
916 881
917 } // namespace ui 882 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/win/events_win.cc ('k') | ui/platform_window/android/platform_window_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698