// // Copyright (C) 1996 Ben Ross // // You may distribute under the terms of the GNU General Public // License as specified in the COPYING file. // // $Id: XeKeyTable.C,v 1.5 2001/08/01 11:24:24 ben Exp $ #include #include void* XeKeyTable::lookup(KeySym key, u_int& modifiers) { // clear LockMask, and PC scroll lock and numlock from modifiers // modifiers &= (~LockMask & ~XeNumLockMask & ~XeScrollLockMask); u_long tablekey; tablekey = u_long(key) | u_long((modifiers & 0x000000ff) << 16); return (*this)[tablekey]; } int XeKeyTable::add(void* ob, KeySym key, u_int modifiers) { u_long tablekey; tablekey = u_long(key) | u_long((modifiers & 0x000000ff) << 16); // $$$ may not bother doing this and return void // nobody who calls this function cares if the key mapping already exists //std::cerr << "XeKeyTable::add ob = " << ob << " key = " << XKeysymToString(key) << std::endl; if (find(tablekey) != end()) return 1; (*this)[tablekey] = ob; return 0; } void XeKeyTable::remove(KeySym key, u_int modifiers) { u_long tablekey; tablekey = u_long(key) | u_long((modifiers & 0x000000ff) << 16); this->erase(tablekey); }