From: sapier Date: Wed, 16 Jul 2014 08:11:05 +0000 (+0200) Subject: Make scrollbar scale according to DPI and scaling factor X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=4caa00cc99af133e5724cd8ab04f5cb8db81a666;p=zefram%2Fminetest%2Fminetest_engine.git Make scrollbar scale according to DPI and scaling factor --- diff --git a/src/guiTable.cpp b/src/guiTable.cpp index 6ce85748..1543497a 100644 --- a/src/guiTable.cpp +++ b/src/guiTable.cpp @@ -33,6 +33,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/string.h" #include "util/numeric.h" #include "guiFormSpecMenu.h" // for parseColor() +#include "main.h" +#include "settings.h" // for settings +#include "porting.h" // for dpi /* GUITable @@ -89,6 +92,14 @@ GUITable::GUITable(gui::IGUIEnvironment *env, setTabStop(true); setTabOrder(-1); updateAbsolutePosition(); + + core::rect relative_rect = m_scrollbar->getRelativePosition(); + s32 width = (relative_rect.getWidth()/(2.0/3.0)) * porting::getDisplayDensity() * + g_settings->getFloat("gui_scaling"); + m_scrollbar->setRelativePosition(core::rect( + relative_rect.LowerRightCorner.X-width,relative_rect.UpperLeftCorner.Y, + relative_rect.LowerRightCorner.X,relative_rect.LowerRightCorner.Y + )); } GUITable::~GUITable()