[REBOL] Re: [grid]
From: g:santilli:tiscalinet:it at: 11-Jul-2004 11:36
Hi Ed,
On Saturday, July 10, 2004, 8:50:26 PM, you wrote:
EOC> Is event filtering available now, or is that something planned for a future
EOC> release of VID?
Available now by just using my filtering wake-event function or
Romano's eat function.
If you have an application that needs to scroll and lags, try just
adding this at the beginning and let me know the results:
#do [document {
===Event Filtering Patch to wake-event (wake-event.r)
This patch changes the awake function of the event port. The new
function filters queued events so that "useless" events are not
propagated to the event system. (For example, queued mouse events
are usually useless, unless you are writing a freehand paint
program.)
It is possible to customize the function by changing the kind of
events that are filtered when queued. The NO-QUEUE object is used
for this; an event of a type that matches a word in the object,
is never queued.
}]
; Event filtering --- speeds up view!
context [
no-queue: context [move: offset: none]
wake-event: func [event /local no-btn] bind [
either not pop-face [
do event
empty? screen-face/pane
] [
either any [pop-face = event/face within? event/offset win-offset? pop-face pop-face/size]
[
no-btn: false
if block? get in pop-face 'pane [
no-btn: foreach item pop-face/pane [if get in item 'action [break/return false] true]
]
if any [all [event/type = 'up no-btn] event/type = 'close] [hide-popup]
do event
] [
if pop-face/action [
if not find [move time] event/type [hide-popup]
do event
]
]
none? find pop-list pop-face
]
] in system/view 'self
system/ports/wait-list/1/awake: func [port /local event events lasttype] [
events: clear []
while [event: pick port 1] [
either all [in no-queue event/type lasttype = event/type] [
change back tail events event
] [
lasttype: event/type
insert tail events event
]
]
foreach event events [
if wake-event event [return true]
]
false
]
]
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/