Re: [patch 2/5] Renumber special keys to negative values,

Kalle Olavi Niemitalo <[email protected]>
Newsgroups gmane.comp.web.links
Message-ID <[email protected]>
Miciah Dashiel Butler Masters <[email protected]> writes:

> On Fri, Aug 04, 2006 at 02:21:25AM +0300, Kalle Olavi Niemitalo wrote:
>> -	return (kbd->key < 0) ? -1 : 0;
>> +	return (kbd->key == KBD_UNDEF) ? -1 : 0;

>> -	if (kbd->key < 0) return;
>> +	if (kbd->key == KBD_UNDEF) return;

> Maybe this should be a separate patch.

They are related; negative values were previously not used.
It could be separated though.

>> -	/* 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);

> This should be in a separate patch.

I changed the test because now that the function uses
set_kbd_interlink_event, it no longer needs to rely on the
previous value of ev->ev.
It could be separated though.

>> +	/* Values <= 0x100 are special; e.g. KBD_ENTER.
>
> Shouldn't that be -0x100?

Yes, it should.

>> +#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)

Because the name of the macro is in lower case, I wanted to make
sure it does not have more side effects than a function would.
If you think it is too cryptic, then how about an inline function?

I probably won't be able to post revised patches today.

_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev
signature.asc (application/pgp-signature, 188 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFE0u+lHm9IGt60eMgRAuQUAJoDXV8Q5jzwUBy3psSz+bazFqw+owCgnHid
4gXh8iKtoqzK2oEYqKXdSys=
=KxWa
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.