• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2011 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 #include "X11/Xlib.h"
8 #include "X11/keysym.h"
9 
10 #include "SkKey.h"
11 
12 #ifndef XKEYS_TOSKKEYS_H
13 #define XKEYS_TOSKKEYS_H
14 
XKeyToSkKey(KeySym keysym)15 SkKey XKeyToSkKey(KeySym keysym) {
16     switch (keysym) {
17         case XK_BackSpace:
18             return kBack_SkKey;
19         case XK_Return:
20             return kOK_SkKey;
21         case XK_Home:
22             return kHome_SkKey;
23         case XK_End:
24             return kEnd_SkKey;
25         case XK_Right:
26             return kRight_SkKey;
27         case XK_Left:
28             return kLeft_SkKey;
29         case XK_Down:
30             return kDown_SkKey;
31         case XK_Up:
32             return kUp_SkKey;
33         case XK_KP_0:
34         case XK_KP_Insert:
35             return k0_SkKey;
36         case XK_KP_1:
37         case XK_KP_End:
38             return k1_SkKey;
39         case XK_KP_2:
40         case XK_KP_Down:
41             return k2_SkKey;
42         case XK_KP_3:
43         case XK_KP_Page_Down:
44             return k3_SkKey;
45         case XK_KP_4:
46         case XK_KP_Left:
47             return k4_SkKey;
48         case XK_KP_5:
49             return k5_SkKey;
50         case XK_KP_6:
51         case XK_KP_Right:
52             return k6_SkKey;
53         case XK_KP_7:
54         case XK_KP_Home:
55             return k7_SkKey;
56         case XK_KP_8:
57         case XK_KP_Up:
58             return k8_SkKey;
59         case XK_KP_9:
60         case XK_KP_Page_Up:
61             return k9_SkKey;
62         default:
63             return kNONE_SkKey;
64     }
65 }
66 #endif
67