Make scrollbar scale according to DPI and scaling factor 1491/head
authorsapier <Sapier at GMX dot net>
Wed, 16 Jul 2014 08:11:05 +0000 (10:11 +0200)
committersapier <Sapier at GMX dot net>
Sat, 16 Aug 2014 13:30:56 +0000 (15:30 +0200)
src/guiTable.cpp

index 6ce8574865d4c8e456ba871ded02295098e84064..1543497ab3c5bcb7433b11c71e8b1af22ea151f9 100644 (file)
@@ -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()