[qwaq] Make qwaq_message_t more useful

Couldn't use @param because of its use in gcc as well as qfcc.
This commit is contained in:
Bill Currie 2020-03-24 19:51:01 +09:00
parent 0bbef18786
commit e56d00f27f
2 changed files with 17 additions and 7 deletions

View file

@ -23,7 +23,7 @@ typedef enum {
qe_none = 0x0000, qe_none = 0x0000,
qe_mouse = 0x001f, qe_mouse = 0x001f,
qe_key = 0x0020, qe_key = 0x0020,
qe_system = 0x01c0, qe_system = 0x01c0, //FIXME this isn't very manageable
qe_message = 0xfe00, qe_message = 0xfe00,
qe_focused = qe_key | qe_command, qe_focused = qe_key | qe_command,
@ -52,8 +52,18 @@ typedef struct qwaq_resize_s {
int height; int height;
} qwaq_resize_t; } qwaq_resize_t;
typedef struct qwaq_message_s { typedef union qwaq_message_s {
qwaq_command command; int int_val;
float float_val;
float vector_val[4]; // vector and quaternion
double double_val;
#ifdef __QFCC__
void *pointer_val;
string string_val;
#else
pointer_t pointer_val;
string_t string_val;
#endif
} qwaq_message_t; } qwaq_message_t;
typedef struct qwaq_event_s { typedef struct qwaq_event_s {

View file

@ -106,12 +106,12 @@ arp_end (void)
if (event.what == qe_key if (event.what == qe_key
&& (event.key.code == '\x18' || event.key.code == '\x11')) { && (event.key.code == '\x18' || event.key.code == '\x11')) {
event.what = qe_command; event.what = qe_command;
event.message.command = qc_exit; event.message.int_val = qc_exit;
} }
if (event.what == qe_command if (event.what == qe_command
&& (event.message.command == qc_exit && (event.message.int_val == qc_exit
|| event.message.command == qc_error)) { || event.message.int_val == qc_error)) {
endState = event.message.command; endState = event.message.int_val;;
} }
[objects handleEvent: event]; [objects handleEvent: event];
return self; return self;