From e61097b8881bc7e72a5499816cb1199ea274a3ca Mon Sep 17 00:00:00 2001 From: Sebastien Braun Date: Thu, 7 Oct 2010 22:54:10 +0200 Subject: Rework template meta-magic - No more implicit dependency on Boost.MPL - Better documentation for template magic - Move input handler policies to handler definitions where they belong - Separate out event descriptions from handlers --- src/input/inputEventHandler.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'src/input/inputEventHandler.cpp') diff --git a/src/input/inputEventHandler.cpp b/src/input/inputEventHandler.cpp index c16c358..5298aed 100644 --- a/src/input/inputEventHandler.cpp +++ b/src/input/inputEventHandler.cpp @@ -17,20 +17,17 @@ #include "inputEventHandler.h" #include "pvsCheckPrivileges.h" -bool policy::allowPrivilegedUser(InputEvent const& evt, InputEventContext const* ctx) +InputEventHandlerBase::HandlerStatus InputEventHandlerBase::handle(InputEvent const& evt, InputEventContext const* ctx) { - if(ctx) - return PVSCheckPrivileges::instance()->require(PVSCheckPrivileges::SESSION_UNKNOWN, PVSCheckPrivileges::USER_PRIVILEGED, - ctx); - else - return false; + if(!isApplicable(evt, ctx)) + return HANDLER_NOT_APPLICABLE; + if(!allow(evt, ctx)) + return HANDLER_NOT_ALLOWED; + doHandle(evt, ctx); + return HANDLER_MATCHED; } -bool policy::allowPhysicalSeat(InputEvent const& evt, InputEventContext const* ctx) +bool input_policy::AllowEverybody::allow(InputEventContext const*) { - if(ctx) - return PVSCheckPrivileges::instance()->require(PVSCheckPrivileges::SESSION_LOCAL, PVSCheckPrivileges::USER_UNKNOWN, - ctx); - else - return false; + return true; } -- cgit v1.2.3-55-g7522