Cosmetics (key->keycode).

This commit is contained in:
Kim Woelders 2014-04-23 06:31:51 +02:00
parent d1f00956aa
commit 9d9fa0edf5
5 changed files with 39 additions and 39 deletions

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2013 Kim Woelders
* Copyright (C) 2004-2014 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -45,7 +45,7 @@ struct _action {
char anybutton;
int button;
char anykey;
KeyCode key;
KeyCode keycode;
char *key_str;
char *tooltipstring;
ActionType *action;
@ -104,10 +104,10 @@ ActionCreate(char event, char anymod, int mod, int anybut, int but,
aa->button = but;
aa->anykey = anykey;
if (!key || !key[0] || (event != EVENT_KEY_DOWN && event != EVENT_KEY_UP))
aa->key = 0;
aa->keycode = 0;
else
aa->key = EKeynameToKeycode(key);
aa->key_str = (aa->key) ? Estrdup(key) : NULL;
aa->keycode = EKeynameToKeycode(key);
aa->key_str = (aa->keycode) ? Estrdup(key) : NULL;
aa->tooltipstring =
(tooltipstring) ? Estrdup((tooltipstring[0]) ? tooltipstring : "?!?") :
NULL;
@ -989,14 +989,14 @@ handleAction(EWin * ewin, ActionType * action)
int
ActionclassEvent(ActionClass * ac, XEvent * ev, EWin * ewin)
{
KeyCode key;
KeyCode keycode;
int i, type, button, modifiers, ok, mouse, mask, val = 0;
Action *aa;
if (ewin && ewin->state.inhibit_actions)
return 0;
key = type = button = modifiers = mouse = 0;
keycode = type = button = modifiers = mouse = 0;
mask = Mode.masks.mod_key_mask;
@ -1004,13 +1004,13 @@ ActionclassEvent(ActionClass * ac, XEvent * ev, EWin * ewin)
{
case KeyPress:
type = EVENT_KEY_DOWN;
key = ev->xkey.keycode;
keycode = ev->xkey.keycode;
modifiers = ev->xbutton.state & mask;
mouse = 0;
break;
case KeyRelease:
type = EVENT_KEY_UP;
key = ev->xkey.keycode;
keycode = ev->xkey.keycode;
modifiers = ev->xbutton.state & mask;
mouse = 0;
break;
@ -1103,14 +1103,14 @@ ActionclassEvent(ActionClass * ac, XEvent * ev, EWin * ewin)
{
if (aa->anykey)
ok = 1;
else if (aa->key == key)
else if (aa->keycode == keycode)
ok = 1;
}
else if (aa->modifiers == modifiers)
{
if (aa->anykey)
ok = 1;
else if (aa->key == key)
else if (aa->keycode == keycode)
ok = 1;
}
}
@ -1324,12 +1324,12 @@ GrabActionKey(Action * aa)
{
int mod;
if (!aa || !aa->key)
if (!aa || !aa->keycode)
return;
mod = (aa->anymodifier) ? AnyModifier : aa->modifiers;
GrabKeySet(aa->key, mod, VROOT);
GrabKeySet(aa->keycode, mod, VROOT);
}
static void
@ -1337,10 +1337,10 @@ UnGrabActionKey(Action * aa)
{
int mod;
if (!aa->key)
if (!aa->keycode)
return;
mod = (aa->anymodifier) ? AnyModifier : aa->modifiers;
GrabKeyRelease(aa->key, mod, VROOT);
GrabKeyRelease(aa->keycode, mod, VROOT);
}

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2013 Kim Woelders
* Copyright (C) 2004-2014 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -181,7 +181,7 @@ ShowAlert(const char *title,
Colormap cmap;
int cnum, fh, x, y, ww, hh, bw, bh;
char *str1, *str2, *str3, *p;
KeyCode key;
KeyCode keycode;
int button;
char **missing_charset_list_return, *def_string_return;
int missing_charset_count_return;
@ -386,8 +386,8 @@ ShowAlert(const char *title,
switch (ev.type)
{
case KeyPress:
key = XKeysymToKeycode(dd, XK_F1);
if (key == ev.xkey.keycode)
keycode = XKeysymToKeycode(dd, XK_F1);
if (keycode == ev.xkey.keycode)
{
DRAW_BOX_IN(dd, gc, b1, 0, 0, bw, bh);
XSync(dd, False);
@ -396,8 +396,8 @@ ShowAlert(const char *title,
button = 1;
goto do_sync;
}
key = XKeysymToKeycode(dd, XK_F2);
if (key == ev.xkey.keycode)
keycode = XKeysymToKeycode(dd, XK_F2);
if (keycode == ev.xkey.keycode)
{
DRAW_BOX_IN(dd, gc, b2, 0, 0, bw, bh);
XSync(dd, False);
@ -406,8 +406,8 @@ ShowAlert(const char *title,
button = 2;
goto do_sync;
}
key = XKeysymToKeycode(dd, XK_F3);
if (key == ev.xkey.keycode)
keycode = XKeysymToKeycode(dd, XK_F3);
if (keycode == ev.xkey.keycode)
{
DRAW_BOX_IN(dd, gc, b3, 0, 0, bw, bh);
XSync(dd, False);

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2013 Kim Woelders
* Copyright (C) 2004-2014 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -144,7 +144,7 @@ struct _ditem {
};
typedef struct {
KeyCode key;
KeyCode keycode;
DialogCallbackFunc *func;
int val;
void *data;
@ -208,7 +208,7 @@ DialogBindKey(Dialog * d, const char *key, DialogCallbackFunc * func, int val,
d->keybindings[d->num_bindings - 1].val = val;
d->keybindings[d->num_bindings - 1].func = func;
d->keybindings[d->num_bindings - 1].data = data;
d->keybindings[d->num_bindings - 1].key = EKeynameToKeycode(key);
d->keybindings[d->num_bindings - 1].keycode = EKeynameToKeycode(key);
}
void
@ -1865,7 +1865,7 @@ DialogEventKeyPress(Dialog * d, XEvent * ev)
for (i = 0; i < d->num_bindings; i++)
{
if (ev->xkey.keycode != d->keybindings[i].key)
if (ev->xkey.keycode != d->keybindings[i].keycode)
continue;
d->keybindings[i].func(d, d->keybindings[i].val,
d->keybindings[i].data);

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2013 Kim Woelders
* Copyright (C) 2004-2014 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -251,7 +251,7 @@ GrabButtonRelease(unsigned int button, unsigned int modifiers, Win win)
}
void
GrabKeySet(unsigned int key, unsigned int modifiers, Win win)
GrabKeySet(unsigned int keycode, unsigned int modifiers, Win win)
{
Bool owner_events = False;
int pointer_mode = GrabModeAsync;
@ -284,14 +284,14 @@ GrabKeySet(unsigned int key, unsigned int modifiers, Win win)
num_modifiers++;
}
}
XIGrabKeycode(disp, DEV_KBD, key, WinGetXwin(win),
XIGrabKeycode(disp, DEV_KBD, keycode, WinGetXwin(win),
keyboard_mode, pointer_mode, owner_events,
&em.em, num_modifiers, modifiers_inouts);
#else
if (modifiers == AnyModifier)
{
XGrabKey(disp, key, modifiers, WinGetXwin(win), owner_events,
XGrabKey(disp, keycode, modifiers, WinGetXwin(win), owner_events,
pointer_mode, keyboard_mode);
return;
}
@ -300,14 +300,14 @@ GrabKeySet(unsigned int key, unsigned int modifiers, Win win)
{
if (i && !Mode.masks.mod_combos[i])
continue;
XGrabKey(disp, key, modifiers | Mode.masks.mod_combos[i],
XGrabKey(disp, keycode, modifiers | Mode.masks.mod_combos[i],
WinGetXwin(win), owner_events, pointer_mode, keyboard_mode);
}
#endif
}
void
GrabKeyRelease(unsigned int key, unsigned int modifiers, Win win)
GrabKeyRelease(unsigned int keycode, unsigned int modifiers, Win win)
{
int i;
@ -334,13 +334,13 @@ GrabKeyRelease(unsigned int key, unsigned int modifiers, Win win)
num_modifiers++;
}
}
XIUngrabKeycode(disp, DEV_KBD, key, WinGetXwin(win),
XIUngrabKeycode(disp, DEV_KBD, keycode, WinGetXwin(win),
num_modifiers, modifiers_inouts);
#else
if (modifiers == AnyModifier)
{
XUngrabKey(disp, key, modifiers, WinGetXwin(win));
XUngrabKey(disp, keycode, modifiers, WinGetXwin(win));
return;
}
@ -348,7 +348,7 @@ GrabKeyRelease(unsigned int key, unsigned int modifiers, Win win)
{
if (i && !Mode.masks.mod_combos[i])
continue;
XUngrabKey(disp, key, modifiers | Mode.masks.mod_combos[i],
XUngrabKey(disp, keycode, modifiers | Mode.masks.mod_combos[i],
WinGetXwin(win));
}
#endif

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2006-2012 Kim Woelders
* Copyright (C) 2006-2014 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -37,9 +37,9 @@ void GrabButtonSet(unsigned int button, unsigned int modifiers,
unsigned int csr, int confine);
void GrabButtonRelease(unsigned int button,
unsigned int modifiers, Win win);
void GrabKeySet(unsigned int key, unsigned int modifiers,
void GrabKeySet(unsigned int keycode, unsigned int modifiers,
Win win);
void GrabKeyRelease(unsigned int key, unsigned int modifiers,
void GrabKeyRelease(unsigned int keycode, unsigned int modifiers,
Win win);
#endif /* _GRABS_H_ */