[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - include/svx svtools/source svx/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Nov 3 21:16:27 UTC 2019


 include/svx/colorwindow.hxx        |    1 +
 svtools/source/control/ctrlbox.cxx |    4 ++--
 svx/source/tbxctrls/tbcontrl.cxx   |   14 ++++++++------
 3 files changed, 11 insertions(+), 8 deletions(-)

New commits:
commit b147ecb4995ef58279be34f6b66143b46ee140d2
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Oct 31 10:57:31 2019 +0000
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Sun Nov 3 22:15:41 2019 +0100

    setting has-default true on an element in a GtkPopover is fatal
    
    in gtk 3.24.12 at least.
    
    in ColorWindow explicitly track which button is the 'default' one for the two
    modes instead of using get/use-default and then just grab_focus instead of
    setting has-default for these popover cases
    
    Change-Id: Ia226f847f666d2356c6ea4e8c47f5db8e2535410
    Reviewed-on: https://gerrit.libreoffice.org/81835
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/include/svx/colorwindow.hxx b/include/svx/colorwindow.hxx
index 183a29d231ba..4398c0c073c3 100644
--- a/include/svx/colorwindow.hxx
+++ b/include/svx/colorwindow.hxx
@@ -132,6 +132,7 @@ private:
     std::unique_ptr<weld::Widget> mxAutomaticSeparator;
     std::unique_ptr<weld::CustomWeld> mxColorSetWin;
     std::unique_ptr<weld::CustomWeld> mxRecentColorSetWin;
+    weld::Button* mpDefaultButton;
 
     DECL_LINK(SelectHdl, SvtValueSet*, void);
     DECL_LINK(SelectPaletteHdl, weld::ComboBox&, void);
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 92f40861aeef..d4eacc22edb9 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -1595,12 +1595,12 @@ void SvtLineListBox::SelectEntry(SvxBorderLineStyle nStyle)
     if (nStyle == SvxBorderLineStyle::NONE)
     {
         m_xLineSet->SetNoSelection();
-        m_xNoneButton->set_has_default(true);
+        m_xNoneButton->grab_focus();
     }
     else
     {
         m_xLineSet->SelectItem(static_cast<sal_Int16>(nStyle) + 1);
-        m_xNoneButton->set_has_default(false);
+        m_xLineSet->GrabFocus();
     }
     UpdatePreview();
 }
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 125d6d21432e..7ec4a5b8fb61 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1724,6 +1724,7 @@ ColorWindow::ColorWindow(std::shared_ptr<PaletteManager> const & rPaletteManager
     , mxAutomaticSeparator(m_xBuilder->weld_widget("separator4"))
     , mxColorSetWin(new weld::CustomWeld(*m_xBuilder, "colorset", *mxColorSet))
     , mxRecentColorSetWin(new weld::CustomWeld(*m_xBuilder, "recent_colorset", *mxRecentColorSet))
+    , mpDefaultButton(nullptr)
 {
     mxColorSet->SetStyle( WinBits(WB_FLATVALUESET | WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT | WB_TABSTOP) );
     mxRecentColorSet->SetStyle( WinBits(WB_FLATVALUESET | WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT | WB_TABSTOP) );
@@ -1921,7 +1922,7 @@ NamedColor ColorWindow::GetSelectEntryColor() const
         return GetSelectEntryColor(mxColorSet.get());
     if (!mxRecentColorSet->IsNoSelection())
         return GetSelectEntryColor(mxRecentColorSet.get());
-    if (mxButtonNoneColor->get_has_default())
+    if (mxButtonNoneColor.get() == mpDefaultButton)
         return GetNoneColor();
     return GetAutoColor();
 }
@@ -2063,8 +2064,7 @@ void ColorWindow::SetNoSelection()
 {
     mxColorSet->SetNoSelection();
     mxRecentColorSet->SetNoSelection();
-    mxButtonAutoColor->set_has_default(false);
-    mxButtonNoneColor->set_has_default(false);
+    mpDefaultButton = nullptr;
 }
 
 bool SvxColorWindow::IsNoSelection() const
@@ -2192,15 +2192,17 @@ void ColorWindow::SelectEntry(const NamedColor& rNamedColor)
 
     const Color &rColor = rNamedColor.first;
 
-    if (mxButtonNoneColor->get_visible() && (rColor == COL_TRANSPARENT || rColor == COL_AUTO))
+    if (mxButtonAutoColor->get_visible() && (rColor == COL_TRANSPARENT || rColor == COL_AUTO))
     {
-        mxButtonAutoColor->set_has_default(true);
+        mpDefaultButton = mxButtonAutoColor.get();
+        mxButtonAutoColor->grab_focus();
         return;
     }
 
     if (mxButtonNoneColor->get_visible() && rColor == COL_NONE_COLOR)
     {
-        mxButtonNoneColor->set_has_default(true);
+        mpDefaultButton = mxButtonNoneColor.get();
+        mxButtonNoneColor->grab_focus();
         return;
     }
 


More information about the Libreoffice-commits mailing list