From: rodin Date: Mon, 18 Jan 2010 22:28:33 +0000 (+0000) Subject: Completed mouse support. X-Git-Tag: v0.9~252 X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=0366119dcf975f6845d284bfe1cca5e00a2385a0;p=projects%2Fchimara%2Fchimara.git Completed mouse support. --- diff --git a/libchimara/gestalt.c b/libchimara/gestalt.c index f7ac63a..a9412c3 100644 --- a/libchimara/gestalt.c +++ b/libchimara/gestalt.c @@ -111,9 +111,12 @@ glk_gestalt_ext(glui32 sel, glui32 val, glui32 *arr, glui32 arrlen) /* Hyperlinks supported on textbuffers and textgrids */ case gestalt_HyperlinkInput: return val == wintype_TextBuffer || val == wintype_TextGrid; + + /* Mouse support present in textgrids */ + case gestalt_MouseInput: + return val == wintype_TextGrid; /* Unsupported capabilities */ - case gestalt_MouseInput: case gestalt_Graphics: case gestalt_DrawImage: case gestalt_Sound: diff --git a/libchimara/mouse.c b/libchimara/mouse.c index f6c23b2..98d522f 100644 --- a/libchimara/mouse.c +++ b/libchimara/mouse.c @@ -6,7 +6,7 @@ glk_request_mouse_event(winid_t win) { VALID_WINDOW(win, return); g_return_if_fail(win != NULL); - g_return_if_fail(win->type == wintype_TextBuffer || win->type == wintype_TextGrid); + g_return_if_fail(win->type == wintype_TextGrid); g_signal_handler_unblock(win->widget, win->button_press_event_handler); } @@ -16,7 +16,7 @@ glk_cancel_mouse_event(winid_t win) { VALID_WINDOW(win, return); g_return_if_fail(win != NULL); - g_return_if_fail(win->type == wintype_TextBuffer || win->type == wintype_TextGrid); + g_return_if_fail(win->type == wintype_TextGrid); g_signal_handler_block(win->widget, win->button_press_event_handler); } @@ -27,8 +27,7 @@ on_window_button_press(GtkWidget *widget, GdkEventButton *event, winid_t win) ChimaraGlk *glk = CHIMARA_GLK(gtk_widget_get_ancestor(win->widget, CHIMARA_TYPE_GLK)); g_assert(glk); - /* TODO: calculate coordinates in proper metric */ - event_throw(glk, evtype_MouseInput, win, event->x, event->y); + event_throw(glk, evtype_MouseInput, win, event->x/win->unit_width, event->y/win->unit_height); return TRUE; } diff --git a/libchimara/window.c b/libchimara/window.c index ecc8e96..b9c9c14 100644 --- a/libchimara/window.c +++ b/libchimara/window.c @@ -547,8 +547,6 @@ glk_window_open(winid_t split, glui32 method, glui32 size, glui32 wintype, g_signal_handler_block(textview, win->shutdown_keypress_handler); win->insert_text_handler = g_signal_connect_after( textbuffer, "insert-text", G_CALLBACK(after_window_insert_text), win ); g_signal_handler_block(textbuffer, win->insert_text_handler); - win->button_press_event_handler = g_signal_connect( textview, "button-press-event", G_CALLBACK(on_window_button_press), win ); - g_signal_handler_block(textview, win->button_press_event_handler); /* Create an editable tag to indicate uneditable parts of the window (for line input) */