[Geany-Devel] Focus lost when last document closed

Pallai Roland pallair at xxxxx
Mon May 27 11:22:02 UTC 2013


2013/5/27 Lex Trotman <elextr at gmail.com>
> On 27 May 2013 18:24, Pallai Roland <pallair at magex.hu> wrote:
> I see several problems with the proposal:
>
> 1) What is the "correct" behaviour? As you say there are several open methods, do I return to the method used for the particular file that was closed last, even though I had opened many other files using a different widget since that file was opened.  I would have said that the most recently used method might be more likely to be the one I want.  And some I probably don't want to return to, eg if the file was opened from a compiler error message and as you say having a dialog open automatically is wrong too.

No correct behaviour, just ordinary what you had described: return to
the most recent activity if an activity finished. This is a common UI
behaviour and expected by users, no one will complain about it.

Yes, there are cases when return of activity
a., is not possible: skip this activity and see next.
b., is not sane: the default widget behaviour would be "do not return
the focus here" and we have to agree on the exceptions (eg. filesystem
browsers, search results - widgets that contains file lists and
typically used to open files - IMHO it's pretty trivial.)

> 2) Methods of opening files are provided by plugins, filebrowser being the initial example, but treebrowser and the project plugins being other options.  Geany does not know about what plugins can do for opening files, and passing a widget pointer to Geany is risky since the plugin may have been closed in the meantime and the widget deleted.  Trying to use that is a likely crash.

Agreed, passing a widget pointer to Geany is risky, I have no good
solution now. Now I thinking about a signal-based solution (based on
Qt experiences) but I have to dig into GTK for the details.

> In general this is a situation where Geany can't assume what the user wants to do, it is better to let the user focus something via the mouse or keybinding.

I do not agree on this: we can guess right based on common UI
traditions. If we guess badly, the user have to focus manually just as
before - worth to try.


Do you agree that the problem exists and should be solved? Will you
commit my patch if I find a good solution?


> Cheers
> Lex
>
>
>
>>
>>
>>
>> 2013/5/27 Lex Trotman <elextr at gmail.com>
>>>
>>>
>>>
>>>
>>> On 27 May 2013 07:51, Pallai Roland <pallair at magex.hu> wrote:
>>>>
>>>> Hi,
>>>>
>>>>
>>>> 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.
>>>
>>> Cheers
>>> Lex
>>>
>>>
>>>>
>>>>
>>>> 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
>>>> https://lists.geany.org/cgi-bin/mailman/listinfo/devel
>>>>
>>>
>>>
>>> _______________________________________________
>>> Devel mailing list
>>> Devel at lists.geany.org
>>> https://lists.geany.org/cgi-bin/mailman/listinfo/devel
>>>
>>
>>
>> _______________________________________________
>> Devel mailing list
>> Devel at lists.geany.org
>> https://lists.geany.org/cgi-bin/mailman/listinfo/devel
>>
>
>
> _______________________________________________
> Devel mailing list
> Devel at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/devel
>


More information about the Devel mailing list