SF.net SVN: geany:[4711] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sun Feb 28 14:30:28 UTC 2010


Revision: 4711
          http://geany.svn.sourceforge.net/geany/?rev=4711&view=rev
Author:   eht16
Date:     2010-02-28 14:30:27 +0000 (Sun, 28 Feb 2010)

Log Message:
-----------
Make Space on the symbol and document list not focus the editor widget while Enter does (closes #2919444, patch by Can Koy, thanks).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/THANKS
    trunk/src/about.c
    trunk/src/sidebar.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-02-28 13:12:48 UTC (rev 4710)
+++ trunk/ChangeLog	2010-02-28 14:30:27 UTC (rev 4711)
@@ -10,6 +10,12 @@
  * scintilla/LexR.cxx:
    Backport R lexer from Scintilla CVS to fix case sensitive keywords
    (Scintilla bug #2956543).
+ * src/sidebar.c, src/about.c, THANKS:
+   Make Space on the symbol and document list not focus the editor
+   widget while Enter does (closes #2919444, patch by Can Koy, thanks).
+ * src/document.c, src/document.h:
+   Fix document_try_focus() to make it work with the sidebar document
+   list as well.
 
 
 2010-02-28  Frank Lanitz  <frank(at)frank(dot)uvena(dot)de>

Modified: trunk/THANKS
===================================================================
--- trunk/THANKS	2010-02-28 13:12:48 UTC (rev 4710)
+++ trunk/THANKS	2010-02-28 14:30:27 UTC (rev 4711)
@@ -74,6 +74,7 @@
 Jörn Reder <joern(at)zyn(dot)de> - --socket-file command line option patch
 Kelvin Gardiner <kelvin(at)mbmn(dot)net> - VHDL symbol list patch, Verilog filetype
 Jon Senior <jon(at)restlesslemon(dot)co(dot)uk> - R tagmanager parser patch
+Can Koy <cankoy(at)ymail(dot)com> - Multiple changes/improvements
 
 Translators:
 ------------

Modified: trunk/src/about.c
===================================================================
--- trunk/src/about.c	2010-02-28 13:12:48 UTC (rev 4710)
+++ trunk/src/about.c	2010-02-28 14:30:27 UTC (rev 4711)
@@ -82,7 +82,7 @@
 
 static const gchar *contributors =
 "Alexander Rodin, Alexey Antipov, Andrew Rowland, Anh Phạm, blackdog, Bo Lorentsen, Bob Doan, "
-"Bronisław Białek, Catalin Marinas, "
+"Bronisław Białek, Can Koy, Catalin Marinas, "
 "Chris Macksey, Christoph Berg, Colomban Wendling, Conrad Steenberg, Daniel Richard G., Dave Moore, "
 "Dirk Weber, Elias Pschernig, Eric Forgeot, Eugene Arshinov, Felipe Pena, François Cami, "
 "Giuseppe Torelli, Guillaume de Rorthais, Guillaume Hoffmann, Herbert Voss, Jason Oster, "

Modified: trunk/src/sidebar.c
===================================================================
--- trunk/src/sidebar.c	2010-02-28 13:12:48 UTC (rev 4710)
+++ trunk/src/sidebar.c	2010-02-28 14:30:27 UTC (rev 4711)
@@ -46,6 +46,7 @@
 
 #include <gdk/gdkkeysyms.h>
 
+
 SidebarTreeviews tv = {NULL, NULL, NULL};
 /* while typeahead searching, editor should not get focus */
 static gboolean may_steal_focus = FALSE;
@@ -59,6 +60,12 @@
 }
 doc_items = {NULL, NULL, NULL, NULL};
 
+static struct
+{
+	GtkTreeSelection *selection;
+	guint keyval;
+} selection_change = {NULL, 0};
+
 enum
 {
 	TREEVIEW_SYMBOL = 0,
@@ -88,9 +95,9 @@
 static GtkWidget *tag_window;	/* scrolled window that holds the symbol list GtkTreeView */
 
 /* callback prototypes */
-static gboolean on_openfiles_tree_selection_changed(GtkTreeSelection *selection);
+static gboolean on_openfiles_tree_selection_changed(gpointer data);
 static void on_openfiles_document_action(GtkMenuItem *menuitem, gpointer user_data);
-static gboolean on_taglist_tree_selection_changed(GtkTreeSelection *selection);
+static gboolean on_taglist_tree_selection_changed(gpointer data);
 static gboolean sidebar_button_press_cb(GtkWidget *widget, GdkEventButton *event,
 		gpointer user_data);
 static gboolean sidebar_key_press_cb(GtkWidget *widget, GdkEventKey *event,
@@ -667,7 +674,6 @@
 			break;
 		}
 	}
-
 }
 
 
@@ -712,14 +718,14 @@
 }
 
 
