[haiku-development] Re: Tool Tip B_MOUSE_IDLE message handling needs better fix, help appreciated

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 14 Dec 2013 21:45:39 +0100

Am 14/12/2013 19:59, schrieb John Scipione:
On Saturday, December 14, 2013, Axel Dörfler wrote:
It was well broken before so I wanted some sort of fix in the meantime
before I can get a proper fix if that's possible. That's what I'm trying
to figure out now.

What can I say, you were half way there.

> Please have a deep look at the following function:
> http://cgit.haiku-os.org/__haiku/tree/src/kits/interface/__Window.cpp#n3471
I'm sorry I don't understand. I lookedthere and That points to
ConvertToScreen() in BWindow. But AFAIK I don't have access to that in
App Server which is the root of the problem. What I'm looking for is a
fix that will work in App Server. The commit I referenced above shows
where I mean.

Amazing.
Well, let's do this one step at a time:
1) The app_server always sends the coordinates in screen coordinates. It does not care about view coordinates. 2) It also does not care about the target view, or if all views will get the message or just one. It will always just send a single message, and that's why it just can't care about view coordinates. 3) Before a window can hook into DispatchMessage(), the message will be read in the task_looper(), unpacked (ie. duplicated for the different receivers), and then sanitized by the method mentioned above. 4) That method knows how to deal with several message types, and will do all the hard work of converting the screen coordinates to the coordinates of the target view. 5) So, all what's left to do for you is to add a case for B_MOUSE_IDLE in _SanitizeMessage(), and the client code won't see a difference.

Since we introduced B_MOUSE_IDLE in the first place, we could just define that it sends out screen coordinates, too, but this way it would be more consistent with the rest of the API, and easier for the view to handle.

Bye,
   Axel.

Other related posts: