+
+/*** Internal function: cancels any pending input requests on the window and presents a warning if not INPUT_REQUEST_NONE ***/
+void
+cancel_old_input_request(winid_t win)
+{
+ switch(win->input_request_type) {
+ case INPUT_REQUEST_NONE:
+ break; /* All is well */
+ case INPUT_REQUEST_CHARACTER:
+ case INPUT_REQUEST_CHARACTER_UNICODE:
+ glk_cancel_char_event(win);
+ WARNING("Cancelling pending char event");
+ break;
+ case INPUT_REQUEST_LINE:
+ case INPUT_REQUEST_LINE_UNICODE:
+ glk_cancel_line_event(win, NULL);
+ WARNING("Cancelling pending line event");
+ break;
+ default:
+ WARNING("Could not cancel pending input request: unknown input request");
+ }
+}