I'm using the plugin Geany Preview. It is a fantastic tool for creating webpages: The HTML-code can be edited in the editor, while in the sidebar one can see immediately the result of the change of the webpage. But some issues can't be programed perfect because according to @xiota there is no sign to know if sidebar is in focus or not in focus (https://github.com/xiota/geany-preview/issues/5#issuecomment-1208310662 and https://github.com/xiota/geany-preview/issues/38#issuecomment-1208316223). I'm not a software developer, but what about the idea to add a sign, like a boolean-variable to the sidebar of Geany, so true or false, like SIDEBAR_focus=boolean to know if sidebar is in focus or not in focus?
Then maybe some issues could be solved, like https://github.com/xiota/geany-preview/issues/5 https://github.com/xiota/geany-preview/issues/15 https://github.com/xiota/geany-preview/issues/37 https://github.com/xiota/geany-preview/issues/38
The plugin should connect to the relevant GTK focus signal https://docs.gtk.org/gtk3/signal.Notebook.focus-tab.html if its wants to know about it.
The problem is not just knowing whether a widget has focus, but also setting focus on the widget of interest. None of the signals did exactly what's needed to get the behavior ralf3u wanted when I tried them. I think this is a GTK library issue though, not geany.
https://docs.gtk.org/gtk4/method.Widget.grab_focus.html
@xiota
Is this information helpful to solve the issues mentioned on top of the report?
Its for the part of the comment that said "but also setting focus on the widget of interest". Grab focus is a top level widget function available to all widgets, but only works on some (as explained in that link).
But I will also caution that grabbing focus is frowned upon by GTK, its something the user can control, so it may not always happen despite a call to this function.
Maybe GTK4 is different, but in GTK3 almost a year ago, none of the signals worked. When focus was grabbed, often the wrong widget was selected.
When focus was grabbed, often the wrong widget was selected.
See warning above.
Anyway, problems with GTK usage needs to be discussed on the plugin and/or with GTK folks, not on Geany.
If grabs and signals don't work for the plugin (assuming they are used correctly) then they won't work for Geany, so the functionality requested in the OP can't be added.
Closed #3289 as completed.
Anyway, problems with GTK usage needs to be discussed on the plugin and/or with GTK folks, not on Geany.
OK, so I close this issue.
@elextr
Thank you for the hint and your help.
@elextr Excuse me to disturb you, but you mentioned in https://github.com/geany/geany/issues/3289#issuecomment-1244798812:
Xiota recognized that Geany does not support GTK4 (https://github.com/xiota/geany-preview/issues/5#issuecomment-1260907891). Just for information: So, why did you mention it, if Geany does not support GTK4?
Its available on GTK3 as well https://docs.gtk.org/gtk3/signal.Widget.grab-focus.html, just google happened to find the GTK4 docs and I didn't notice.
github-comments@lists.geany.org