From 3af1701582584a927dc2247fff111843e1e4430b Mon Sep 17 00:00:00 2001 From: dcoppa Date: Mon, 21 Jan 2013 09:49:20 +0000 Subject: [PATCH] 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) --- x11/fluxbox/Makefile | 4 +- .../patches/patch-src_FbTk_TextureRender_cc | 16 ++- x11/fluxbox/patches/patch-src_FbTk_Timer_cc | 114 +++++++++++++++++- x11/fluxbox/patches/patch-src_FbTk_Timer_hh | 24 ++++ 4 files changed, 149 insertions(+), 9 deletions(-) create mode 100644 x11/fluxbox/patches/patch-src_FbTk_Timer_hh diff --git a/x11/fluxbox/Makefile b/x11/fluxbox/Makefile index 160618c0493..a9282d8811b 100644 --- a/x11/fluxbox/Makefile +++ b/x11/fluxbox/Makefile @@ -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 diff --git a/x11/fluxbox/patches/patch-src_FbTk_TextureRender_cc b/x11/fluxbox/patches/patch-src_FbTk_TextureRender_cc index e324b48199c..0892d7ebbb5 100644 --- a/x11/fluxbox/patches/patch-src_FbTk_TextureRender_cc +++ b/x11/fluxbox/patches/patch-src_FbTk_TextureRender_cc @@ -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) { diff --git a/x11/fluxbox/patches/patch-src_FbTk_Timer_cc b/x11/fluxbox/patches/patch-src_FbTk_Timer_cc index e7de944af75..8115931a41c 100644 --- a/x11/fluxbox/patches/patch-src_FbTk_Timer_cc +++ b/x11/fluxbox/patches/patch-src_FbTk_Timer_cc @@ -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 -@@ -195,32 +196,35 @@ void Timer::updateTimers(int fd) { +@@ -66,48 +67,28 @@ typedef std::set 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 > &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 > &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(); } } diff --git a/x11/fluxbox/patches/patch-src_FbTk_Timer_hh b/x11/fluxbox/patches/patch-src_FbTk_Timer_hh new file mode 100644 index 00000000000..1dd3c03c9f7 --- /dev/null +++ b/x11/fluxbox/patches/patch-src_FbTk_Timer_hh @@ -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 > 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 +