3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Asger and Jürgen
8 * Full author contact details are available in file CREDITS.
13 #include "XLyXKeySym.h"
18 #include <X11/keysym.h>
24 bool operator==(LyXKeySym const & k1, LyXKeySym const & k2)
26 using lyx::frontend::XLyXKeySym;
27 return static_cast<XLyXKeySym const &>(k1).keysym()
28 == static_cast<XLyXKeySym const &>(k2).keysym();
35 XLyXKeySym::XLyXKeySym()
36 : LyXKeySym(), keysym_(NoSymbol)
41 void XLyXKeySym::initFromKeySym(KeySym ks)
47 void XLyXKeySym::init(string const & symbolname)
49 keysym_ = XStringToKeysym(symbolname.c_str());
50 if (keysym_ == NoSymbol) {
52 << "XLyXKeySym.C: No such keysym: "
53 << symbolname << endl;
58 bool XLyXKeySym::isOK() const
60 return keysym_ != NoSymbol;
64 bool XLyXKeySym::isModifier() const
66 // Can we be sure that this will work for all X Window
67 // implementations? (Lgb)
68 // Perhaps all of them should be explictly mentioned?
69 return ((keysym_ >= XK_Shift_L && keysym_ <= XK_Hyper_R)
70 || keysym_ == XK_Mode_switch || keysym_ == 0x0);
74 string XLyXKeySym::getSymbolName() const
76 char * name = XKeysymToString(keysym_);
77 return name ? name : string();
81 char XLyXKeySym::getISOEncoded(string const &) const
83 if (keysym_ == NoSymbol) {
87 unsigned int c = keysym_;
89 switch (c & 0x0000FF00) {
91 case 0x00000000: break;
102 // latin 8 byte 3 = 18 (0x12)
104 // latin 9 byte 3 = 19 (0x13)
115 string const XLyXKeySym::print(key_modifier::state mod) const
117 return kb_keymap::printKeySym(*this, mod);
120 } // namespace frontend