[haiku-appserver] Re: progress and status

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-appserver@xxxxxxxxxxxxx
  • Date: Wed, 18 May 2005 14:39:55 +0200 CEST

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.

> > 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.

Bye,
   Axel.


Other related posts: