Completed mouse support.
authorMarijn van Vliet <marijn.vanvliet@med.kuleuven.be>
Mon, 18 Jan 2010 22:28:33 +0000 (22:28 +0000)
committerMarijn van Vliet <marijn.vanvliet@med.kuleuven.be>
Mon, 18 Jan 2010 22:28:33 +0000 (22:28 +0000)
git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@213 ddfedd41-794f-dd11-ae45-00112f111e67

libchimara/gestalt.c
libchimara/mouse.c
libchimara/window.c

index f7ac63a8a5cc5a84324086c57f3d12e3a423e454..a9412c38b769c3c69ad6136d914804f39565105e 100644 (file)
@@ -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:
index f6c23b229e3b595114e26fa3b21c9991c1f46c06..98d522ff795d603359830fbef37d2b34d8defc31 100644 (file)
@@ -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;
 }
index ecc8e96a253e3a9561249784b60dbbf0615052d2..b9c9c147d1f04cc28c4ad60001d29a3198ce538f 100644 (file)
@@ -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) */