5 * glk_request_mouse_event:
6 * @win: Window on which to request a mouse input event.
8 * Requests mouse input on the window @win.
11 glk_request_mouse_event(winid_t win)
13 VALID_WINDOW(win, return);
14 g_return_if_fail(win != NULL);
15 g_return_if_fail(win->type == wintype_TextGrid || win->type == wintype_Graphics);
17 g_signal_handler_unblock(win->widget, win->button_press_event_handler);
21 * glk_cancel_mouse_event:
22 * @win: Window with a mouse input event pending.
24 * Cancels the pending mouse input request on @win.
27 glk_cancel_mouse_event(winid_t win)
29 VALID_WINDOW(win, return);
30 g_return_if_fail(win != NULL);
31 g_return_if_fail(win->type == wintype_TextGrid || win->type == wintype_Graphics);
33 g_signal_handler_block(win->widget, win->button_press_event_handler);
37 on_window_button_press(GtkWidget *widget, GdkEventButton *event, winid_t win)
39 ChimaraGlk *glk = CHIMARA_GLK(gtk_widget_get_ancestor(win->widget, CHIMARA_TYPE_GLK));
44 case wintype_TextGrid:
45 event_throw(glk, evtype_MouseInput, win, event->x/win->unit_width, event->y/win->unit_height);
47 case wintype_Graphics:
48 event_throw(glk, evtype_MouseInput, win, event->x, event->y);
51 ILLEGAL_PARAM("Unknown window type: %u", win->type);
54 g_signal_handler_block(win->widget, win->button_press_event_handler);