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

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

Issue 321153002: aura-linux: Supports ISO Level3 Latch key. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed the approach. Created 6 years, 6 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 | Annotate | Revision Log
« 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/Xlib.h> 9 #include <X11/Xlib.h>
10 #endif 10 #endif
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 #if defined(OS_WIN) 556 #if defined(OS_WIN)
557 return (native_event().message == WM_CHAR) ? key_code_ : 557 return (native_event().message == WM_CHAR) ? key_code_ :
558 GetCharacterFromKeyCode(key_code_, flags()); 558 GetCharacterFromKeyCode(key_code_, flags());
559 #elif defined(USE_X11) 559 #elif defined(USE_X11)
560 if (!native_event()) 560 if (!native_event())
561 return GetCharacterFromKeyCode(key_code_, flags()); 561 return GetCharacterFromKeyCode(key_code_, flags());
562 562
563 DCHECK(native_event()->type == KeyPress || 563 DCHECK(native_event()->type == KeyPress ||
564 native_event()->type == KeyRelease); 564 native_event()->type == KeyRelease);
565 565
566 uint16 ch = 0; 566 // When a control key is held, prefer ASCII characters to non ASCII
567 if (!IsControlDown()) 567 // characters in order to use it for shortcut keys. GetCharacterFromKeyCode
568 ch = GetCharacterFromXEvent(native_event()); 568 // returns 'a' for VKEY_A even if the key is actually bound to 'à' in X11.
569 return ch ? ch : GetCharacterFromKeyCode(key_code_, flags()); 569 // GetCharacterFromXEvent returns 'à' in that case.
570 return IsControlDown() ?
571 GetCharacterFromKeyCode(key_code_, flags()) :
572 GetCharacterFromXEvent(native_event());
570 #else 573 #else
571 if (native_event()) { 574 if (native_event()) {
572 DCHECK(EventTypeFromNative(native_event()) == ET_KEY_PRESSED || 575 DCHECK(EventTypeFromNative(native_event()) == ET_KEY_PRESSED ||
573 EventTypeFromNative(native_event()) == ET_KEY_RELEASED); 576 EventTypeFromNative(native_event()) == ET_KEY_RELEASED);
574 } 577 }
575 578
576 return GetCharacterFromKeyCode(key_code_, flags()); 579 return GetCharacterFromKeyCode(key_code_, flags());
577 #endif 580 #endif
578 } 581 }
579 582
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 int GestureEvent::GetLowestTouchId() const { 726 int GestureEvent::GetLowestTouchId() const {
724 if (touch_ids_bitfield_ == 0) 727 if (touch_ids_bitfield_ == 0)
725 return -1; 728 return -1;
726 int i = -1; 729 int i = -1;
727 // Find the index of the least significant 1 bit 730 // Find the index of the least significant 1 bit
728 while (!(1 << ++i & touch_ids_bitfield_)); 731 while (!(1 << ++i & touch_ids_bitfield_));
729 return i; 732 return i;
730 } 733 }
731 734
732 } // namespace ui 735 } // 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