Revision: 4712 http://geany.svn.sourceforge.net/geany/?rev=4712&view=rev Author: eht16 Date: 2010-02-28 14:32:38 +0000 (Sun, 28 Feb 2010)
Log Message: ----------- Fix document_try_focus() to make it work with the sidebar document list as well.
Modified Paths: -------------- trunk/src/document.c trunk/src/document.h trunk/src/sidebar.c
Modified: trunk/src/document.c =================================================================== --- trunk/src/document.c 2010-02-28 14:30:27 UTC (rev 4711) +++ trunk/src/document.c 2010-02-28 14:32:38 UTC (rev 4712) @@ -516,7 +516,7 @@ }
-void document_try_focus(GeanyDocument *doc) +void document_try_focus(GeanyDocument *doc, GtkWidget *source_widget) { /* doc might not be valid e.g. if user closed a tab whilst Geany is opening files */ if (DOC_VALID(doc)) @@ -524,7 +524,10 @@ GtkWidget *sci = GTK_WIDGET(doc->editor->sci); GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
- if (focusw == doc->priv->tag_tree) + if (source_widget == NULL) + source_widget = doc->priv->tag_tree; + + if (focusw == source_widget) gtk_widget_grab_focus(sci); } } @@ -532,7 +535,7 @@
static gboolean on_idle_focus(gpointer doc) { - document_try_focus(doc); + document_try_focus(doc, NULL); return FALSE; }
@@ -752,7 +755,7 @@ sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0); /* bring it in front, jump to the start and grab the focus */ editor_goto_pos(doc->editor, 0, FALSE); - document_try_focus(doc); + document_try_focus(doc, NULL);
#if USE_GIO_FILEMON monitor_file_setup(doc);
Modified: trunk/src/document.h =================================================================== --- trunk/src/document.h 2010-02-28 14:30:27 UTC (rev 4711) +++ trunk/src/document.h 2010-02-28 14:32:38 UTC (rev 4712) @@ -192,7 +192,7 @@
gboolean document_remove_page(guint page_num);
-void document_try_focus(GeanyDocument *doc); +void document_try_focus(GeanyDocument *doc, GtkWidget *source_widget);
gboolean document_close(GeanyDocument *doc);
Modified: trunk/src/sidebar.c =================================================================== --- trunk/src/sidebar.c 2010-02-28 14:30:27 UTC (rev 4711) +++ trunk/src/sidebar.c 2010-02-28 14:32:38 UTC (rev 4712) @@ -710,10 +710,10 @@ }
-static void change_focus_to_editor(GeanyDocument *doc) +static void change_focus_to_editor(GeanyDocument *doc, GtkWidget *source_widget) { if (may_steal_focus) - document_try_focus(doc); + document_try_focus(doc, source_widget); may_steal_focus = FALSE; }
@@ -736,7 +736,7 @@ gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook), (GtkWidget*) doc->editor->sci)); if (selection_change.keyval != GDK_space) - change_focus_to_editor(doc); + change_focus_to_editor(doc, tv.tree_openfiles); } return FALSE; } @@ -765,7 +765,7 @@ { navqueue_goto_line(doc, doc, line); if (selection_change.keyval != GDK_space) - change_focus_to_editor(doc); + change_focus_to_editor(doc, NULL); } } }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.