summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-08-23 20:12:28 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2020-08-27 16:38:39 +0200
commitdbbce6bf7f21fd8d72fa9b01a28a4ea0d7e2ccdc (patch)
treedf187752a09250be76d563992754727194d0da84
parent804187175a0fafb9f763c09786ab4db857614049 (diff)
tdf#135779 move focus back to usual parent before grabbing pointer
Change-Id: Ia4f1f2f1672a76515ab586d679a05467515868d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101157 Reviewed-by: Michael Stahl <michael.stahl@cib.de> Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--vcl/unx/gtk3/gtk3gtkframe.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index b4757b39023c..28a19033ea0d 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1988,6 +1988,13 @@ void GtkSalFrame::SetPointer( PointerStyle ePointerStyle )
void GtkSalFrame::grabPointer( bool bGrab, bool bKeyboardAlso, bool bOwnerEvents )
{
+ if (bGrab)
+ {
+ // tdf#135779 move focus back inside usual input window out of any
+ // other gtk widgets before grabbing the pointer
+ GrabFocus();
+ }
+
static const char* pEnv = getenv( "SAL_NO_MOUSEGRABS" );
if (pEnv && *pEnv)
return;
@@ -2524,8 +2531,10 @@ void GtkSalFrame::GrabFocus()
pGrabWidget = GTK_WIDGET(m_pWindow);
else
pGrabWidget = GTK_WIDGET(m_pFixedContainer);
- gtk_widget_set_can_focus(pGrabWidget, true);
- gtk_widget_grab_focus(pGrabWidget);
+ if (!gtk_widget_get_can_focus(pGrabWidget))
+ gtk_widget_set_can_focus(pGrabWidget, true);
+ if (!gtk_widget_has_focus(pGrabWidget))
+ gtk_widget_grab_focus(pGrabWidget);
}
gboolean GtkSalFrame::signalButton(GtkWidget*, GdkEventButton* pEvent, gpointer frame)