[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - cui/source vcl/unx

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Mar 21 07:12:04 UTC 2019


 cui/source/tabpages/page.cxx |   14 ++++++++++----
 vcl/unx/gtk3/gtk3gtkinst.cxx |    6 ++++--
 2 files changed, 14 insertions(+), 6 deletions(-)

New commits:
commit 71e64623f08b162e18180cdae5ad532114e56190
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Mar 16 21:46:54 2019 +0000
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Thu Mar 21 08:11:39 2019 +0100

    Resolves: tdf#123650 explicitly grab focus after modification
    
    of the widget after gaining focus, otherwise gtk loses track
    of where the focus should be
    
    and tdf#124226 do fill-on-demand hack only on first visit
    
    disconnect focus handler after the fill
    
    Change-Id: I90d9f36acf807aec8687c7f563449ef16d5eb574
    Reviewed-on: https://gerrit.libreoffice.org/69356
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index 81ad11e810f6..b8ed9094c06e 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -308,7 +308,6 @@ void SvxPageDescPage::Init_Impl()
     // adjust the handler
     m_xLayoutBox->connect_changed(LINK(this, SvxPageDescPage, LayoutHdl_Impl));
 
-    m_xPaperTrayBox->connect_focus_in(LINK(this, SvxPageDescPage, PaperBinHdl_Impl));
     m_xPaperSizeBox->connect_changed(LINK(this, SvxPageDescPage, PaperSizeSelect_Impl));
     m_xPaperWidthEdit->connect_value_changed( LINK(this, SvxPageDescPage, PaperSizeModify_Impl));
     m_xPaperHeightEdit->connect_value_changed(LINK(this, SvxPageDescPage, PaperSizeModify_Impl));
@@ -410,6 +409,10 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
 
     m_xPaperTrayBox->append(OUString::number(nPaperBin), aBinName);
     m_xPaperTrayBox->set_active_text(aBinName);
+    // reset focus handler to default first so know none already connected
+    m_xPaperTrayBox->connect_focus_in(Link<weld::Widget&, void>());
+    // update the list when widget gets focus
+    m_xPaperTrayBox->connect_focus_in(LINK(this, SvxPageDescPage, PaperBinHdl_Impl));
 
     Size aPaperSize = SvxPaperInfo::GetPaperSize( mpDefPrinter );
     pItem = GetItem( *rSet, SID_ATTR_PAGE_SIZE );
@@ -804,9 +807,8 @@ IMPL_LINK_NOARG(SvxPageDescPage, LayoutHdl_Impl, weld::ComboBox&, void)
 
 IMPL_LINK_NOARG(SvxPageDescPage, PaperBinHdl_Impl, weld::Widget&, void)
 {
-    if (m_xPaperTrayBox->get_count() > 1)
-        // already filled
-        return;
+    // tdf#124226 disconnect so not called again, unless Reset occurs
+    m_xPaperTrayBox->connect_focus_in(Link<weld::Widget&, void>());
 
     OUString aOldName = m_xPaperTrayBox->get_active_text();
     m_xPaperTrayBox->freeze();
@@ -826,6 +828,10 @@ IMPL_LINK_NOARG(SvxPageDescPage, PaperBinHdl_Impl, weld::Widget&, void)
     }
     m_xPaperTrayBox->set_active_text(aOldName);
     m_xPaperTrayBox->thaw();
+
+    // tdf#123650 explicitly grab-focus after the modification otherwise gtk loses track
+    // of there the focus should be
+    m_xPaperTrayBox->grab_focus();
 }
 
 IMPL_LINK_NOARG(SvxPageDescPage, PaperSizeSelect_Impl, weld::ComboBox&, void)
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index b130fe5d4747..95f6ccfa4c48 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1222,11 +1222,12 @@ protected:
     GtkWidget* m_pWidget;
     GtkInstanceBuilder* m_pBuilder;
 
-    static void signalFocusIn(GtkWidget*, GdkEvent*, gpointer widget)
+    static gboolean signalFocusIn(GtkWidget*, GdkEvent*, gpointer widget)
     {
         GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
         SolarMutexGuard aGuard;
         pThis->signal_focus_in();
+        return false;
     }
 
     void signal_focus_in()
@@ -1234,11 +1235,12 @@ protected:
         m_aFocusInHdl.Call(*this);
     }
 
-    static void signalFocusOut(GtkWidget*, GdkEvent*, gpointer widget)
+    static gboolean signalFocusOut(GtkWidget*, GdkEvent*, gpointer widget)
     {
         GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
         SolarMutexGuard aGuard;
         pThis->signal_focus_out();
+        return false;
     }
 
     void signal_focus_out()


More information about the Libreoffice-commits mailing list