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

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

Issue 7777006: Chrome Linux DRT nativeKeyCode helper #2 (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 | « 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) 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) { 624 int GdkNativeKeyCodeForWindowsKeyCode(KeyboardCode keycode, bool shift) {
625 int keyval = GdkKeyCodeForWindowsKeyCode(keycode, shift); 625 int keyval = GdkKeyCodeForWindowsKeyCode(keycode, shift);
626 GdkKeymapKey* keys; 626 GdkKeymapKey* keys;
627 gint n_keys; 627 gint n_keys;
628 if (keyval && gdk_keymap_get_entries_for_keyval(0, keyval, &keys, &n_keys)) 628
629 return keys[0].keycode; 629 int native_keycode = 0;
630 return 0; 630 if (keyval && gdk_keymap_get_entries_for_keyval(0, keyval, &keys, &n_keys)) {
631 native_keycode = keys[0].keycode;
632 g_free(keys);
633 }
634
635 return native_keycode;
631 } 636 }
632 637
633 KeyboardCode KeyboardCodeFromGdkEventKey(GdkEventKey* event) { 638 KeyboardCode KeyboardCodeFromGdkEventKey(GdkEventKey* event) {
634 KeyboardCode keycode = WindowsKeyCodeForGdkKeyCode(event->keyval); 639 KeyboardCode keycode = WindowsKeyCodeForGdkKeyCode(event->keyval);
635 #ifdef USE_X11 640 #ifdef USE_X11
636 // Gtk's key values are same as X11's keysyms. 641 // Gtk's key values are same as X11's keysyms.
637 if (keycode == VKEY_UNKNOWN) { 642 if (keycode == VKEY_UNKNOWN) {
638 unsigned int keyval = 643 unsigned int keyval =
639 DefaultXKeysymFromHardwareKeycode(event->hardware_keycode); 644 DefaultXKeysymFromHardwareKeycode(event->hardware_keycode);
640 keycode = WindowsKeyCodeForGdkKeyCode(keyval); 645 keycode = WindowsKeyCodeForGdkKeyCode(keyval);
641 } 646 }
642 #endif 647 #endif
643 return keycode; 648 return keycode;
644 } 649 }
645 650
646 } // namespace ui 651 } // 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