diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-07-12 12:52:18 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2011-07-12 12:52:18 (GMT) |
commit | c63a2294d884151d5538d6ead319a76dc41abba6 (patch) | |
tree | 1a5400ee46020b965842fb4107d25a6b07c0a6b9 /src/Screen.cc | |
parent | d03f47e861140e93e7edea61e6276bc22b406559 (diff) | |
download | fluxbox_pavel-c63a2294d884151d5538d6ead319a76dc41abba6.zip fluxbox_pavel-c63a2294d884151d5538d6ead319a76dc41abba6.tar.bz2 |
Add RangeTraits class which automatically clamps the value of resources
and start using it.
Diffstat (limited to 'src/Screen.cc')
-rw-r--r-- | src/Screen.cc | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index e4eca07..edfd298 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -204,11 +204,6 @@ private: | |||
204 | FbWinFrame::TabPlacement m_place; | 204 | FbWinFrame::TabPlacement m_place; |
205 | }; | 205 | }; |
206 | 206 | ||
207 | void clampMenuDelay(int& delay) { | ||
208 | delay = FbTk::Util::clamp(delay, 0, 5000); | ||
209 | } | ||
210 | |||
211 | |||
212 | struct TabPlacementString { | 207 | struct TabPlacementString { |
213 | FbWinFrame::TabPlacement placement; | 208 | FbWinFrame::TabPlacement placement; |
214 | const char* str; | 209 | const char* str; |
@@ -264,7 +259,7 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager_base &rm, | |||
264 | focused_alpha(rm, 255, scrname+".window.focus.alpha"), | 259 | focused_alpha(rm, 255, scrname+".window.focus.alpha"), |
265 | unfocused_alpha(rm, 255, scrname+".window.unfocus.alpha"), | 260 | unfocused_alpha(rm, 255, scrname+".window.unfocus.alpha"), |
266 | menu_alpha(rm, 255, scrname+".menu.alpha"), | 261 | menu_alpha(rm, 255, scrname+".menu.alpha"), |
267 | menu_delay(rm, 200, scrname + ".menuDelay"), | 262 | menu_delay(rm, 200, scrname + ".menuDelay", FbTk::RangedIntTraits(0, 5000)), |
268 | tab_width(rm, 64, scrname + ".tab.width"), | 263 | tab_width(rm, 64, scrname + ".tab.width"), |
269 | tooltip_delay(rm, 500, scrname + ".tooltipDelay"), | 264 | tooltip_delay(rm, 500, scrname + ".tooltipDelay"), |
270 | allow_remote_actions(rm, false, scrname+".allowRemoteActions"), | 265 | allow_remote_actions(rm, false, scrname+".allowRemoteActions"), |
@@ -403,8 +398,6 @@ BScreen::BScreen(FbTk::ResourceManager_base &rm, | |||
403 | unfocusedWinFrameTheme()->setAlpha(*resource.unfocused_alpha); | 398 | unfocusedWinFrameTheme()->setAlpha(*resource.unfocused_alpha); |
404 | m_menutheme->setAlpha(*resource.menu_alpha); | 399 | m_menutheme->setAlpha(*resource.menu_alpha); |
405 | 400 | ||
406 | clampMenuDelay(*resource.menu_delay); | ||
407 | |||
408 | m_menutheme->setDelay(*resource.menu_delay); | 401 | m_menutheme->setDelay(*resource.menu_delay); |
409 | 402 | ||
410 | m_tracker.join(focusedWinFrameTheme()->reconfigSig(), | 403 | m_tracker.join(focusedWinFrameTheme()->reconfigSig(), |
@@ -826,8 +819,6 @@ void BScreen::reconfigure() { | |||
826 | unfocusedWinFrameTheme()->setAlpha(*resource.unfocused_alpha); | 819 | unfocusedWinFrameTheme()->setAlpha(*resource.unfocused_alpha); |
827 | m_menutheme->setAlpha(*resource.menu_alpha); | 820 | m_menutheme->setAlpha(*resource.menu_alpha); |
828 | 821 | ||
829 | clampMenuDelay(*resource.menu_delay); | ||
830 | |||
831 | m_menutheme->setDelay(*resource.menu_delay); | 822 | m_menutheme->setDelay(*resource.menu_delay); |
832 | 823 | ||
833 | // realize the number of workspaces from the init-file | 824 | // realize the number of workspaces from the init-file |
@@ -1637,11 +1628,10 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { | |||
1637 | FbTk::RefCount<FbTk::Menu> alpha_menu( createMenu(alphamenu_label) ); | 1628 | FbTk::RefCount<FbTk::Menu> alpha_menu( createMenu(alphamenu_label) ); |
1638 | 1629 | ||
1639 | if (FbTk::Transparent::haveComposite(true)) { | 1630 | if (FbTk::Transparent::haveComposite(true)) { |
1640 | static FbTk::SimpleAccessor<bool> s_pseudo(Fluxbox::instance()->getPseudoTrans()); | ||
1641 | alpha_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Configmenu, ForcePseudoTrans, | 1631 | alpha_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Configmenu, ForcePseudoTrans, |
1642 | "Force Pseudo-Transparency", | 1632 | "Force Pseudo-Transparency", |
1643 | "When composite is available, still use old pseudo-transparency"), | 1633 | "When composite is available, still use old pseudo-transparency"), |
1644 | s_pseudo, save_and_reconfigure)); | 1634 | Fluxbox::instance()->getPseudoTransResource(), save_and_reconfigure)); |
1645 | } | 1635 | } |
1646 | 1636 | ||
1647 | // in order to save system resources, don't save or reconfigure alpha | 1637 | // in order to save system resources, don't save or reconfigure alpha |