From 5af55b4092ed156fc1c20ef71b7a912c71c182e0 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Fri, 10 May 2013 10:31:46 +0200 Subject: [PATCH] - framebuffer: add possibility to force small windows --- src/driver/framebuffer.cpp | 20 +++++++++++++++----- src/driver/framebuffer.h | 5 +++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/driver/framebuffer.cpp b/src/driver/framebuffer.cpp index c6442d60f..3d5d47fc1 100644 --- a/src/driver/framebuffer.cpp +++ b/src/driver/framebuffer.cpp @@ -430,15 +430,25 @@ unsigned int CFrameBuffer::getScreenHeight(bool real) return g_settings.screen_EndY - g_settings.screen_StartY; } -unsigned int CFrameBuffer::getScreenWidthRel() +unsigned int CFrameBuffer::getScreenPercentRel(bool force_small) { - // always reduce a possible detailline - return (g_settings.screen_EndX - g_settings.screen_StartX - 2*ConnectLineBox_Width) * (g_settings.big_windows ? 100 : NON_BIG_WINDOWS) / 100; + int percent = 100; + if (force_small || !g_settings.big_windows) + percent = NON_BIG_WINDOWS; + return percent; } -unsigned int CFrameBuffer::getScreenHeightRel() +unsigned int CFrameBuffer::getScreenWidthRel(bool force_small) { - return (g_settings.screen_EndY - g_settings.screen_StartY) * (g_settings.big_windows ? 100 : NON_BIG_WINDOWS) / 100; + int percent = getScreenPercentRel(force_small); + // always reduce a possible detailline + return (g_settings.screen_EndX - g_settings.screen_StartX - 2*ConnectLineBox_Width) * percent / 100; +} + +unsigned int CFrameBuffer::getScreenHeightRel(bool force_small) +{ + int percent = getScreenPercentRel(force_small); + return (g_settings.screen_EndY - g_settings.screen_StartY) * percent / 100; } unsigned int CFrameBuffer::getScreenX() diff --git a/src/driver/framebuffer.h b/src/driver/framebuffer.h index e1f79e119..058425963 100644 --- a/src/driver/framebuffer.h +++ b/src/driver/framebuffer.h @@ -146,8 +146,9 @@ class CFrameBuffer unsigned int getStride() const; // size of a single line in the framebuffer (in bytes) unsigned int getScreenWidth(bool real = false); unsigned int getScreenHeight(bool real = false); - unsigned int getScreenWidthRel(); - unsigned int getScreenHeightRel(); + unsigned int getScreenPercentRel(bool force_small); + unsigned int getScreenWidthRel(bool force_small = false); + unsigned int getScreenHeightRel(bool force_small = false); unsigned int getScreenX(); unsigned int getScreenY();