OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 15 matching lines...) Expand all Loading... |
26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
28 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 28 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
29 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 29 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
32 */ | 32 */ |
33 | 33 |
34 // WindowsKeyCodeForGdkKeyCode is copied from platform/gtk/KeyEventGtk.cpp | 34 // WindowsKeyCodeForGdkKeyCode is copied from platform/gtk/KeyEventGtk.cpp |
35 | 35 |
36 #include "base/keyboard_code_conversion_gtk.h" | 36 #include "app/keyboard_code_conversion_gtk.h" |
37 | 37 |
38 #include <gdk/gdkkeysyms.h> | 38 #include <gdk/gdkkeysyms.h> |
39 | 39 |
40 #include "base/keyboard_codes_posix.h" | 40 #include "app/keyboard_codes_posix.h" |
41 | 41 |
42 namespace base { | 42 namespace app { |
43 | 43 |
44 base::KeyboardCode WindowsKeyCodeForGdkKeyCode(int keycode) { | 44 app::KeyboardCode WindowsKeyCodeForGdkKeyCode(int keycode) { |
45 switch (keycode) { | 45 switch (keycode) { |
46 case GDK_KP_0: | 46 case GDK_KP_0: |
47 return VKEY_NUMPAD0; // (60) Numeric keypad 0 key | 47 return VKEY_NUMPAD0; // (60) Numeric keypad 0 key |
48 case GDK_KP_1: | 48 case GDK_KP_1: |
49 return VKEY_NUMPAD1; // (61) Numeric keypad 1 key | 49 return VKEY_NUMPAD1; // (61) Numeric keypad 1 key |
50 case GDK_KP_2: | 50 case GDK_KP_2: |
51 return VKEY_NUMPAD2; // (62) Numeric keypad 2 key | 51 return VKEY_NUMPAD2; // (62) Numeric keypad 2 key |
52 case GDK_KP_3: | 52 case GDK_KP_3: |
53 return VKEY_NUMPAD3; // (63) Numeric keypad 3 key | 53 return VKEY_NUMPAD3; // (63) Numeric keypad 3 key |
54 case GDK_KP_4: | 54 case GDK_KP_4: |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 case GDK_F15: | 396 case GDK_F15: |
397 case GDK_F16: | 397 case GDK_F16: |
398 case GDK_F17: | 398 case GDK_F17: |
399 case GDK_F18: | 399 case GDK_F18: |
400 case GDK_F19: | 400 case GDK_F19: |
401 case GDK_F20: | 401 case GDK_F20: |
402 case GDK_F21: | 402 case GDK_F21: |
403 case GDK_F22: | 403 case GDK_F22: |
404 case GDK_F23: | 404 case GDK_F23: |
405 case GDK_F24: | 405 case GDK_F24: |
406 return static_cast<base::KeyboardCode>(VKEY_F1 + (keycode - GDK_F1)); | 406 return static_cast<app::KeyboardCode>(VKEY_F1 + (keycode - GDK_F1)); |
407 default: | 407 default: |
408 return VKEY_UNKNOWN; | 408 return VKEY_UNKNOWN; |
409 } | 409 } |
410 } | 410 } |
411 | 411 |
412 // TODO(jcampan): this method might be incomplete. | 412 // TODO(jcampan): this method might be incomplete. |
413 int GdkKeyCodeForWindowsKeyCode(base::KeyboardCode keycode, bool shift) { | 413 int GdkKeyCodeForWindowsKeyCode(app::KeyboardCode keycode, bool shift) { |
414 switch (keycode) { | 414 switch (keycode) { |
415 case VKEY_NUMPAD0: | 415 case VKEY_NUMPAD0: |
416 return GDK_KP_0; | 416 return GDK_KP_0; |
417 case VKEY_NUMPAD1: | 417 case VKEY_NUMPAD1: |
418 return GDK_KP_1; | 418 return GDK_KP_1; |
419 case VKEY_NUMPAD2: | 419 case VKEY_NUMPAD2: |
420 return GDK_KP_2; | 420 return GDK_KP_2; |
421 case VKEY_NUMPAD3: | 421 case VKEY_NUMPAD3: |
422 return GDK_KP_3; | 422 return GDK_KP_3; |
423 case VKEY_NUMPAD4: | 423 case VKEY_NUMPAD4: |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 case VKEY_F22: | 607 case VKEY_F22: |
608 case VKEY_F23: | 608 case VKEY_F23: |
609 case VKEY_F24: | 609 case VKEY_F24: |
610 return GDK_F1 + (keycode - VKEY_F1); | 610 return GDK_F1 + (keycode - VKEY_F1); |
611 | 611 |
612 default: | 612 default: |
613 return 0; | 613 return 0; |
614 } | 614 } |
615 } | 615 } |
616 | 616 |
617 } // namespace base | 617 } // namespace app |
OLD | NEW |