-static gboolean on_openfiles_tree_selection_changed(GtkTreeSelection *selection)
+static gboolean on_openfiles_tree_selection_changed(gpointer data)
 {
 	GtkTreeIter iter;
 	GtkTreeModel *model;
 	GeanyDocument *doc = NULL;
 
 	/* use switch_notebook_page to ignore changing the notebook page because it is already done */
-	if (gtk_tree_selection_get_selected(selection, &model, &iter) && ! ignore_callback)
+	if (gtk_tree_selection_get_selected(selection_change.selection, &model, &iter) && ! ignore_callback)
 	{
 		gtk_tree_model_get(model, &iter, DOCUMENTS_DOCUMENT, &doc, -1);
 		if (! doc)
@@ -729,19 +735,20 @@
 		gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
 			gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook),
 			(GtkWidget*) doc->editor->sci));
-		change_focus_to_editor(doc);
+		if (selection_change.keyval != GDK_space)
+			change_focus_to_editor(doc);
 	}
 	return FALSE;
 }
 
 
-static gboolean on_taglist_tree_selection_changed(GtkTreeSelection *selection)
+static gboolean on_taglist_tree_selection_changed(gpointer data)
 {
 	GtkTreeIter iter;
 	GtkTreeModel *model;
 	gint line = 0;
 
-	if (gtk_tree_selection_get_selected(selection, &model, &iter))
+	if (gtk_tree_selection_get_selected(selection_change.selection, &model, &iter))
 	{
 		const TMTag *tag;
 
@@ -757,7 +764,8 @@
 			if (doc != NULL)
 			{
 				navqueue_goto_line(doc, doc, line);
-				change_focus_to_editor(doc);
+				if (selection_change.keyval != GDK_space)
+					change_focus_to_editor(doc);
 			}
 		}
 	}
@@ -765,6 +773,13 @@
 }
 
 
+static void update_selection_change(GtkTreeSelection *selection, guint keyval)
+{
+	selection_change.selection = selection;
+	selection_change.keyval = keyval;
+}
+
+
 static gboolean sidebar_key_press_cb(GtkWidget *widget, GdkEventKey *event,
 											 gpointer user_data)
 {
@@ -778,10 +793,12 @@
 		may_steal_focus = TRUE;
 		/* delay the query of selection state because this callback is executed before GTK
 		 * changes the selection (g_signal_connect_after would be better but it doesn't work) */
+		update_selection_change(selection, event->keyval);
+
 		if (widget ==  tv.tree_openfiles) /* tag and doc list have separate handlers */
-			g_idle_add((GSourceFunc) on_openfiles_tree_selection_changed, selection);
+			g_idle_add(on_openfiles_tree_selection_changed, NULL);
 		else
-			g_idle_add((GSourceFunc) on_taglist_tree_selection_changed, selection);
+			g_idle_add(on_taglist_tree_selection_changed, NULL);
 	}
 	return FALSE;
 }
@@ -820,10 +837,12 @@
 	{	/* allow reclicking of taglist treeview item */
 		/* delay the query of selection state because this callback is executed before GTK
 		 * changes the selection (g_signal_connect_after would be better but it doesn't work) */
+		update_selection_change(selection, 0);
+
 		if (widget == tv.tree_openfiles)
-			g_idle_add((GSourceFunc) on_openfiles_tree_selection_changed, selection);
+			g_idle_add(on_openfiles_tree_selection_changed, NULL);
 		else
-			g_idle_add((GSourceFunc) on_taglist_tree_selection_changed, selection);
+			g_idle_add(on_taglist_tree_selection_changed, NULL);
 	}
 	else if (event->button == 3)
 	{


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list