From: Marijn van Vliet Date: Fri, 22 May 2009 10:43:57 +0000 (+0000) Subject: * cancel_line_input_event now handles an NULL event parameter correctly X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=01a1cad6cfa515cef48436f26dcfa5c67238187b;p=rodin%2Fchimara.git * cancel_line_input_event now handles an NULL event parameter correctly * cancel_line_input_event will now fail quietly on INPUT_REQUEST_NONE git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@68 ddfedd41-794f-dd11-ae45-00112f111e67 --- diff --git a/src/input.c b/src/input.c index 89356fa..81b1664 100644 --- a/src/input.c +++ b/src/input.c @@ -276,15 +276,18 @@ glk_request_line_event_uni(winid_t win, glui32 *buf, glui32 maxlen, glui32 initl void glk_cancel_line_event(winid_t win, event_t *event) { - /* TODO: write me */ VALID_WINDOW(win, return); - g_return_if_fail(win->input_request_type != INPUT_REQUEST_NONE); g_return_if_fail(win->type != wintype_TextBuffer || win->type != wintype_TextGrid); - event->type = evtype_None; - event->win = win; - event->val1 = 0; - event->val2 = 0; + if(event != NULL) { + event->type = evtype_None; + event->win = win; + event->val1 = 0; + event->val2 = 0; + } + + if(win->input_request_type == INPUT_REQUEST_NONE) + return; g_signal_handler_block( G_OBJECT(win->widget), win->keypress_handler ); @@ -299,7 +302,7 @@ glk_cancel_line_event(winid_t win, event_t *event) chars_written = flush_text_buffer(win); } - if(chars_written > 0) { + if(event != NULL && chars_written > 0) { event->type = evtype_LineInput; event->val1 = chars_written; }