[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Jan 6 11:35:56 UTC 2020


 vcl/unx/gtk3/gtk3gtkframe.cxx   |    7 ++++---
 vcl/unx/gtk3/gtk3gtksalmenu.cxx |    2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit f1604675e71c67024887d12bf73ccb86ac05a7a3
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jan 6 10:30:51 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jan 6 12:35:21 2020 +0100

    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 at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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.


More information about the Libreoffice-commits mailing list