librime: key_table.h Source File

| librime 1.2 Rime Input Method Engine, the core library

key_table.h
Go to the documentation of this file.
1// encoding: utf-8
2//
3// Copyright RIME Developers
4// Distributed under the BSD License
5//
6// 2011-04-17 GONG Chen <chen.sst@gmail.com>
7//
8#ifndef RIME_KEY_TABLE_H_
9#define RIME_KEY_TABLE_H_
10
11#include <X11/keysym.h>
12#include <rime_api.h>
13
14 typedef enum {
15 kShiftMask = 1 << 0,
16 kLockMask = 1 << 1,
17 kControlMask = 1 << 2,
18 kMod1Mask = 1 << 3,
19 kAltMask = kMod1Mask,
20 kMod2Mask = 1 << 4,
21 kMod3Mask = 1 << 5,
22 kMod4Mask = 1 << 6,
23 kMod5Mask = 1 << 7,
24 kButton1Mask = 1 << 8,
25 kButton2Mask = 1 << 9,
26 kButton3Mask = 1 << 10,
27 kButton4Mask = 1 << 11,
28 kButton5Mask = 1 << 12,
29
30 /* The next few modifiers are used by XKB, so we skip to the end.
31 * Bits 15 - 23 are currently unused. Bit 29 is used internally.
32 */
33
34 /* ibus :) mask */
35 kHandledMask = 1 << 24,
36 kForwardMask = 1 << 25,
37 kIgnoredMask = kForwardMask,
38
39 kSuperMask = 1 << 26,
40 kHyperMask = 1 << 27,
41 kMetaMask = 1 << 28,
42
43 kReleaseMask = 1 << 30,
44
45 kModifierMask = 0x5f001fff
46} RimeModifier;
47
48// 给定modifier文字，返回马赛克值
49// 例如 RimeGetModifierByName("Alt") == (1 << 3)
50// 如果不认得所给的键名，返回 0
51 RIME_DLL int RimeGetModifierByName(const char* name);
52
53// 给一个数值，取得最低的非0位所对应的modifier文字
54// 例如 RimeGetModifierName(12) == "Control"
55// 取不到则返回 NULL
56 RIME_DLL const char* RimeGetModifierName(int modifier);
57
58// 由键名取得键值
59// 查无此键则返回 XK_VoidSymbol
60 RIME_DLL int RimeGetKeycodeByName(const char* name);
61
62// 由键值取得键名
63// 不认得此键，则返回 NULL
64 RIME_DLL const char* RimeGetKeyName(int keycode);
65
66#endif // RIME_KEY_TABLE_H_
keysym.h
RimeGetModifierByName
RIME_DLL int RimeGetModifierByName(const char *name)
Definition key_table.cc:2003
RimeGetKeyName
RIME_DLL const char * RimeGetKeyName(int keycode)
Definition key_table.cc:2035
RimeGetModifierName
RIME_DLL const char * RimeGetModifierName(int modifier)
Definition key_table.cc:2015
RimeGetKeycodeByName
RIME_DLL int RimeGetKeycodeByName(const char *name)
Definition key_table.cc:2026
RimeModifier
RimeModifier
Definition key_table.h:14
kModifierMask
@ kModifierMask
Definition key_table.h:45
kControlMask
@ kControlMask
Definition key_table.h:17
kMod1Mask
@ kMod1Mask
Definition key_table.h:18
kMod5Mask
@ kMod5Mask
Definition key_table.h:23
kForwardMask
@ kForwardMask
Definition key_table.h:36
kLockMask
@ kLockMask
Definition key_table.h:16
kMod4Mask
@ kMod4Mask
Definition key_table.h:22
kButton2Mask
@ kButton2Mask
Definition key_table.h:25
kButton1Mask
@ kButton1Mask
Definition key_table.h:24
kButton5Mask
@ kButton5Mask
Definition key_table.h:28
kHyperMask
@ kHyperMask
Definition key_table.h:40
kButton4Mask
@ kButton4Mask
Definition key_table.h:27
kMod2Mask
@ kMod2Mask
Definition key_table.h:20
kSuperMask
@ kSuperMask
Definition key_table.h:39
kShiftMask
@ kShiftMask
Definition key_table.h:15
kMod3Mask
@ kMod3Mask
Definition key_table.h:21
kAltMask
@ kAltMask
Definition key_table.h:19
kMetaMask
@ kMetaMask
Definition key_table.h:41
kIgnoredMask
@ kIgnoredMask
Definition key_table.h:37
kReleaseMask
@ kReleaseMask
Definition key_table.h:43
kButton3Mask
@ kButton3Mask
Definition key_table.h:26
kHandledMask
@ kHandledMask
Definition key_table.h:35
rime_api.h
RIME_DLL
#define RIME_DLL
Definition rime_api.h:33