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

Side by Side Diff: ui/base/keycodes/keyboard_code_conversion_gtk.cc

Issue 7740048: Chrome Linux DRT nativeKeyCode helper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch for trys and landing. Created 9 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 | Annotate | Revision Log
« no previous file with comments | « ui/base/keycodes/keyboard_code_conversion_gtk.h ('k') | webkit/support/webkit_support.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 /* 5 /*
6 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 6 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
7 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com 7 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
8 * Copyright (C) 2007 Holger Hans Peter Freyther 8 * Copyright (C) 2007 Holger Hans Peter Freyther
9 * Copyright (C) 2008 Collabora, Ltd. All rights reserved. 9 * Copyright (C) 2008 Collabora, Ltd. All rights reserved.
10 * Copyright (C) 2008, 2009 Google Inc. 10 * Copyright (C) 2008, 2009 Google Inc.
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 case VKEY_F22: 614 case VKEY_F22:
615 case VKEY_F23: 615 case VKEY_F23:
616 case VKEY_F24: 616 case VKEY_F24:
617 return GDK_F1 + (keycode - VKEY_F1); 617 return GDK_F1 + (keycode - VKEY_F1);
618 618
619 default: 619 default:
620 return 0; 620 return 0;
621 } 621 }
622 } 622 }
623 623
624 int GdkNativeKeyCodeForWindowsKeyCode(KeyboardCode keycode, bool shift) {
625 int keyval = GdkKeyCodeForWindowsKeyCode(keycode, shift);
626 GdkKeymapKey* keys;
627 gint n_keys;
628 if (keyval && gdk_keymap_get_entries_for_keyval(0, keyval, &keys, &n_keys))
629 return keys[0].keycode;
630 return 0;
631 }
632
624 KeyboardCode KeyboardCodeFromGdkEventKey(GdkEventKey* event) { 633 KeyboardCode KeyboardCodeFromGdkEventKey(GdkEventKey* event) {
625 KeyboardCode keycode = WindowsKeyCodeForGdkKeyCode(event->keyval); 634 KeyboardCode keycode = WindowsKeyCodeForGdkKeyCode(event->keyval);
626 #ifdef USE_X11 635 #ifdef USE_X11
627 // Gtk's key values are same as X11's keysyms. 636 // Gtk's key values are same as X11's keysyms.
628 if (keycode == VKEY_UNKNOWN) { 637 if (keycode == VKEY_UNKNOWN) {
629 unsigned int keyval = 638 unsigned int keyval =
630 DefaultXKeysymFromHardwareKeycode(event->hardware_keycode); 639 DefaultXKeysymFromHardwareKeycode(event->hardware_keycode);
631 keycode = WindowsKeyCodeForGdkKeyCode(keyval); 640 keycode = WindowsKeyCodeForGdkKeyCode(keyval);
632 } 641 }
633 #endif 642 #endif
634 return keycode; 643 return keycode;
635 } 644 }
636 645
637 } // namespace ui 646 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/keycodes/keyboard_code_conversion_gtk.h ('k') | webkit/support/webkit_support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698