[elinks-dev] [patch 04/11] terminal: Define separate structs for

Miciah Dashiel Butler Masters mdm0304 at ecu.edu
Sat Aug 5 13:34:04 MDT 2006


On Sat, Aug 05, 2006 at 09:10:40PM +0300, Kalle Olavi Niemitalo wrote:
> terminal: Define separate structs for events passed via the interlink socket.
> 
> This way, struct term_event can be changed without any interprocess
> compatibility problems.
[...]
> +struct interlink_event {
> +	enum term_event_type ev;
> +
> +	union {
> +		/* EVENT_MOUSE */
> +		struct interlink_event_mouse mouse;
> +
> +		/* EVENT_KBD */
> +		struct interlink_event_keyboard keyboard;
> +
> +		/* EVENT_INIT, EVENT_RESIZE, EVENT_REDRAW */
> +#define interlink_event_size term_event_size
> +		struct interlink_event_size size;
> +	} info;
> +};

Maybe you should do the same for enum term_event_type as you do for
struct term_event_size.

[...]
> @@ -671,7 +671,7 @@ decode_terminal_escape_sequence(struct i
>  		    && itrm->in.queue.data[3] >= 'A'
>  		    && itrm->in.queue.data[3] <= 'L') {
>  			kbd.key = KBD_F1 + itrm->in.queue.data[3] - 'A';
> -			copy_struct(&ev->info.keyboard, &kbd);
> +			set_kbd_interlink_event(ev, kbd.key, kbd.modifier);
[...]
> -	struct term_event_keyboard kbd = { KBD_UNDEF, KBD_MOD_NONE };
> +	struct interlink_event_keyboard kbd = { KBD_UNDEF, KBD_MOD_NONE };
[...]
> -			copy_struct(&ev.info.keyboard, &os2xtd[itrm->in.queue.data[1]]);
> +			set_kbd_interlink_event(&ev,
> +						os2xtd[itrm->in.queue.data[1]].key,
> +						os2xtd[itrm->in.queue.data[1]].modifier);
[...]

Maybe this isn't the best thread in which to bring this up, but reading
code like this leads me to wonder why we have set_kbd_term_event,
kbd_set, and so on. Right here, you show that we aren't doing it for
opacity, and surely they don't make such a huge dent in LOC. All they do
is hide some memsets and assignments behind mazes of macros.

-- 
Miciah Masters <miciah at myrealbox.com> / <mdm0304 at ecu.edu>



More information about the elinks-dev mailing list