On Fri, Aug 04, 2006 at 02:21:25AM +0300, Kalle Olavi Niemitalo wrote:
> Renumber special keys to negative values, making room for Unicode.
[...]
> diff --git a/src/config/kbdbind.c b/src/config/kbdbind.c
> index 0e3996e..abc2809 100644
> --- a/src/config/kbdbind.c
> +++ b/src/config/kbdbind.c
> @@ -437,7 +437,7 @@ parse_keystroke(unsigned char *s, int ca
> }
>
> kbd->key = read_key(s);
> - return (kbd->key < 0) ? -1 : 0;
> + return (kbd->key == KBD_UNDEF) ? -1 : 0;
> }
>
> void
> @@ -449,7 +449,7 @@ add_keystroke_to_string(struct string *s
> struct key *key;
> const struct modifier *modp;
>
> - if (kbd->key < 0) return;
> + if (kbd->key == KBD_UNDEF) return;
>
> for (modp = modifiers; modp->name_and_dash != NULL; ++modp) {
> if (kbd->modifier & modp->bitmask)
Maybe this should be a separate patch.
> diff --git a/src/terminal/kbd.c b/src/terminal/kbd.c
> index a2a8827..07fd305 100644
> --- a/src/terminal/kbd.c
> +++ b/src/terminal/kbd.c
[...]
> @@ -770,10 +770,9 @@ #endif /* CONFIG_MOUSE */
> break;
> }
>
> - /* The event might have been changed to a mouse event */
> - if (ev->ev == EVENT_KBD && kbd.key != KBD_UNDEF) {
> - copy_struct(&ev->info.keyboard, &kbd);
> - }
> + /* KBD_UNDEF here means it was unrecognized or a mouse event. */
> + if (kbd.key != KBD_UNDEF)
> + set_kbd_interlink_event(ev, kbd.key, kbd.modifier);
>
> return el;
> }
This should be in a separate patch. I was wondering what you had changed
in this or the previous patch that made it safe to remove the check for
ev->ev == EVENT_KBD, and then I realised that this check had been
unnecessary all along as kbd.key is initialised to KBD_UNDEF and is not
changed if decode_terminal_mouse_escape_sequence is called. I.e.,
mixing this change in confused me.
[...]
> diff --git a/src/terminal/kbd.h b/src/terminal/kbd.h
> index d8d5462..fb101cc 100644
> --- a/src/terminal/kbd.h
> +++ b/src/terminal/kbd.h
> @@ -4,46 +4,58 @@ #define EL__TERMINAL_KBD_H
> struct itrm;
>
> struct term_event_keyboard {
> + /* Values <= 0x100 are special; e.g. KBD_ENTER.
Shouldn't that be -0x100?
[...]
> #define KBD_UNDEF -1
Maybe a note here that these are values for struct term_event_keyboard,
not struct interlink_event_keyboard.
[...]
> +#define is_kbd_fkey(key) ((unsigned long) (KBD_F1 - (key)) <= (unsigned
> long) (KBD_F1 - KBD_F12))
[...]
Does it need to be this cryptic? How about just:
#define is_kbd_fkey(key) ((key) <= KBD_F1 && (key) >= KBD_F12)
--
Miciah Masters <[EMAIL PROTECTED]> / <[EMAIL PROTECTED]>
_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev