Opened 11 years ago

Closed 11 years ago

#2075 closed bug (invalid)

BMessageFilter handles BView's B_MOUSE_DOWN in BWindow coordinate

Reported by: shinta Owned by: axeld
Priority: normal Milestone: R1
Component: Kits/Interface Kit Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: x86

Description

I added a common filter to BWindow to handle B_MOUSE_DOWN.

When the filter handles B_MOUSE_DOWN message (the message is to be sent to BView), the message contains "where" property in BWindow coordinate. In BeOS R5, the message contains "where" property in BView coordinate.

Current my Haiku environment is: hrev24912 Installed to real partition (not VM) with Core Duo T2500/2GB memory

SHINTA

Attachments (1)

DigestCode.cpp (1.4 KB) - added by shinta 11 years ago.

Download all attachments as: .zip

Change History (8)

Changed 11 years ago by shinta

Attachment: DigestCode.cpp added

comment:1 Changed 11 years ago by shinta

I found "be:view_where" property in B_MOUSE_DOWN message. "where" and "be:view_where" are convenient for getting BWindow/BView coordinate.

But, why don't you use "be:window_where" (BWindow coordinate) and "where" (BView coordinate) properties for backward (R5) compatibility?

SHINTA

comment:2 Changed 11 years ago by stippi

We actually try to do this and be backwards compatible, but it appears not to be working for your particular case. If you want, you could have a look at src/kits/interface/Window.cpp. There is a function called _SanitizeMessage() which is supposed to make the messages backward compatible. But apparently, this function is not used before the messages are passed to BMessageFilters. I would need to look closer at the code, right now I don't have an idea how to fix this problem.

comment:3 Changed 11 years ago by shinta

Although _SanitizeMessage() is not used before BMessageFilters, _SanitizeMessage() seem to be used after BMessageFilters. I could get "be:view_whare" in DigestCode.cpp's TTestHaikuWindow::MouseDown().

I simply think that how about modifying _SanitizeMessage() as follows:

add local window coordinates message->AddPoint("be:window_where", ConvertFromScreen(where));

add local view coordinates message->AddPoint("where", view->ConvertFromScreen(where)); message->AddPoint("be:view_where", view->ConvertFromScreen(where)); for old Haiku

comment:4 Changed 11 years ago by axeld

Resolution: fixed
Status: newclosed

Thanks for the investigation! Fixed in hrev24997. _SanitizeMessage() is called first, before the message gets to any filter or handler. The "be:view_where" is actually added by BeOS, too.

comment:5 Changed 11 years ago by shinta

Thank you!

SHINTA

comment:6 Changed 11 years ago by axeld

Resolution: fixed
Status: closedreopened

This change has been reverted in hrev26491 - "where" always only contains window coordinates, also in BeOS.

comment:7 Changed 11 years ago by axeld

Resolution: invalid
Status: reopenedclosed
Note: See TracTickets for help on using tickets.