diff options
author | rathnor <rathnor> | 2003-10-05 06:28:47 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-10-05 06:28:47 (GMT) |
commit | c516aa13a134ff311a1ce56976c030ba016bcfda (patch) | |
tree | 08b1b090383bc391362bd2aa29d742521c24e68e /src/fluxbox.cc | |
parent | fa4328d8620959dce8a53b40c743fba691cfe471 (diff) | |
download | fluxbox-c516aa13a134ff311a1ce56976c030ba016bcfda.zip fluxbox-c516aa13a134ff311a1ce56976c030ba016bcfda.tar.bz2 |
fix reading of auto raise delay
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r-- | src/fluxbox.cc | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 1045200..2fa7714 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: fluxbox.cc,v 1.194 2003/10/05 02:31:23 rathnor Exp $ | 25 | // $Id: fluxbox.cc,v 1.195 2003/10/05 06:28:47 rathnor Exp $ |
26 | 26 | ||
27 | #include "fluxbox.hh" | 27 | #include "fluxbox.hh" |
28 | 28 | ||
@@ -208,6 +208,13 @@ setFromString(const char *strval) { | |||
208 | setDefaultValue(); | 208 | setDefaultValue(); |
209 | } | 209 | } |
210 | 210 | ||
211 | template<> | ||
212 | void FbTk::Resource<long>:: | ||
213 | setFromString(const char *strval) { | ||
214 | if (sscanf(strval, "%ld", &m_value) != 1) | ||
215 | setDefaultValue(); | ||
216 | } | ||
217 | |||
211 | //----------------------------------------------------------------- | 218 | //----------------------------------------------------------------- |
212 | //---- manipulators for int, bool, and some enums with Resource --- | 219 | //---- manipulators for int, bool, and some enums with Resource --- |
213 | //----------------------------------------------------------------- | 220 | //----------------------------------------------------------------- |
@@ -287,6 +294,14 @@ getString() { | |||
287 | } | 294 | } |
288 | 295 | ||
289 | template<> | 296 | template<> |
297 | string FbTk::Resource<long>:: | ||
298 | getString() { | ||
299 | char tmpstr[128]; | ||
300 | sprintf(tmpstr, "%ld", m_value); | ||
301 | return string(tmpstr); | ||
302 | } | ||
303 | |||
304 | template<> | ||
290 | void FbTk::Resource<Fluxbox::Layer>:: | 305 | void FbTk::Resource<Fluxbox::Layer>:: |
291 | setFromString(const char *strval) { | 306 | setFromString(const char *strval) { |
292 | int tempnum = 0; | 307 | int tempnum = 0; |
@@ -403,6 +418,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile | |||
403 | "session.titlebar.right", "Session.Titlebar.Right"), | 418 | "session.titlebar.right", "Session.Titlebar.Right"), |
404 | m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"), | 419 | m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"), |
405 | m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"), | 420 | m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"), |
421 | m_rc_auto_raise_delay(m_resourcemanager, 250, "session.autoRaiseDelay", "Session.AutoRaiseDelay"), | ||
406 | m_focused_window(0), | 422 | m_focused_window(0), |
407 | m_mousescreen(0), | 423 | m_mousescreen(0), |
408 | m_keyscreen(0), | 424 | m_keyscreen(0), |
@@ -493,7 +509,6 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile | |||
493 | cerr<<"Warning: cannot set locale modifiers"<<endl; | 509 | cerr<<"Warning: cannot set locale modifiers"<<endl; |
494 | 510 | ||
495 | 511 | ||
496 | resource.auto_raise_delay.tv_sec = resource.auto_raise_delay.tv_usec = 0; | ||
497 | resource.update_delay_time = 5; | 512 | resource.update_delay_time = 5; |
498 | 513 | ||
499 | #ifdef HAVE_GETPID | 514 | #ifdef HAVE_GETPID |
@@ -1499,11 +1514,6 @@ void Fluxbox::save_rc() { | |||
1499 | sprintf(rc_string, "session.updateDelayTime: %lu", resource.update_delay_time); | 1514 | sprintf(rc_string, "session.updateDelayTime: %lu", resource.update_delay_time); |
1500 | XrmPutLineResource(&new_blackboxrc, rc_string); | 1515 | XrmPutLineResource(&new_blackboxrc, rc_string); |
1501 | 1516 | ||
1502 | sprintf(rc_string, "session.autoRaiseDelay: %lu", | ||
1503 | ((resource.auto_raise_delay.tv_sec * 1000) + | ||
1504 | (resource.auto_raise_delay.tv_usec / 1000))); | ||
1505 | XrmPutLineResource(&new_blackboxrc, rc_string); | ||
1506 | |||
1507 | ScreenList::iterator it = m_screen_list.begin(); | 1517 | ScreenList::iterator it = m_screen_list.begin(); |
1508 | ScreenList::iterator it_end = m_screen_list.end(); | 1518 | ScreenList::iterator it_end = m_screen_list.end(); |
1509 | 1519 | ||
@@ -1662,18 +1672,6 @@ void Fluxbox::load_rc() { | |||
1662 | } else | 1672 | } else |
1663 | resource.update_delay_time = 5; | 1673 | resource.update_delay_time = 5; |
1664 | 1674 | ||
1665 | if (XrmGetResource(*database, "session.autoRaiseDelay", "Session.AutoRaiseDelay", | ||
1666 | &value_type, &value)) { | ||
1667 | if (sscanf(value.addr, "%lu", &resource.auto_raise_delay.tv_usec) != 1) | ||
1668 | resource.auto_raise_delay.tv_usec = 250; | ||
1669 | } else | ||
1670 | resource.auto_raise_delay.tv_usec = 250; | ||
1671 | |||
1672 | resource.auto_raise_delay.tv_sec = resource.auto_raise_delay.tv_usec / 1000; | ||
1673 | resource.auto_raise_delay.tv_usec -= | ||
1674 | (resource.auto_raise_delay.tv_sec * 1000); | ||
1675 | resource.auto_raise_delay.tv_usec *= 1000; | ||
1676 | |||
1677 | // expand tilde | 1675 | // expand tilde |
1678 | *m_rc_groupfile = StringUtil::expandFilename(*m_rc_groupfile); | 1676 | *m_rc_groupfile = StringUtil::expandFilename(*m_rc_groupfile); |
1679 | 1677 | ||