diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-10-31 10:57:31 +0000 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2019-11-03 22:15:41 +0100 |
commit | b147ecb4995ef58279be34f6b66143b46ee140d2 (patch) | |
tree | 19a6b9a4b12b2286721623932b8ed6849f783ac6 /svx | |
parent | e5898401ef25edc33f4ee6555229d307fa2e3c95 (diff) |
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@ubuntu.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
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; } |