Resolves: tdf#145567 restore focus to the usual frame focus widget

when tearing down the start center. Don't leave the focus in an
arbitrary widget.

Change-Id: I82c30c94121dc43b2ea1b4fbc66a0a3e79f7e664
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124803
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 3d518a8..c7f6767 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -22269,6 +22269,14 @@ private:
        // rehook handler and let vcl cycle its own way through this widget's
        // children
        pFrame->AllowCycleFocusOut();

        // tdf#145567 if the focus is in this hierarchy then, now that we are tearing down,
        // move focus to the usual focus candidate for the frame
        GtkWindow* pFocusWin = get_active_window();
        GtkWidget* pFocus = pFocusWin ? gtk_window_get_focus(pFocusWin) : nullptr;
        bool bHasFocus = pFocus && gtk_widget_is_ancestor(pFocus, pTopLevel);
        if (bHasFocus)
            pFrame->GrabFocus();
    }

    static void signalUnmap(GtkWidget*, gpointer user_data)