Hi, Axel Dörfler wrote: > Adi Oanca <adioanca@xxxxxxxxxxxxxx> wrote: > >>>> Then search for B_MOUSE_UP and B_MOUSE_MOVED messages, and >>>>while doing so, take the _UPDATE_ message that you may find and >>>>dispatch it. Calling DispatchMessage(updateMsg, window) is OK - I >>>>don't >>>>see any problem by doing so. >>> >>>I'm pretty sure that calling DispatchMessage() from GetMouse() is a >>>bad >>>idea. The first question to ask for me would be: why are you doing >>>this? >> >> Yes, agreed! >> But if we _know_ the message and we know we have a case for it, >>as we have for _UPDATE_, then it's perfectly safe. >> I suggested that because I don't want to take the code from >>case_UPDATE_ 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? 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). >>>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? If I call Window()->DispatchMessage(updateMsg, Window()), _UPDATE_ message will be dispatched in BWindow::DispatchMessage(). So, what are you talking about? bye, Adi.