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.