[Libreoffice-commits] core.git: vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Sep 29 04:27:13 UTC 2018
vcl/source/control/combobox.cxx | 12 ++++++++++++
vcl/source/control/listbox.cxx | 12 ++++++++++++
2 files changed, 24 insertions(+)
New commits:
commit 6f070fb228d0c6f05c48386d0f3538c89cfbc878
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Sep 28 11:47:42 2018 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Sep 29 06:26:53 2018 +0200
tdf#120169 handle [combo|list]box can-focus specially
Change-Id: I93fec026079ac37993e48fac48d937a0a20e5b0f
Reviewed-on: https://gerrit.libreoffice.org/61081
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 3e16f2c46ef5..f114df9deaa7 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -1530,6 +1530,18 @@ bool ComboBox::set_property(const OString &rKey, const OUString &rValue)
SetWidthInChars(rValue.toInt32());
else if (rKey == "max-width-chars")
setMaxWidthChars(rValue.toInt32());
+ else if (rKey == "can-focus")
+ {
+ // as far as I can see in Gtk, setting a ComboBox as can.focus means
+ // the focus gets stuck in it, so try here to behave like gtk does
+ // with the settings that work, i.e. can.focus of false doesn't
+ // set the hard WB_NOTABSTOP
+ WinBits nBits = GetStyle();
+ nBits &= ~(WB_TABSTOP|WB_NOTABSTOP);
+ if (toBool(rValue))
+ nBits |= WB_TABSTOP;
+ SetStyle(nBits);
+ }
else
return Control::set_property(rKey, rValue);
return true;
diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx
index de64575534e2..88a53fc350eb 100644
--- a/vcl/source/control/listbox.cxx
+++ b/vcl/source/control/listbox.cxx
@@ -1428,6 +1428,18 @@ bool ListBox::set_property(const OString &rKey, const OUString &rValue)
SelectEntryPos(rValue.toInt32());
else if (rKey == "max-width-chars")
setMaxWidthChars(rValue.toInt32());
+ else if (rKey == "can-focus")
+ {
+ // as far as I can see in Gtk, setting a ComboBox as can.focus means
+ // the focus gets stuck in it, so try here to behave like gtk does
+ // with the settings that work, i.e. can.focus of false doesn't
+ // set the hard WB_NOTABSTOP
+ WinBits nBits = GetStyle();
+ nBits &= ~(WB_TABSTOP|WB_NOTABSTOP);
+ if (toBool(rValue))
+ nBits |= WB_TABSTOP;
+ SetStyle(nBits);
+ }
else
return Control::set_property(rKey, rValue);
return true;
More information about the Libreoffice-commits
mailing list