[Geany-Devel] Focus lost when last document closed
pallair at xxxxx
Mon May 27 08:24:56 UTC 2013
1. set new_document_after_close and auto focus widgets to off in preferences
2. open a file from file/tree browser or "find in files" search results
3. close the document with shortcut
I expect the focus will jump back where were before. Actual result is no
widget with focus (the window still has the focus of course).
I used the the following snippet to debug:
GtkWidget *widget =
printf("focused widget: %s\n", gtk_widget_get_name(widget));
g_timeout_add(1000, (GSourceFunc)get_focused_widget, NULL);
Result of an open-close cycle from tree browser:
focused widget: GtkTreeView
focused widget: Scintilla
focused widget: (null)
2013/5/27 Lex Trotman <elextr at gmail.com>
> On 27 May 2013 07:51, Pallai Roland <pallair at magex.hu> wrote:
>> I'm struggling with an issue: GTK focus lost when last document closed.
> Can you describe more clearly what the problem you are trying to solve is?
> AFAICT Geany retains focus after the last document is closed.
>> To grab the focus by a plugin (eg. filebrowser) on such case would be an
>> easy task, but not right, because the user can open documents from many
>> widgets, the focus should return there.
>> I tried for a while with gtk_container_set_focus_chain() but no luck.
>> Maybe my bad, I have no experience with GTK.
>> Other, simple solution if Geany provides a new API call. eg.:
>> void ui_focus_history_push(GtkWidget *widget);
>> and widgets/plugins can call it on focus-out-event, so Geany (or a
>> plugin) can restore the focus if there is no better strategy.
>> Another solution to extend
>> document_open_file(const gchar *locale_filename, gboolean readonly,
>> GeanyFiletype *ft, const gchar *forced_enc)
>> with "GtkWidget *widget" or introduce a new function like
>> document_open_file_from_widget(const gchar *locale_filename, gboolean
>> readonly, GeanyFiletype *ft, const gchar *forced_enc, GtkWidget *widget)
>> to store opening widget with the document, but I think this can cause
>> weird behavior if the last closed document were opened from a dialog window.
>> How should I fix it?
>> Roland Pallai
>> Devel mailing list
>> Devel at lists.geany.org
> Devel mailing list
> Devel at lists.geany.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Devel