summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2021-04-07 00:07:53 +0200
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2021-04-07 16:13:32 +0200
commitf73138a671d098dee96c11167ec390f209352d9e (patch)
treec7866a3c69c47239bc20804227e97bc21edc7051
parentResolves: tdf#141515 expander column space isn't wanted (diff)
downloadcore-f73138a671d098dee96c11167ec390f209352d9e.tar.gz
core-f73138a671d098dee96c11167ec390f209352d9e.zip
tdf#136918 restrict symbol size to button width
... and scale the button based on the DPI scaling factor. The symbol size is based on pDev->GetTextHeight(), but the button itself is fixed to 20px, which would break at some point. So this at least scales the button witdh based on DPI, just like commit 1eba1c4597f8c2698aa91e2218d8452ad0fbc39c ("tdf#130991 Scale the drop-down arrow size-request") did for the toolbar buttons. OTOH this should probably just use the full button width ignoring the GetTextHeight()... Change-Id: I43010443265c10ad92f46cdecd1d7155a7a07a3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113710 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de> (cherry picked from commit ea4fb1559f7b99a0bfaf18f26cb3b6972c9cde1c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113648 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r--vcl/inc/salvtables.hxx4
-rw-r--r--vcl/source/control/button.cxx2
2 files changed, 4 insertions, 2 deletions
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 0702cb103a5f..d13a34875a99 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -828,8 +828,8 @@ public:
int get_menu_button_width() const override
{
- const int nButtonWidth = 20;
- return nButtonWidth;
+ OutputDevice* pDefault = Application::GetDefaultDevice();
+ return 20 * (pDefault ? pDefault->GetDPIScaleFactor() : 1.0);
}
void CallHandleEventListener(VclWindowEvent& rEvent)
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 37586dae6bd5..91a4aa4543a3 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -821,6 +821,8 @@ void PushButton::ImplDrawPushButtonContent(OutputDevice *pDev, DrawFlags nDrawFl
// calculate symbol size
tools::Long nSymbolSize = pDev->GetTextHeight() / 2 + 1;
+ if (nSymbolSize > aSize.Width() / 2)
+ nSymbolSize = aSize.Width() / 2;
nSeparatorX = aInRect.Right() - 2*nSymbolSize;
aSize.AdjustWidth( -(2*nSymbolSize) );