[haiku-appserver] Re: progress and status

  • From: Adi Oanca <adioanca@xxxxxxxxxxxxxx>
  • To: haiku-appserver@xxxxxxxxxxxxx
  • Date: Wed, 18 May 2005 17:17:45 +0300

Axel Dörfler wrote:
> 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.

        Sending _UPDATE_ message to DispatchMessage() is a good thing because,
this is the method handling incoming messages no matter in what way they are
passed to it.

>>>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());
> ...

        No! I did not said that! Look above. If we do that the hook Mouse*()
functions will be called, a thing we agreed that it shouldn't happen.

>                               case =5FUPDATE=5F:
>                               {
>                                       Window()->DispatchMessage(msg, 
> Window());
> ...

        That's perfect.

> That's just wrong.

        It's wrong to dispatch B_MOUSE_MOVED and B_MOUSE_UP messages, as those
should be eaten up (and their info used).
        It's _good_ and _safe_ to dispatch _UPDATE_.


bye,
Adi.

Other related posts: