[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[MiNT] cflib and Backspace
Can someone help ? I am pulling my hair out here trying to work out why
the (NKCC) cflib function doesn't return what I expect when I press Backspace
in a textarea of Highwire.
WORDITEM
input_keybrd (INPUT input, WORD key, UWORD state, GRECT * rect, INPUT * next)
{
FORM form = input->Form;
WORDITEM word = input->Word;
WCHAR ** text = input->TextArray;
WORD ascii_code;
WORD scrl = 0;
WORD lift = 0;
WORD line = 0;
unsigned short nkey;
BOOL shift, ctrl, alt;
printf ("1: key=%04X state=%04X\n", key, state);
/* simulate the gem_to_norm function */
printf ("gem_to_norm of %16X\n",
(
(int)(
(long) (key & 0xff) ¦ /* ascii Bits 0-7 */
(((long) key & 0x0000ff00L) << 8L) ¦ /* scan Bits 16-23 */
( (long) (state & 0xff) << 24L) /* kstate Bits 24-31 */
)
)
);
nkey = gem_to_norm ((short)state, (short)key);
printf ("2: nkey=%04X\n", nkey);
OUTPUT:
1: key=0E08 state=0000
gem_to_norm of 000E0008
2: nkey=4080
In the code snippet above I embedded a chunk of code from the cflib
function gem_to_norm so I could check some of what it does to the
arguments.
nkey is then logicalled anded with a set of flags and I expect to
get 08 which would match with NK_BS from cflib.h but since the
value is 4080 hex it is never going to give 08
#define NK_BS 0x08 /* Backspace */
My suspicion is that it might be some implicit type conversion
that I am not aware of.
Peter