Another round of bug fixes:

Simplifies and fix bugs in FbTk::Timer
(upstream git commit 33161595f482d0dad950ce127b6016eefe8ea691)

Fix bug: actually invert a given Texture (stupid typo)
(upstream git commit bf5da7f1b6e87f574774558700d066d9cff1f436)
This commit is contained in:
dcoppa 2013-01-21 09:49:20 +00:00
parent a24ad3c486
commit 3af1701582
4 changed files with 149 additions and 9 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.69 2013/01/14 15:57:56 dcoppa Exp $
# $OpenBSD: Makefile,v 1.70 2013/01/21 09:49:20 dcoppa Exp $
COMMENT= window manager based on the original Blackbox code
DISTNAME= fluxbox-1.3.3
REVISION= 1
REVISION= 2
CATEGORIES= x11

View File

@ -1,10 +1,22 @@
$OpenBSD: patch-src_FbTk_TextureRender_cc,v 1.3 2013/01/14 15:57:56 dcoppa Exp $
$OpenBSD: patch-src_FbTk_TextureRender_cc,v 1.4 2013/01/21 09:49:20 dcoppa Exp $
Fix bug: actually invert a given Texture (stupid typo)
(upstream git commit bf5da7f1b6e87f574774558700d066d9cff1f436)
Bugfix: ensure textures have the correct size before applying 'bevel'
(upstream git commit 239e895826b2f843bc50cc6fef8108db174c33e8)
--- src/FbTk/TextureRender.cc.orig Mon Dec 10 18:26:54 2012
+++ src/FbTk/TextureRender.cc Mon Jan 14 16:14:03 2013
+++ src/FbTk/TextureRender.cc Mon Jan 21 10:21:35 2013
@@ -264,7 +264,7 @@ void invertRGB(unsigned int w, unsigned int h, FbTk::R
FbTk::RGBA* r = rgba + (w * h);
for (--r; l < r; ++l, --r) { // swapping 32bits (RGBA) at ones.
- std::swap(*((unsigned int*)r), *(unsigned int*)r);
+ std::swap(*((unsigned int*)l), *(unsigned int*)r);
}
}
@@ -916,25 +916,25 @@ Pixmap TextureRender::renderSolid(const FbTk::Texture
if (texture.type() & Texture::INTERLACED) {

View File

@ -1,11 +1,14 @@
$OpenBSD: patch-src_FbTk_Timer_cc,v 1.1 2013/01/14 14:27:42 dcoppa Exp $
$OpenBSD: patch-src_FbTk_Timer_cc,v 1.2 2013/01/21 09:49:20 dcoppa Exp $
Fix bug: handle the list of Timers not in-place
(upstream git commit 4d307dcd10af9d817ff5c05fc40ae7487564cb31)
See: http://sourceforge.net/tracker/?func=detail&aid=3590078&group_id=35398&atid=413960
Simplifies and fix bugs in FbTk::Timer
(upstream git commit 33161595f482d0dad950ce127b6016eefe8ea691)
--- src/FbTk/Timer.cc.orig Mon Dec 10 18:26:54 2012
+++ src/FbTk/Timer.cc Mon Jan 14 15:01:05 2013
+++ src/FbTk/Timer.cc Mon Jan 21 10:09:44 2013
@@ -52,6 +52,7 @@
#endif
@ -14,7 +17,102 @@ See: http://sourceforge.net/tracker/?func=detail&aid=3590078&group_id=35398&atid
#include <set>
@@ -195,32 +196,35 @@ void Timer::updateTimers(int fd) {
@@ -66,48 +67,28 @@ typedef std::set<FbTk::Timer*, TimerCompare> TimerList
TimerList s_timerlist;
-
-/// add a timer to the static list
-void addTimer(FbTk::Timer *timer) {
-
- assert(timer);
- int interval = timer->getInterval();
-
- // interval timers have their timeout change every time they are started!
- if (interval != 0) {
- timer->setTimeout(interval * FbTk::FbTime::IN_SECONDS);
- }
-
- s_timerlist.insert(timer);
}
-/// remove a timer from the static list
-void removeTimer(FbTk::Timer *timer) {
- assert(timer);
- s_timerlist.erase(timer);
-}
-
-
-}
-
-
namespace FbTk {
-Timer::Timer():m_timing(false), m_once(false), m_interval(0) {
+Timer::Timer() :
+ m_once(false),
+ m_interval(0),
+ m_start(0) {
}
Timer::Timer(const RefCount<Slot<void> > &handler):
m_handler(handler),
- m_timing(false),
m_once(false),
- m_interval(0) {
+ m_interval(0),
+ m_start(0) {
}
Timer::~Timer() {
- if (isTiming()) stop();
+ stop();
}
@@ -130,19 +111,31 @@ void Timer::setCommand(const RefCount<Slot<void> > &cm
void Timer::start() {
- m_start = FbTk::FbTime::now();
-
// only add Timers that actually DO something
- if ((! m_timing || m_interval != 0) && m_handler) {
- m_timing = true;
- ::addTimer(this);
+ if ( ( ! isTiming() || m_interval > 0 ) && m_handler) {
+
+ // in case start() gets triggered on a started
+ // timer with 'm_interval != 0' we have to remove
+ // it from s_timerlist before restarting it
+ stop();
+
+ m_start = FbTk::FbTime::now();
+
+ // interval timers have their timeout change every
+ // time they are started!
+ if (m_interval != 0) {
+ m_timeout = m_interval * FbTk::FbTime::IN_SECONDS;
+ }
+ s_timerlist.insert(this);
}
}
void Timer::stop() {
- m_timing = false;
- ::removeTimer(this);
+ if (isTiming()) {
+ s_timerlist.erase(this);
+ m_start = 0;
+ }
}
uint64_t Timer::getEndTime() const {
@@ -195,32 +188,41 @@ void Timer::updateTimers(int fd) {
return;
}
@ -55,10 +153,16 @@ See: http://sourceforge.net/tracker/?func=detail&aid=3590078&group_id=35398&atid
- t->start();
- } else {
- t->stop();
+ t.fireTimeout();
+ // first we stop the timer to remove it
+ // from s_timerlist
+ t.stop();
+
+ if (! t.doOnce()) { // restart the current timer
+ // then we call the handler which might (re)start 't'
+ // on it's own
+ t.fireTimeout();
+
+ // restart 't' if needed
+ if (!t.doOnce() && !t.isTiming()) {
+ t.start();
}
}

View File

@ -0,0 +1,24 @@
$OpenBSD: patch-src_FbTk_Timer_hh,v 1.1 2013/01/21 09:49:20 dcoppa Exp $
Simplifies and fix bugs in FbTk::Timer
(upstream git commit 33161595f482d0dad950ce127b6016eefe8ea691)
--- src/FbTk/Timer.hh.orig Mon Dec 10 18:26:54 2012
+++ src/FbTk/Timer.hh Mon Jan 21 10:25:31 2013
@@ -61,7 +61,7 @@ class Timer { (public)
static void updateTimers(int file_descriptor);
- int isTiming() const { return m_timing; }
+ int isTiming() const { return (m_start > 0); }
int getInterval() const { return m_interval; }
int doOnce() const { return m_once; }
@@ -77,7 +77,6 @@ class Timer { (public)
private:
RefCount<Slot<void> > m_handler; ///< what to do on a timeout
- bool m_timing; ///< clock running?
bool m_once; ///< do timeout only once?
int m_interval; ///< Is an interval-only timer (e.g. clock), in seconds