summaryrefslogtreecommitdiff
path: root/src/guiTable.cpp
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-07-16 10:11:05 +0200
committersapier <Sapier at GMX dot net>2014-08-16 15:30:56 +0200
commit4caa00cc99af133e5724cd8ab04f5cb8db81a666 (patch)
tree2d1a85f3bd189de2e44b5f2a4e20f01513fd85a3 /src/guiTable.cpp
parentbf91d623c8fc1fede7b600d1b0f4be1bc6b37c44 (diff)
downloadminetest-4caa00cc99af133e5724cd8ab04f5cb8db81a666.tar.gz
minetest-4caa00cc99af133e5724cd8ab04f5cb8db81a666.tar.bz2
minetest-4caa00cc99af133e5724cd8ab04f5cb8db81a666.zip
Make scrollbar scale according to DPI and scaling factor
Diffstat (limited to 'src/guiTable.cpp')
-rw-r--r--src/guiTable.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/guiTable.cpp b/src/guiTable.cpp
index 6ce857486..1543497ab 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<s32> 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<s32>(
+ relative_rect.LowerRightCorner.X-width,relative_rect.UpperLeftCorner.Y,
+ relative_rect.LowerRightCorner.X,relative_rect.LowerRightCorner.Y
+ ));
}
GUITable::~GUITable()