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

Side by Side Diff: ui/events/event.cc

Issue 872213002: [Ozone] Fix ui::Event::GetCharacter() when Ctrl is pressed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | no next file » | 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.h" 5 #include "ui/events/event.h"
6 6
7 #if defined(USE_X11) 7 #if defined(USE_X11)
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <X11/keysym.h> 9 #include <X11/keysym.h>
10 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 GetMeaningFromKeyCode(key_code_, flags(), &key_, &character_); 773 GetMeaningFromKeyCode(key_code_, flags(), &key_, &character_);
774 #elif defined(USE_X11) 774 #elif defined(USE_X11)
775 // When a control key is held, prefer ASCII characters to non ASCII 775 // When a control key is held, prefer ASCII characters to non ASCII
776 // characters in order to use it for shortcut keys. GetCharacterFromKeyCode 776 // characters in order to use it for shortcut keys. GetCharacterFromKeyCode
777 // returns 'a' for VKEY_A even if the key is actually bound to 'à' in X11. 777 // returns 'a' for VKEY_A even if the key is actually bound to 'à' in X11.
778 // GetCharacterFromXEvent returns 'à' in that case. 778 // GetCharacterFromXEvent returns 'à' in that case.
779 character_ = (IsControlDown() || !native_event()) ? 779 character_ = (IsControlDown() || !native_event()) ?
780 GetCharacterFromKeyCode(key_code_, flags()) : 780 GetCharacterFromKeyCode(key_code_, flags()) :
781 GetCharacterFromXEvent(native_event()); 781 GetCharacterFromXEvent(native_event());
782 // TODO(kpschoedel): set key_ field for X11. 782 // TODO(kpschoedel): set key_ field for X11.
783 #elif defined(USE_OZONE) 783 #elif defined(USE_OZONE)
kpschoedel 2015/01/26 19:34:22 This code isn't run for normal key events (only fo
784 KeyboardCode key_code; 784 KeyboardCode key_code;
785 if (!KeyboardLayoutEngineManager::GetKeyboardLayoutEngine()->Lookup( 785 if (KeyboardLayoutEngineManager::GetKeyboardLayoutEngine()->Lookup(
786 code_, flags(), &key_, &character_, &key_code, &platform_keycode_)) { 786 code_, flags(), &key_, &character_, &key_code, &platform_keycode_)) {
787 if (IsControlDown()) {
788 // Use GetCharacterFromKeyCode() to set |character_| to 0x0 for keys that
789 // we do not care about.
790 character_ = GetCharacterFromKeyCode(key_code_, flags());
791 }
792 } else {
787 GetMeaningFromKeyCode(key_code_, flags(), &key_, &character_); 793 GetMeaningFromKeyCode(key_code_, flags(), &key_, &character_);
788 } 794 }
789 #else 795 #else
790 if (native_event()) { 796 if (native_event()) {
791 DCHECK(EventTypeFromNative(native_event()) == ET_KEY_PRESSED || 797 DCHECK(EventTypeFromNative(native_event()) == ET_KEY_PRESSED ||
792 EventTypeFromNative(native_event()) == ET_KEY_RELEASED); 798 EventTypeFromNative(native_event()) == ET_KEY_RELEASED);
793 } 799 }
794 // TODO(kpschoedel): revise to use DOM code_ instead of Windows key_code_ 800 // TODO(kpschoedel): revise to use DOM code_ instead of Windows key_code_
795 GetMeaningFromKeyCode(key_code_, flags(), &key_, &character_); 801 GetMeaningFromKeyCode(key_code_, flags(), &key_, &character_);
796 #endif 802 #endif
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 gfx::PointF(x, y), 979 gfx::PointF(x, y),
974 time_stamp, 980 time_stamp,
975 flags | EF_FROM_TOUCH), 981 flags | EF_FROM_TOUCH),
976 details_(details) { 982 details_(details) {
977 } 983 }
978 984
979 GestureEvent::~GestureEvent() { 985 GestureEvent::~GestureEvent() {
980 } 986 }
981 987
982 } // namespace ui 988 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698