3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Asger and Juergen
8 * Full author contact details are available in file CREDITS.
13 #include "XLyXKeySym.h"
17 #include <X11/keysym.h>
22 XLyXKeySym::XLyXKeySym()
23 : LyXKeySym(), keysym_(NoSymbol)
28 void XLyXKeySym::initFromKeySym(KeySym ks)
34 void XLyXKeySym::init(string const & symbolname)
36 keysym_ = XStringToKeysym(symbolname.c_str());
37 if (keysym_ == NoSymbol) {
39 << "XLyXKeySym.C: No such keysym: "
40 << symbolname << endl;
45 bool XLyXKeySym::isOK() const
47 return keysym_ != NoSymbol;
51 bool XLyXKeySym::isModifier() const
53 // Can we be sure that this will work for all X Window
54 // implementations? (Lgb)
55 // Perhaps all of them should be explictly mentioned?
56 return ((keysym_ >= XK_Shift_L && keysym_ <= XK_Hyper_R)
57 || keysym_ == XK_Mode_switch || keysym_ == 0x0);
61 string XLyXKeySym::getSymbolName() const
63 char * name = XKeysymToString(keysym_);
64 return name ? name : string();
68 char XLyXKeySym::getISOEncoded(string const &) const
70 if (keysym_ == NoSymbol) {
74 unsigned int c = keysym_;
76 switch (c & 0x0000FF00) {
78 case 0x00000000: break;
89 // latin 8 byte 3 = 18 (0x12)
91 // latin 9 byte 3 = 19 (0x13)
102 bool operator==(LyXKeySym const & k1, LyXKeySym const & k2)
104 return static_cast<XLyXKeySym const &>(k1).keysym()
105 == static_cast<XLyXKeySym const &>(k2).keysym();