vcl/unx/gtk3/gtkinst.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) New commits: commit 6645dfedef841a78d65202e9f0008f0a384e5e44 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Nov 6 21:32:21 2021 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sun Nov 7 15:34:29 2021 +0100
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 <caol...@redhat.com> diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 3d518a8cbaad..c7f6767668f9 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)