Adi Oanca <adioanca@xxxxxxxxxxxxxx> wrote: > Axel D=F6rfler wrote: > >> But if we =5Fknow=5F the message and we know we have a case for it, > >>as we have for =5FUPDATE=5F, then it's perfectly safe. > >> I suggested that because I don't want to take the code from > >>case=5FUPDATE=5F and copy it in GetMouse(). > > I'm afraid you have to; DispatchMessage() is virtual and can and > > will > > be overridden. IOW you don't have control over this method - you > > would > > need to make sure that the BWindow version of it is called, but you > > don't do that. > Two words: doesn't matter. So what if it's virtual and can be > overridden=3F The class that will override this method is required to > have > BWindow::DispatchMessage(msg, handler) called if it cannot handle the > message. Just like BWindow which calls BLooper::DispatchMessage(msg, > handler). That's not true. It can do lots of stuff during a DispatchMessage(), stuff that shouldn't happen during a GetMouse() (and is not documented this way either). Just put the stuff from DispatchMessage() =5FUPDATE=5F in a separate method and call it from both sides. That's the cleanest solution. > >>>DispatchMessage() will a) process the messages, and b) call the > >>>handler's MessageReceived() hooks (hello stack eating recursion, > >>>btw). > >> Not in this case. > > Have a look at our implementation: it's called for all messages. > Are we talking the same thing=3F > If I call Window()->DispatchMessage(updateMsg, Window()), > =5FUPDATE=5F message will be dispatched in BWindow::DispatchMessage(). > So, what are you talking about=3F GetMouse(): case B=5FMOUSE=5FUP: ... Window()->DispatchMessage(msg, Window()); ... case B=5FMOUSE=5FMOVED: ... Window()->DispatchMessage(msg, Window()); ... case =5FUPDATE=5F: { Window()->DispatchMessage(msg, Window()); ... That's just wrong. Bye, Axel.