aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Signal.hh
AgeCommit message (Collapse)AuthorFilesLines
2011-09-14Enable connecting to const SignalsPavel Labath1-17/+19
The idea is that connecting to a signal doesn't change it's state or the state of the object owning the signal (even though it needs to add the functor to the list for later reference). Emitting, on the other hand, is usually done as a result of a state change and therefore remains non-const. Additional benefit of this arrangement is that objects can export const references to signals to allow connecting, while keeping the ability to emit to themselves.
2011-09-14Rename Signal::connect function taking an already-constructed slot to ↵Pavel Labath1-7/+7
connectSlot I do this to avoid compiler ambiguity between the two versions of connect()
2011-09-14Signal::connect now also accepts an already-constructed SlotPavel Labath1-3/+27
This way we can use Commands as signal handlers out-of-the-box.
2011-09-14Prepare the Slot classes to be used independently of SignalsPavel Labath1-33/+58
Added some polish around them and, to mark this special occasion, moved them out of the SigImpl namespace. PS: This partially reverts commit 0775350fee345e37fb59835dda4d85664346b606, since I had to reintroduce ReturnType template parameter, because it will be used in other places. But Signal classes remain without the ReturnType, because I still cannot imagine how would it be used.
2011-05-10Make SignalTracker always disconnect itself from SignalsPavel Labath1-4/+3
previously, the tracker disconnected itself only when the caller passed withTracker = true to the leave() function. However, the default value was for the parameter was false. Non disconnecting from signal when stopping tracking creates very dangerous situation because the signal still holds a pointer to the tracker. This resulted in a segfault when exiting fluxbox, because the tracker (FluxboxWindow) got destroyed before the signal (BScreen::focusedWindowSig), and the signal was using an invalid pointer when it tried to disconnect itself from the tracker. Instead of setting withTracker to true by default or changing all invocations of leave(), I decided to make the tracker disconnect itself unconditionally because I could not find a use case for the opposite behaviour. PS: This message is in fact longer than the actual commit.
2011-05-10Last round of simplification of Signal/Slot classesPavel Labath1-65/+37
- merged all the common stuff from 0,1,2,3 argument versions into one common base class - removed ReturnType template parameter as it was instantiated with "void" everywhere and the current ignores the return value of the callbacks anyway
2011-05-10Don't crash when a slot is deregistered in the middle of signal processingPavel Labath1-15/+46
this was possible (and used) with FbTk::Subject, but the implemetation of FbTk::Signal didn't support it, which made it impossible to continue with conversion.
2011-05-10Simplify Slot.hhPavel Labath1-22/+27
Replace CallbackHolder, FunctorHolder and SlotHolder with a (smaller) set of polymorphic classes. SignalHolder now stores a (smart) pointer to the class.
2011-05-10Simplify FbTk::Signal template classes a bitPavel Labath1-64/+30
basically, i just got rid of Signal[0-3] classes and moved their contents to the appropriate specialization of FbTk::Signal also, this fixes the no matching function for call to 'MemFunIgnoreArgs(FbTk::Signal<void, FbTk::SigImpl::EmptyArg, FbTk::SigImpl::EmptyArg, FbTk::SigImpl::EmptyArg>&, void (FbTk::SigImpl::Signal0<void>::*)())' error i had in the following commit.
2010-07-14bugfix: another crash when cleaning up signalsJim Ramsay1-4/+4
While 769130f51a8f did fix one issue, it introduced another by changing the logic related to the new SignalTracker. The original logic (introduced in 9ad388c5bf16) was: -> in 'leave(Signal)', only call 'disconnect' -> in 'leaveAll()', call 'disconnect' and 'disconnectTracker' But 769130f51a8f inverted this, calling 'disconnectTracker' in both cases but only 'disconnect' in the 'leaveAll()' case, which would leave unattached signals around after calling 'leave(Signal)'. This fix not only repairs the logic, but renames the ambiguous 'disconnect' boolean to something more explicit: 'withTracker'.
2010-05-23bugfix: do not use invalid iterators while looping thru a container which ↵Mathias Gumz1-3/+2
gets destroyed
2010-05-07bugfix: crash when cleaning up signalsMathias Gumz1-10/+9
22fa5f544b35 was not fixing anything, the real cause is that the SignalHolder still has a reference to a not existing Tracker.
2010-05-06bugfix: added missing 'virtual' keyword, otherwise fluxbox crashes with ↵Mathias Gumz1-1/+1
'pure virtual method called'
2010-03-26Added Tracker interface for SignalHolder.Henrik Kinnunen1-3/+40
This is used by SignalTracker so Signals can disconnect from it when they die.
2009-10-03compile fixes for sun compiler 5.10: complains about 'not beeing able to ↵Mathias Gumz1-1/+1
initialize this from that'
2008-09-28Change focused signal to use the new signal systemHenrik Kinnunen1-11/+21
2008-09-21no virtuals needed Signals, added leaveAll for SignalTracker which must be ↵Henrik Kinnunen1-13/+22
used before all screens dies.
2008-09-21fix a few things with new signal codeMark Tiefenbruck1-5/+22
2008-09-18Added new Signal/Slot system in FbTkHenrik Kinnunen1-0/+218
This is suppose to replace the obsolete Subject/Observer classes. See the src/tests/testSignals.cc for basic usage.