X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=libchimara%2Fevent.c;h=5da6dd8e5058c60f97dbcbfaad265167ee36c561;hb=e4819b66649d4963a0661cba603c2967b02a6b80;hp=4bbb391b597bb028dc7e5a75994de54ee188858f;hpb=db8dde85ef01518d74df205d083ba1fb501b21c9;p=rodin%2Fchimara.git diff --git a/libchimara/event.c b/libchimara/event.c index 4bbb391..5da6dd8 100644 --- a/libchimara/event.c +++ b/libchimara/event.c @@ -1,6 +1,7 @@ #include "event.h" #include "magic.h" #include "glk.h" +#include "window.h" #include #include "chimara-glk.h" @@ -69,6 +70,9 @@ glk_select(event_t *event) ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key); + /* Emit the "waiting" signal to let listeners know we are ready for input */ + g_signal_emit_by_name(glk_data->self, "waiting"); + g_mutex_lock(glk_data->event_lock); /* Wait for an event */ @@ -92,6 +96,15 @@ glk_select(event_t *event) /* Check for interrupt */ glk_tick(); + + /* If the event was a line input event, the library must release the buffer */ + if(event->type == evtype_LineInput && glk_data->unregister_arr) + { + if(event->win->input_request_type == INPUT_REQUEST_LINE_UNICODE) + (*glk_data->unregister_arr)(event->win->line_input_buffer_unicode, event->win->line_input_buffer_max_len, "&+#!Iu", event->win->buffer_rock); + else + (*glk_data->unregister_arr)(event->win->line_input_buffer, event->win->line_input_buffer_max_len, "&+#!Cn", event->win->buffer_rock); + } /* If an abort event was generated, the thread should have exited by now */ g_assert(event->type != evtype_Abort); @@ -190,4 +203,4 @@ glk_select_poll(event_t *event) /* If an abort event was generated, the thread should have exited by now */ g_assert(event->type != evtype_Abort); -} \ No newline at end of file +}