summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-11-06 21:32:21 +0000
committerXisco Fauli <xiscofauli@libreoffice.org>2021-11-15 12:31:41 +0100
commitac3c1de61e7cf069d3022907570832130235fa32 (patch)
tree9b307ab3c245f766632808ee4c3f7b53f9fa113e /vcl
parentbc00beb99b62c8350e86f76d19367198ab979ea9 (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/+/124703 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'vcl')
-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 6b592b341ea0..78c3b09789c1 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -21803,6 +21803,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)