From e56d00f27fbd76b14a71869c2a5d83e19fdeaa58 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 24 Mar 2020 19:51:01 +0900 Subject: [PATCH] [qwaq] Make qwaq_message_t more useful Couldn't use @param because of its use in gcc as well as qfcc. --- ruamoko/qwaq/event.h | 16 +++++++++++++--- ruamoko/qwaq/qwaq-app.r | 8 ++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ruamoko/qwaq/event.h b/ruamoko/qwaq/event.h index 1f122fc44..d11fd195e 100644 --- a/ruamoko/qwaq/event.h +++ b/ruamoko/qwaq/event.h @@ -23,7 +23,7 @@ typedef enum { qe_none = 0x0000, qe_mouse = 0x001f, qe_key = 0x0020, - qe_system = 0x01c0, + qe_system = 0x01c0, //FIXME this isn't very manageable qe_message = 0xfe00, qe_focused = qe_key | qe_command, @@ -52,8 +52,18 @@ typedef struct qwaq_resize_s { int height; } qwaq_resize_t; -typedef struct qwaq_message_s { - qwaq_command command; +typedef union qwaq_message_s { + 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; typedef struct qwaq_event_s { diff --git a/ruamoko/qwaq/qwaq-app.r b/ruamoko/qwaq/qwaq-app.r index 04c9a95ed..4d46e53e6 100644 --- a/ruamoko/qwaq/qwaq-app.r +++ b/ruamoko/qwaq/qwaq-app.r @@ -106,12 +106,12 @@ arp_end (void) if (event.what == qe_key && (event.key.code == '\x18' || event.key.code == '\x11')) { event.what = qe_command; - event.message.command = qc_exit; + event.message.int_val = qc_exit; } if (event.what == qe_command - && (event.message.command == qc_exit - || event.message.command == qc_error)) { - endState = event.message.command; + && (event.message.int_val == qc_exit + || event.message.int_val == qc_error)) { + endState = event.message.int_val;; } [objects handleEvent: event]; return self;