Re: [AD] num lock dependent scancode conversion |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
stephen.kittelson@xxxxxxxxxx <stephen.kittelson@xxxxxxxxxx> wrote:
>
> Is my suggestion for scancode conversion, that has to be enabled by
> setting a flag, rejected?
I don't plan to speak for those who hold the keys to CVS, but here
are my thoughts and a solution.
1. It is not a commonly requested feature and although it is only
enabled through a flag, it still bloats the library,
2. The patch was a hack (no offense, but `keypad_keysdn' was like
fitting a square peg through a round hole),
3. It can be achieved just as easily and comfortably in userspace
with something like the attached (which affects `ureadkey').
--
tjaden@xxxxxxxxxx - http://www.psynet.net/tjaden/
BRIMPLET (BRIM plit), n. A frayed shoelace that must be moistened to pass
through a shoe eyelet. -- Rich Hall, "Sniglets"
#include <allegro.h>
static int ucallback (int key, int *sc)
{
if (!(key_shifts & KB_NUMLOCK_FLAG))
switch (*sc) {
case KEY_0_PAD: *sc = KEY_INSERT; break;
case KEY_1_PAD: *sc = KEY_END; break;
case KEY_2_PAD: *sc = KEY_DOWN; break;
case KEY_3_PAD: *sc = KEY_PGDN; break;
case KEY_4_PAD: *sc = KEY_LEFT; break;
case KEY_6_PAD: *sc = KEY_RIGHT; break;
case KEY_7_PAD: *sc = KEY_HOME; break;
case KEY_8_PAD: *sc = KEY_UP; break;
case KEY_9_PAD: *sc = KEY_PGUP; break;
}
return key;
}
END_OF_STATIC_FUNCTION (ucallback);
int install_nld_ureadkey ()
{
if (!keyboard_driver)
return -1;
LOCK_FUNCTION (ucallback);
keyboard_ucallback = ucallback;
return 0;
}