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

Side by Side Diff: ui/events/keycodes/keyboard_code_conversion_x.cc

Issue 611993002: linux: Do not fallback to the hardware keycodes for modifers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed wez's review comments. Created 6 years, 2 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/keycodes/keyboard_code_conversion_x.h" 5 #include "ui/events/keycodes/keyboard_code_conversion_x.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #define XK_3270 // for XK_3270_BackTab 9 #define XK_3270 // for XK_3270_BackTab
10 #include <X11/XF86keysym.h> 10 #include <X11/XF86keysym.h>
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 MAP3 key4 = {keysym & 0xFFFF, xkey->keycode, keysym_shift & 0xFFFF, 0xFFFF, 538 MAP3 key4 = {keysym & 0xFFFF, xkey->keycode, keysym_shift & 0xFFFF, 0xFFFF,
539 0}; 539 0};
540 const MAP3* p = 540 const MAP3* p =
541 std::lower_bound(map3, map3 + arraysize(map3), key4, MAP3()); 541 std::lower_bound(map3, map3 + arraysize(map3), key4, MAP3());
542 if (p != map3 + arraysize(map3) && p->ch0 == key4.ch0 && p->sc == key4.sc && 542 if (p != map3 + arraysize(map3) && p->ch0 == key4.ch0 && p->sc == key4.sc &&
543 p->ch1 == key4.ch1) 543 p->ch1 == key4.ch1)
544 return static_cast<KeyboardCode>(p->vk); 544 return static_cast<KeyboardCode>(p->vk);
545 } 545 }
546 546
547 keycode = KeyboardCodeFromXKeysym(keysym); 547 keycode = KeyboardCodeFromXKeysym(keysym);
548 if (keycode == VKEY_UNKNOWN) 548 if (keycode == VKEY_UNKNOWN && !IsModifierKey(keysym)) {
549 // Modifier keys should not fall back to the hardware-keycode-based US
550 // layout. See crbug.com/402320
549 keycode = DefaultKeyboardCodeFromHardwareKeycode(xkey->keycode); 551 keycode = DefaultKeyboardCodeFromHardwareKeycode(xkey->keycode);
552 }
550 553
551 return keycode; 554 return keycode;
552 } 555 }
553 556
554 KeyboardCode KeyboardCodeFromXKeysym(unsigned int keysym) { 557 KeyboardCode KeyboardCodeFromXKeysym(unsigned int keysym) {
555 // TODO(sad): Have |keysym| go through the X map list? 558 // TODO(sad): Have |keysym| go through the X map list?
556 559
557 switch (keysym) { 560 switch (keysym) {
558 case XK_BackSpace: 561 case XK_BackSpace:
559 return VKEY_BACK; 562 return VKEY_BACK;
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 // alone does not map to XK_less; XKeysymToKeycode() returns KEY_102ND 1350 // alone does not map to XK_less; XKeysymToKeycode() returns KEY_102ND
1348 // (the '<>' key between Shift and Z on 105-key keyboards) which does. 1351 // (the '<>' key between Shift and Z on 105-key keyboards) which does.
1349 // 1352 //
1350 // crbug.com/386066 and crbug.com/390263 are examples of problems 1353 // crbug.com/386066 and crbug.com/390263 are examples of problems
1351 // associated with this. 1354 // associated with this.
1352 // 1355 //
1353 return XKeysymToKeycode(display, XKeysymForWindowsKeyCode(key_code, false)); 1356 return XKeysymToKeycode(display, XKeysymForWindowsKeyCode(key_code, false));
1354 } 1357 }
1355 1358
1356 } // namespace ui 1359 } // 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