[gtksourceview] Always consume left click gutter button press event



commit 3d7926700e0d9f2c964c83bb8c6265dc99134d0c
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Fri Apr 9 21:00:26 2010 +0200

    Always consume left click gutter button press event
    
    This is technically not really correct, but nobody else is using the
    event anyway. The more fundamental issue is that the cell-activated
    signal does not allow a return value indicating the event should be
    consumed. This caused the line gutter clicking things (select line,
    extend selection) to fail because the buffer got the event and removed
    the selection.

 gtksourceview/gtksourcegutter.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/gtksourceview/gtksourcegutter.c b/gtksourceview/gtksourcegutter.c
index ac861de..bebcdcc 100644
--- a/gtksourceview/gtksourcegutter.c
+++ b/gtksourceview/gtksourcegutter.c
@@ -1190,7 +1190,18 @@ on_view_button_press_event (GtkSourceView    *view,
 		g_free (path);
 		do_redraw (gutter);
 
-		return ret;
+		/* WARNING, DANGER, DANGER:
+		 * FIXME: this is really just a hack because we lack a return
+		 * value in the CELL_ACTIVATED signal, so handlers of cell
+		 * activating have no way to consume the button event. A left
+		 * click in the gutter will by default remove the selection
+		 * in the textview, which is bad because we implement some
+		 * selection stuff in gtksourceview when clicking on the line
+		 * renderer. Anyway, for 3.0 we should change the
+		 * cell-activated signal to allow a return value and remove
+		 * this hack
+		 */
+		return ret || event->button == 1;
 	}
 
 	return FALSE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]