aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/views/unix/XkeysToSkKeys.h
blob: aced74c0af392778aa059f47274db3620b8ba0c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * Copyright 2011 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#include "X11/Xlib.h"
#include "X11/keysym.h"

#include "SkKey.h"

#ifndef XKEYS_TOSKKEYS_H
#define XKEYS_TOSKKEYS_H

SkKey XKeyToSkKey(KeySym keysym) {
    switch (keysym) {
        case XK_BackSpace:
            return kBack_SkKey;
        case XK_Return:
            return kOK_SkKey;
        case XK_Home:
            return kHome_SkKey;
        case XK_End:
            return kEnd_SkKey;
        case XK_Right:
            return kRight_SkKey;
        case XK_Left:
            return kLeft_SkKey;
        case XK_Down:
            return kDown_SkKey;
        case XK_Up:
            return kUp_SkKey;
        case XK_KP_0:
        case XK_KP_Insert:
            return k0_SkKey;
        case XK_KP_1:
        case XK_KP_End:
            return k1_SkKey;
        case XK_KP_2:
        case XK_KP_Down:
            return k2_SkKey;
        case XK_KP_3:
        case XK_KP_Page_Down:
            return k3_SkKey;
        case XK_KP_4:
        case XK_KP_Left:
            return k4_SkKey;
        case XK_KP_5:
            return k5_SkKey;
        case XK_KP_6:
        case XK_KP_Right:
            return k6_SkKey;
        case XK_KP_7:
        case XK_KP_Home:
            return k7_SkKey;
        case XK_KP_8:
        case XK_KP_Up:
            return k8_SkKey;
        case XK_KP_9:
        case XK_KP_Page_Up:
            return k9_SkKey;
        default:
            return kNONE_SkKey;
    }
}
#endif