aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index ad24503..58aec0d 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -73,6 +73,7 @@
73#include "FbTk/FbString.hh" 73#include "FbTk/FbString.hh"
74#include "FbTk/STLUtil.hh" 74#include "FbTk/STLUtil.hh"
75#include "FbTk/KeyUtil.hh" 75#include "FbTk/KeyUtil.hh"
76#include "FbTk/Util.hh"
76 77
77//use GNU extensions 78//use GNU extensions
78#ifndef _GNU_SOURCE 79#ifndef _GNU_SOURCE
@@ -203,6 +204,10 @@ private:
203 FbWinFrame::TabPlacement m_place; 204 FbWinFrame::TabPlacement m_place;
204}; 205};
205 206
207void clampMenuDelay(int& delay) {
208 delay = FbTk::Util::clamp(delay, 0, 5000);
209}
210
206} // end anonymous namespace 211} // end anonymous namespace
207 212
208 213
@@ -453,11 +458,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
453 focusedWinFrameTheme()->setAlpha(*resource.focused_alpha); 458 focusedWinFrameTheme()->setAlpha(*resource.focused_alpha);
454 unfocusedWinFrameTheme()->setAlpha(*resource.unfocused_alpha); 459 unfocusedWinFrameTheme()->setAlpha(*resource.unfocused_alpha);
455 m_menutheme->setAlpha(*resource.menu_alpha); 460 m_menutheme->setAlpha(*resource.menu_alpha);
456 // clamp values 461
457 if (*resource.menu_delay > 5000) 462 clampMenuDelay(*resource.menu_delay);
458 *resource.menu_delay = 5000;
459 if (*resource.menu_delay < 0)
460 *resource.menu_delay = 0;
461 463
462 m_menutheme->setDelay(*resource.menu_delay); 464 m_menutheme->setDelay(*resource.menu_delay);
463 465
@@ -905,11 +907,7 @@ void BScreen::reconfigure() {
905 unfocusedWinFrameTheme()->setAlpha(*resource.unfocused_alpha); 907 unfocusedWinFrameTheme()->setAlpha(*resource.unfocused_alpha);
906 m_menutheme->setAlpha(*resource.menu_alpha); 908 m_menutheme->setAlpha(*resource.menu_alpha);
907 909
908 // clamp values 910 clampMenuDelay(*resource.menu_delay);
909 if (*resource.menu_delay > 5000)
910 *resource.menu_delay = 5000;
911 if (*resource.menu_delay < 0)
912 *resource.menu_delay = 0;
913 911
914 m_menutheme->setDelay(*resource.menu_delay); 912 m_menutheme->setDelay(*resource.menu_delay);
915 913
@@ -2138,15 +2136,8 @@ pair<int,int> BScreen::clampToHead(int head, int x, int y, int w, int h) const {
2138 int hw = getHeadWidth(head); 2136 int hw = getHeadWidth(head);
2139 int hh = getHeadHeight(head); 2137 int hh = getHeadHeight(head);
2140 2138
2141 if (x + w > hx + hw) 2139 x = FbTk::Util::clamp(x, hx, hx + hw - w);
2142 x = hx + hw - w; 2140 y = FbTk::Util::clamp(y, hy, hy + hh - h);
2143 if (y + h > hy + hh)
2144 y = hy + hh - h;
2145
2146 if (x < hx)
2147 x = hx;
2148 if (y < hy)
2149 y = hy;
2150 2141
2151 return make_pair(x,y); 2142 return make_pair(x,y);
2152} 2143}