[haiku-3rdparty-dev] Re: MouseUp() and GetMouse()

  • From: Carlo Lanzotti - DynaDream <clanzotti@xxxxxxxxxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Tue, 8 Jan 2019 16:26:54 +0100

Il 08/01/2019 15:56, Stephan Aßmus ha scritto:


Am 08.01.2019 um 15:26 schrieb Carlo Lanzotti - DynaDream:
thanks for your reply. It just confused me because I was thinking it was something to report which mouse buttons were involved when calling the hooks.

Is there a way to get which buttons was released in the MouseUp() hook?

This is off the top of my head: Use Window()->CurrentMessage()->PrintToStream() from within your MouseUp() implementation. If there is no helpful "old buttons" kind of data in that message, you indeed have to track the buttons yourself. By comparing your stored uint32 buttons value against the new buttons value from the Message, you can know what button was release.

Please note that you should not use GetMouse(). GetMouse() will give you the current state of the mouse, it will query the app_server for that. Mouse messages may be processed with a delay in your application, and GetMouse() could mess up the event order. As an example, the button that was released and triggered your MouseUp() hook to be called, may already be pressed again by the time you process the event, and GetMouse() will show that. The value in the message will however reflect the buttons at the time the event was generated for you.

Best regards,

Hi Stefan,

yes, I figured it out about GetMouse(). Actually what I'm doing is comparing buttons flags like you suggested. I was curious about the fact that there is not a flag indicating which buttons got involved in the process.

Thanks for your help.

Best Regards,

Carlo Lanzotti

DynaDream - Dynamic Laboratory


Other related posts: