Permalink
Browse files

Don't set the focus to the editor widget when clicking a symbol while…

… holding Control

When clicking a symbol in the Symbols sidebar and holding the Control modifier key, don't
set the focus to the editor widget so further navigation in the Symbols sidebar with keys
is possible.
  • Loading branch information...
1 parent 49dafc8 commit 8171af611fefe24561fee70cfe5785afd649c595 @eht16 eht16 committed Sep 9, 2012
Showing with 11 additions and 6 deletions.
  1. +11 −6 src/sidebar.c
View
@@ -877,11 +877,12 @@ static gboolean openfiles_go_to_selection(GtkTreeSelection *selection, guint key
}
-static gboolean taglist_go_to_selection(GtkTreeSelection *selection, guint keyval)
+static gboolean taglist_go_to_selection(GtkTreeSelection *selection, guint keyval, guint state)
{
GtkTreeIter iter;
GtkTreeModel *model;
gint line = 0;
+ gboolean handled = TRUE;
if (gtk_tree_selection_get_selected(selection, &model, &iter))
{
@@ -899,13 +900,15 @@ static gboolean taglist_go_to_selection(GtkTreeSelection *selection, guint keyva
if (doc != NULL)
{
navqueue_goto_line(doc, doc, line);
- if (keyval != GDK_space)
+ if (keyval != GDK_space && ! (state & GDK_CONTROL_MASK))
change_focus_to_editor(doc, NULL);
+ else
+ handled = FALSE;
}
}
tm_tag_unref(tag);
}
- return FALSE;
+ return handled;
}
@@ -928,7 +931,7 @@ static gboolean sidebar_key_press_cb(GtkWidget *widget, GdkEventKey *event,
if (widget == tv.tree_openfiles) /* tag and doc list have separate handlers */
openfiles_go_to_selection(selection, event->keyval);
else
- taglist_go_to_selection(selection, event->keyval);
+ taglist_go_to_selection(selection, event->keyval, event->state);
return TRUE;
}
@@ -976,10 +979,12 @@ static gboolean sidebar_button_press_cb(GtkWidget *widget, GdkEventButton *event
else if (event->button == 1)
{ /* allow reclicking of taglist treeview item */
if (widget == tv.tree_openfiles)
+ {
openfiles_go_to_selection(selection, 0);
+ handled = TRUE;
+ }
else
- taglist_go_to_selection(selection, 0);
- handled = TRUE;
+ handled = taglist_go_to_selection(selection, 0, event->state);
}
else if (event->button == 3)
{

0 comments on commit 8171af6

Please sign in to comment.