19 #include <X11/keysym.h>
20 #include <X11/Xutil.h>
23 #define aw_assert(bed) arb_assert(bed)
110 #if defined(ASSERTION_USED)
112 #endif // ASSERTION_USED
119 modlist[0] = awxk->
xmod;
120 modsize = modlist[0] ? 1 : 0;
122 XRebindKeysym(display, awxk->
xkey, modlist, modsize,
123 (
unsigned char*)awxk->
xstr, strlen(awxk->
xstr));
129 #if defined(ASSERTION_USED)
131 #endif // ASSERTION_USED
142 if (!awxkeymap_modfree[i].xstr_suffix)
break;
149 generatedKeymaps_count = modfree*
MODS;
150 ARB_calloc(generatedKeymaps, generatedKeymaps_count);
152 for (i=0; i<modfree; ++i) {
154 for (
int j = 0; j<
MODS; ++j) {
155 awXKeymap *km = generatedKeymaps+i*MODS+j;
171 if (awxkeymap[i].xstr == (
char*)1)
break;
186 free(generatedKeymaps); generatedKeymaps =
NULp;
188 if (awxkeymap_xkey_2_key_hash) {
GBS_free_numhash(awxkeymap_xkey_2_key_hash); awxkeymap_xkey_2_key_hash =
NULp; }
189 if (awxkeymap_string_2_key_hash) {
GBS_free_hash (awxkeymap_string_2_key_hash); awxkeymap_string_2_key_hash =
NULp; }
199 bool numlockwason =
false;
209 int count = XLookupString(xkeyevent, buffer, BUFFERSIZE, &keysym,
NULp);
212 if (!buffer[0] && count) {
213 #if defined(DUMP_KEYEVENTS)
214 printf(
"special case: Ctrl-Space\n");
220 #if defined(DUMP_KEYEVENTS)
221 printf(
"state=%u keycode=%u name='%s' ", xkeyevent->state, xkeyevent->keycode, buffer);
222 #endif // DUMP_KEYEVENTS
224 if (keysym >= XK_space && keysym <= XK_asciitilde) {
233 static bool warned =
false;
235 aw_message(
"Warning: Accelerator keys only work if NUMLOCK is off!");
240 #if defined(DUMP_KEYEVENTS)
241 printf(
"AW_KEY_ASCII:");
242 #endif // DUMP_KEYEVENTS
247 if (count && (ptr =
GBS_read_hash(awxkeymap_string_2_key_hash, buffer))) {
250 #if defined(DUMP_KEYEVENTS)
251 printf(
"_awxkeymap_string_2_key_hash['%s']=", buffer);
252 #endif // DUMP_KEYEVENTS
257 #if defined(DUMP_KEYEVENTS)
258 printf(
"_awxkeymap_xkey_2_key_hash['%x']='%s'", (
unsigned)keysym, result->
xstr);
259 #endif // DUMP_KEYEVENTS
268 #if defined(DUMP_KEYEVENTS)
269 printf(
"Undefined key (keysym=%x)", (
unsigned)keysym);
270 if (count) printf(
" name='%s'", buffer);
271 #endif // DUMP_KEYEVENTS
274 #if defined(DUMP_KEYEVENTS)
275 printf(
" key='%u' mod='%u' awstr='%s'\n", result->
awkey, result->
awmod, result->
awstr);
276 #endif // DUMP_KEYEVENTS
void aw_install_xkeys(Display *display)
static GB_HASH * awxkeymap_string_2_key_hash
long GBS_write_hash(GB_HASH *hs, const char *key, long val)
static GB_NUMHASH * awxkeymap_xkey_2_key_hash
#define TERMINATED_ARRAY_ELEMS(array)
long GBS_write_numhash(GB_NUMHASH *hs, long key, long val)
GB_NUMHASH * GBS_create_numhash(size_t estimated_elements)
void GBS_free_hash(GB_HASH *hs)
#define ARRAY_ELEMS(array)
char buffer[MESSAGE_BUFFERSIZE]
static struct aisc_static_set_mem md
static awXKeymap awxkeymap[]
static int generatedKeymaps_count
long GBS_read_numhash(GB_NUMHASH *hs, long key)
const awXKeymap * aw_xkey_2_awkey(XKeyEvent *xkeyevent)
static awXKeymap_modfree awxkeymap_modfree[]
void GBS_free_numhash(GB_NUMHASH *hs)
TYPE * ARB_calloc(size_t nelem)
static awXKeymap * generatedKeymaps
void aw_message(const char *msg)
void aw_uninstall_xkeys()
static void map_awXKey(Display *display, const awXKeymap *awxk)
long GBS_read_hash(const GB_HASH *hs, const char *key)
char * GBS_global_string_copy(const char *templat,...)
GB_HASH * GBS_create_hash(long estimated_elements, GB_CASE case_sens)