summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-01-06 10:30:51 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-01-06 12:35:21 +0100
commitf1604675e71c67024887d12bf73ccb86ac05a7a3 (patch)
tree567449518e7bd19c1703804a610cf592dd767ceb /vcl
parent6b1bd2699b0bdad6dc42db741dea0717cf7c1d36 (diff)
tdf#129634 send SalEvent::LoseFocus only if some other widget gains focus
not if we "lose" focus to nothing before we would regain it again Change-Id: Ie477aff5cfaa3b64589cb3246ff38d4e57068ead Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86262 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/gtk3/gtk3gtkframe.cxx7
-rw-r--r--vcl/unx/gtk3/gtk3gtksalmenu.cxx2
2 files changed, 6 insertions, 3 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 7a4f7a151a22..178b0ac6aa30 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -3052,9 +3052,10 @@ void GtkSalFrame::signalSetFocus(GtkWindow*, GtkWidget* pWidget, gpointer frame)
{
// change of focus between native widgets within the toplevel
GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
- bool bGainFocus = pWidget == GTK_WIDGET(pThis->m_pFixedContainer);
- pThis->CallCallbackExc(bGainFocus ? SalEvent::GetFocus : SalEvent::LoseFocus, nullptr);
- gtk_widget_set_can_focus(GTK_WIDGET(pThis->m_pFixedContainer), bGainFocus);
+ // tdf#129634 interpret losing focus as focus passing explicitly to another widget
+ bool bLoseFocus = pWidget && pWidget != GTK_WIDGET(pThis->m_pFixedContainer);
+ pThis->CallCallbackExc(bLoseFocus ? SalEvent::LoseFocus : SalEvent::GetFocus, nullptr);
+ gtk_widget_set_can_focus(GTK_WIDGET(pThis->m_pFixedContainer), !bLoseFocus);
}
gboolean GtkSalFrame::signalMap(GtkWidget *, GdkEvent*, gpointer frame)
diff --git a/vcl/unx/gtk3/gtk3gtksalmenu.cxx b/vcl/unx/gtk3/gtk3gtksalmenu.cxx
index d53b2ef513bb..13a7ef2d30ac 100644
--- a/vcl/unx/gtk3/gtk3gtksalmenu.cxx
+++ b/vcl/unx/gtk3/gtk3gtksalmenu.cxx
@@ -800,6 +800,8 @@ void GtkSalMenu::CreateMenuBarWidget()
gtk_grid_attach(pGrid, mpMenuBarContainerWidget, 0, 0, 1, 1);
mpMenuAllowShrinkWidget = gtk_scrolled_window_new(nullptr, nullptr);
+ // tdf#129634 don't allow this scrolled window as a candidate to tab into
+ gtk_widget_set_can_focus(GTK_WIDGET(mpMenuAllowShrinkWidget), false);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(mpMenuAllowShrinkWidget), GTK_SHADOW_NONE);
// tdf#116290 external policy on scrolledwindow will not show a scrollbar,
// but still allow scrolled window to not be sized to the child content.