fix reading of auto raise delay

This commit is contained in:
rathnor 2003-10-05 06:28:47 +00:00
parent fa4328d862
commit c516aa13a1
6 changed files with 29 additions and 29 deletions

View file

@ -1,6 +1,8 @@
(Format: Year/Month/Day) (Format: Year/Month/Day)
Changes for 0.9.6: Changes for 0.9.6:
*03/10/05: *03/10/05:
* Fix reading of auto raise delay (Simon)
fluxbox.hh/cc Screen.cc Timer.hh/cc
* Make focusLast work for sloppy focus when changing workspace or * Make focusLast work for sloppy focus when changing workspace or
closing a window (Simon) closing a window (Simon)
- also generalises event redirects (e.g. for window moving) - also generalises event redirects (e.g. for window moving)

View file

@ -60,7 +60,7 @@ Timer::~Timer() {
} }
void Timer::setTimeout(long t) { void Timer::setTimeout(time_t t) {
m_timeout.tv_sec = t / 1000; m_timeout.tv_sec = t / 1000;
m_timeout.tv_usec = t; m_timeout.tv_usec = t;
m_timeout.tv_usec -= (m_timeout.tv_sec * 1000); m_timeout.tv_usec -= (m_timeout.tv_sec * 1000);

View file

@ -59,7 +59,7 @@ public:
inline void fireOnce(bool once) { m_once = once; } inline void fireOnce(bool once) { m_once = once; }
/// set timeout /// set timeout
void setTimeout(long val); void setTimeout(time_t val);
/// set timeout /// set timeout
void setTimeout(timeval val); void setTimeout(timeval val);
void setCommand(RefCount<Command> &cmd); void setCommand(RefCount<Command> &cmd);

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: Screen.cc,v 1.237 2003/10/05 02:31:22 rathnor Exp $ // $Id: Screen.cc,v 1.238 2003/10/05 06:28:47 rathnor Exp $
#include "Screen.hh" #include "Screen.hh"
@ -870,10 +870,10 @@ void BScreen::changeWorkspaceID(unsigned int id) {
// This is a little tricks to reduce flicker // This is a little tricks to reduce flicker
// this way we can set focus pixmap on frame before we show it // this way we can set focus pixmap on frame before we show it
// and using ExposeEvent to redraw without flicker // and using ExposeEvent to redraw without flicker
WinClient *win = getLastFocusedWindow(currentWorkspaceID()); //WinClient *win = getLastFocusedWindow(currentWorkspaceID());
if (win && win->fbwindow()) { //if (win && win->fbwindow()) {
win->fbwindow()->setFocusFlag(true); // win->fbwindow()->setFocusFlag(true);
} //}
currentWorkspace()->showAll(); currentWorkspace()->showAll();

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: fluxbox.cc,v 1.194 2003/10/05 02:31:23 rathnor Exp $ // $Id: fluxbox.cc,v 1.195 2003/10/05 06:28:47 rathnor Exp $
#include "fluxbox.hh" #include "fluxbox.hh"
@ -208,6 +208,13 @@ setFromString(const char *strval) {
setDefaultValue(); setDefaultValue();
} }
template<>
void FbTk::Resource<long>::
setFromString(const char *strval) {
if (sscanf(strval, "%ld", &m_value) != 1)
setDefaultValue();
}
//----------------------------------------------------------------- //-----------------------------------------------------------------
//---- manipulators for int, bool, and some enums with Resource --- //---- manipulators for int, bool, and some enums with Resource ---
//----------------------------------------------------------------- //-----------------------------------------------------------------
@ -286,6 +293,14 @@ getString() {
return string(tmpstr); return string(tmpstr);
} }
template<>
string FbTk::Resource<long>::
getString() {
char tmpstr[128];
sprintf(tmpstr, "%ld", m_value);
return string(tmpstr);
}
template<> template<>
void FbTk::Resource<Fluxbox::Layer>:: void FbTk::Resource<Fluxbox::Layer>::
setFromString(const char *strval) { setFromString(const char *strval) {
@ -403,6 +418,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
"session.titlebar.right", "Session.Titlebar.Right"), "session.titlebar.right", "Session.Titlebar.Right"),
m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"), m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"),
m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"), m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"),
m_rc_auto_raise_delay(m_resourcemanager, 250, "session.autoRaiseDelay", "Session.AutoRaiseDelay"),
m_focused_window(0), m_focused_window(0),
m_mousescreen(0), m_mousescreen(0),
m_keyscreen(0), m_keyscreen(0),
@ -493,7 +509,6 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
cerr<<"Warning: cannot set locale modifiers"<<endl; cerr<<"Warning: cannot set locale modifiers"<<endl;
resource.auto_raise_delay.tv_sec = resource.auto_raise_delay.tv_usec = 0;
resource.update_delay_time = 5; resource.update_delay_time = 5;
#ifdef HAVE_GETPID #ifdef HAVE_GETPID
@ -1499,11 +1514,6 @@ void Fluxbox::save_rc() {
sprintf(rc_string, "session.updateDelayTime: %lu", resource.update_delay_time); sprintf(rc_string, "session.updateDelayTime: %lu", resource.update_delay_time);
XrmPutLineResource(&new_blackboxrc, rc_string); XrmPutLineResource(&new_blackboxrc, rc_string);
sprintf(rc_string, "session.autoRaiseDelay: %lu",
((resource.auto_raise_delay.tv_sec * 1000) +
(resource.auto_raise_delay.tv_usec / 1000)));
XrmPutLineResource(&new_blackboxrc, rc_string);
ScreenList::iterator it = m_screen_list.begin(); ScreenList::iterator it = m_screen_list.begin();
ScreenList::iterator it_end = m_screen_list.end(); ScreenList::iterator it_end = m_screen_list.end();
@ -1662,18 +1672,6 @@ void Fluxbox::load_rc() {
} else } else
resource.update_delay_time = 5; resource.update_delay_time = 5;
if (XrmGetResource(*database, "session.autoRaiseDelay", "Session.AutoRaiseDelay",
&value_type, &value)) {
if (sscanf(value.addr, "%lu", &resource.auto_raise_delay.tv_usec) != 1)
resource.auto_raise_delay.tv_usec = 250;
} else
resource.auto_raise_delay.tv_usec = 250;
resource.auto_raise_delay.tv_sec = resource.auto_raise_delay.tv_usec / 1000;
resource.auto_raise_delay.tv_usec -=
(resource.auto_raise_delay.tv_sec * 1000);
resource.auto_raise_delay.tv_usec *= 1000;
// expand tilde // expand tilde
*m_rc_groupfile = StringUtil::expandFilename(*m_rc_groupfile); *m_rc_groupfile = StringUtil::expandFilename(*m_rc_groupfile);

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: fluxbox.hh,v 1.73 2003/10/05 02:31:23 rathnor Exp $ // $Id: fluxbox.hh,v 1.74 2003/10/05 06:28:47 rathnor Exp $
#ifndef FLUXBOX_HH #ifndef FLUXBOX_HH
#define FLUXBOX_HH #define FLUXBOX_HH
@ -143,7 +143,7 @@ public:
inline int getDesktopLayer() const { return 12; } inline int getDesktopLayer() const { return 12; }
inline const timeval &getAutoRaiseDelay() const { return resource.auto_raise_delay; } inline time_t getAutoRaiseDelay() const { return *m_rc_auto_raise_delay; }
inline unsigned int getCacheLife() const { return *m_rc_cache_life * 60000; } inline unsigned int getCacheLife() const { return *m_rc_cache_life * 60000; }
inline unsigned int getCacheMax() const { return *m_rc_cache_max; } inline unsigned int getCacheMax() const { return *m_rc_cache_max; }
@ -226,7 +226,6 @@ private:
struct resource { struct resource {
Time double_click_interval; Time double_click_interval;
timeval auto_raise_delay;
long update_delay_time; long update_delay_time;
} resource; } resource;
@ -261,6 +260,7 @@ private:
FbTk::Resource<TitlebarList> m_rc_titlebar_left, m_rc_titlebar_right; FbTk::Resource<TitlebarList> m_rc_titlebar_left, m_rc_titlebar_right;
FbTk::Resource<unsigned int> m_rc_cache_life, m_rc_cache_max; FbTk::Resource<unsigned int> m_rc_cache_life, m_rc_cache_max;
FbTk::Resource<time_t> m_rc_auto_raise_delay;
std::map<Window, WinClient *> m_window_search; std::map<Window, WinClient *> m_window_search;