[haiku-appserver] Re: GetMouse()

  • From: Adi Oanca <adioanca@xxxxxxxxxxxxxx>
  • To: haiku-appserver@xxxxxxxxxxxxx
  • Date: Thu, 19 May 2005 08:40:34 +0300

Axel Dörfler wrote:
> Hi there,
> 
> I've worked a bit on GetMouse(), and I think it's now more or less 
> correct.

        You're not done yet. :-)

- only BWindow's thread must be allowed to dispatch messages. (This
method should just query app_server if called with checkMessageQueue = true
from another thread - IMO. We should check how R5 behaves on this one.)
- you don't need to lock the message queue because you'll be in the
context of BWindow's thread. At least ::task_looper() doesn't do so,
maybe it should.
- you don't need to iterate through the whole queue for _UPDATE_
messages, there's a maximum of one present at a time.
- BeBook says: "his function first looks in the message queue for
  any pending reports of mouse-moved or mouse-up events" yet you discard
B_MOUSE_DOWN also. Why?
- "where" field from any B_MOUSE_* message contains a point that's in
screen coordinate system, conversion to local coords is needed.

        The rest is fine, thanks for your time. ;-)

Oh, one more thing...
        owner->fLink->Attach<port_id>(owner->fLink->GetReplyPort());
needs to go. It's useless.

> It still doesn't work correctly, but this time it's probably the 
> app_server's fault, as we only rarely get _UPDATE_ messages.

        Well, maybe with the above changes it will.


bye,
Adi.

Other related posts: