Opened 15 years ago

Last modified 15 years ago

#3510 new bug

BWindow filters do not receive mouse clicks

Reported by: matjako Owned by: axeld
Priority: normal Milestone: R1
Component: Kits/Application Kit Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

A filter added to a BWindow instance with AddCommonFilter() does not receive B_MOUSE_DOWN and B_MOUSE_UP messages, but it _does_ receive B_MOUSE_MOVED. That inhibits simple implementation of a mouse capture filter etc.

EXPECTED BEHAVIOUR

Like in BeOS R5 - all mouse messages are passed to a filter added to a BLooper.

STEPS TO REPRODUCE

Take any application with a window and some views in it and add a common filter to that window. Like so:

... in window init

AddCommonFilter(new BMessageFilter(B_ANY_DELIVERY, B_LOCAL_SOURCE, pass_thru_filter);

...

filter_result pass_thru_filter(BMessage *message, BHandler target, BMessageFilter *messageFilter) {

message->PrintToStream(); return B_DISPATCH_MESSAGE;

}

Run in Terminal. Click and hover over views in the window - only B_MOUSE_MOVED messages print out, mouse clicks appear to be MIA.

Change History (4)

comment:1 by jackburton, 15 years ago

Does it change in any way if you use B_ANY_SOURCE instead of B_LOCAL_SOURCE ?

in reply to:  1 comment:2 by matjako, 15 years ago

Replying to jackburton:

Does it change in any way if you use B_ANY_SOURCE instead of B_LOCAL_SOURCE ?

Indeed, with B_ANY_SOURCE the above test seem to work as expected! However, with B_LOCAL_SOURCE it is now totally erratic. Even MOUSE_MOVED messsages arrive only sporradically or not at all.

comment:3 by jackburton, 15 years ago

I guess it's correct like it is. Those mouse messages are sent by the app_server, so they are remote messages. The fact that using B_LOCAL_SOURCE you get some messages is because, IIRC, BWindow sends some of these messages itself. The bebook is also very clear about that: to receive messages from app_server, you have to use B_REMOTE_SOURCE (or B_ANY_SOURCE), so I'd be inclined to close this bug as invalid. Did that code work on beos, by chance ?

in reply to:  3 comment:4 by matjako, 15 years ago

Replying to jackburton:

I guess it's correct like it is. Those mouse messages are sent by the app_server, so they are remote messages. The fact that using B_LOCAL_SOURCE you get some messages is because, IIRC, BWindow sends some of these messages itself. The bebook is also very clear about that: to receive messages from app_server, you have to use B_REMOTE_SOURCE (or B_ANY_SOURCE), so I'd be inclined to close this bug as invalid. Did that code work on beos, by chance ?

I agree, the trouble is on the BeOS both LOCAL and ANY sources give the same results - which is a potential compatibility issue.

Note: See TracTickets for help on using tickets.