using SignalEventHandler class instead of the old EventHandler template
fluxgen fluxgen
2 files changed,
13 insertions(+),
16 deletions(-)
M
src/FbTk/SignalHandler.cc
→
src/FbTk/SignalHandler.cc
@@ -19,13 +19,13 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: SignalHandler.cc,v 1.1 2002/11/26 16:01:27 fluxgen Exp $ +// $Id: SignalHandler.cc,v 1.2 2002/11/27 21:47:46 fluxgen Exp $ #include "SignalHandler.hh" namespace FbTk { -EventHandler<SignalEvent> *SignalHandler::s_signal_handler[NSIG]; +SignalEventHandler *SignalHandler::s_signal_handler[NSIG]; SignalHandler::SignalHandler() { // clear signal list@@ -38,8 +38,8 @@ static SignalHandler singleton;
return &singleton; } -bool SignalHandler::registerHandler(int signum, EventHandler<SignalEvent> *eh, - EventHandler<SignalEvent> **oldhandler_ret) { +bool SignalHandler::registerHandler(int signum, SignalEventHandler *eh, + SignalEventHandler **oldhandler_ret) { // must be less than NSIG if (signum >= NSIG) return false;@@ -72,9 +72,7 @@ if (signum >= NSIG)
return; // make sure we got a handler for this signal if (s_signal_handler[signum] != 0) { - SignalEvent sigev; - sigev.signum = signum; - s_signal_handler[signum]->handleEvent(&sigev); + s_signal_handler[signum]->handleSignal(signum); } }
M
src/FbTk/SignalHandler.hh
→
src/FbTk/SignalHandler.hh
@@ -1,4 +1,4 @@
-// SignalHandler.hh for Fluxbox Window Manager +// SignalHandler.hh for FbTk // Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org) // // Permission is hereby granted, free of charge, to any person obtaining a@@ -19,19 +19,19 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: SignalHandler.hh,v 1.1 2002/11/26 16:01:27 fluxgen Exp $ +// $Id: SignalHandler.hh,v 1.2 2002/11/27 21:47:33 fluxgen Exp $ #ifndef FBTK_SIGNALHANDLER_HH #define FBTK_SIGNALHANDLER_HH - -#include "EventHandler.hh" #include <signal.h> namespace FbTk { -struct SignalEvent { - int signum; + +class SignalEventHandler { +public: + virtual void handleSignal(int signum) = 0; }; /**@@ -42,7 +42,6 @@ a signal number
*/ class SignalHandler { public: - /// get singleton object static SignalHandler *instance(); /**@@ -52,7 +51,7 @@ @param signum signal number
@param eh event handler @param oldhandler_ret return handler to old sighandler */ - bool registerHandler(int signum, EventHandler<SignalEvent> *eh, EventHandler<SignalEvent> **oldhandler_ret = 0); + bool registerHandler(int signum, SignalEventHandler *eh, SignalEventHandler **oldhandler_ret = 0); /** removes the signum handler @param signum signal number@@ -63,7 +62,7 @@ SignalHandler();
static void handleSignal(int signum); - static EventHandler<SignalEvent> *s_signal_handler[NSIG]; ///< NSIG defined in signal.h + static SignalEventHandler *s_signal_handler[NSIG]; ///< NSIG defined in signal.h }; }; // end namespace FbTk