From d39c023411aca300017a2710d484a2b16e5dd064 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Wed, 27 Nov 2002 21:47:46 +0000 Subject: using SignalEventHandler class instead of the old EventHandler template --- src/FbTk/SignalHandler.cc | 12 +++++------- src/FbTk/SignalHandler.hh | 17 ++++++++--------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/FbTk/SignalHandler.cc b/src/FbTk/SignalHandler.cc index d78c42c..ddb3766 100644 --- a/src/FbTk/SignalHandler.cc +++ b/src/FbTk/SignalHandler.cc @@ -19,13 +19,13 @@ // 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 *SignalHandler::s_signal_handler[NSIG]; +SignalEventHandler *SignalHandler::s_signal_handler[NSIG]; SignalHandler::SignalHandler() { // clear signal list @@ -38,8 +38,8 @@ SignalHandler *SignalHandler::instance() { return &singleton; } -bool SignalHandler::registerHandler(int signum, EventHandler *eh, - EventHandler **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 @@ void SignalHandler::handleSignal(int signum) { 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); } } diff --git a/src/FbTk/SignalHandler.hh b/src/FbTk/SignalHandler.hh index e05fb3a..aa3a275 100644 --- a/src/FbTk/SignalHandler.hh +++ b/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 @@ // 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 namespace FbTk { -struct SignalEvent { - int signum; + +class SignalEventHandler { +public: + virtual void handleSignal(int signum) = 0; }; /** @@ -42,7 +42,6 @@ struct SignalEvent { */ class SignalHandler { public: - /// get singleton object static SignalHandler *instance(); /** @@ -52,7 +51,7 @@ public: @param eh event handler @param oldhandler_ret return handler to old sighandler */ - bool registerHandler(int signum, EventHandler *eh, EventHandler **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 @@ private: static void handleSignal(int signum); - static EventHandler *s_signal_handler[NSIG]; ///< NSIG defined in signal.h + static SignalEventHandler *s_signal_handler[NSIG]; ///< NSIG defined in signal.h }; }; // end namespace FbTk -- cgit v0.11.2