summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-11-06 21:32:21 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-11-07 15:34:29 +0100
commit6645dfedef841a78d65202e9f0008f0a384e5e44 (patch)
tree848ffdc46a90078b0f83730232ac41d659529a19 /vcl/unx
parentf63cf9e83a944306ad8564e4ce9b98f92fae666e (diff)
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>
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx8
1 files changed, 8 insertions, 0 deletions
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)