[Geany-Devel] Focus lost when last document closed

Pallai Roland pallair at xxxxx
Sun May 26 21:51:17 UTC 2013


I'm struggling with an issue: GTK focus lost when last document 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20130526/59b64f6f/attachment.html>

More information about the Devel mailing list