From b360ada4bd84e9e7f110b07ea74249c8e5ec6399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 21 Nov 2005 17:02:56 +0000 Subject: [PATCH] If a handler passes a BMessage on to the next handler, it will now make sure its filters are taken into account. It will also filter out messages in case the filter targeted the current handler again - note, this is not really a good solution, as ideally, all previous handlers must be ignored. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15061 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/Handler.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/kits/app/Handler.cpp b/src/kits/app/Handler.cpp index a30f0fb7cc..b8b91660f7 100644 --- a/src/kits/app/Handler.cpp +++ b/src/kits/app/Handler.cpp @@ -318,8 +318,15 @@ BHandler::MessageReceived(BMessage *message) // ToDo: there is some more work needed here (someone in the know should fill in)! if (fNextHandler) { - // ToDo: take the handler's message filter into account! - fNextHandler->MessageReceived(message); + // we need to apply the next handler's filters here, too + BHandler* target = Looper()->_HandlerFilter(message, fNextHandler); + if (target != NULL && target != this) { + // TODO: we also need to make sure that "target" is not before + // us in the handler chain - at least in case it wasn't before + // the handler actually targeted with this message - this could + // get ugly, though. + target->MessageReceived(message); + } } else if (message->what != B_MESSAGE_NOT_UNDERSTOOD && (message->WasDropped() || message->HasSpecifiers())) { printf("BHandler::MessageReceived(): B_MESSAGE_NOT_UNDERSTOOD");