[squeak-dev] Re: Event filters for user input events (i.e. mouse clicks etc.)

marcel.taeumel Marcel.Taeumel at hpi.de
Sat May 21 07:40:33 UTC 2016


Hi, there.

Here is a new version of event filters with support for separating capturing
filters from bubbling filters.
https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-flow-capture
https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-flow-bubbling

Here is the change set:  event-filters.cs
<http://forum.world.st/file/n4896486/event-filters.cs>  

Note that you should either use a fresh trunk image with the latest updates
OR unload all the changes from my previous change set because I cleaned up
this one. So, there will be some "method removed" calls missing.

Anyway, with support for capturing filters, you can also filter, for
example, mouse events for system windows that are always active (see
preference "Windows Active Only On Top" disabled).

wnd := ActiveWorld submorphs fourth.
mouseFilter := PluggableEventFilter on: [:evt :target | evt ignore].
wnd addMouseCaptureFilter: mouseFilter.
wnd removeMouseCaptureFilter: mouseFilter.

See how the behavior is different when you use the filter for the bubbling
phase:

wnd addMouseBubbleFilter: mouseFilter.
wnd removeMouseBubbleFilter: mouseFilter.

Note that event bubbling is implemented in MorphicEventDispatcher. If there
would be no bubbling, those filters would be meaningless. However, I am not
aware of an alternative event dispatcher for Squeak's Morphic.

What other dispatch patterns are out there? :-)

Best,
Marcel



--
View this message in context: http://forum.world.st/Event-filters-for-user-input-events-i-e-mouse-clicks-etc-tp4895521p4896486.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.


More information about the Squeak-dev mailing list