[REBOL] Re: [view] accelerating view...
From: g:santilli:tiscalinet:it at: 16-Jan-2004 9:48
Hi Maxim,
On Thursday, January 15, 2004, 7:47:55 PM, you wrote:
MOA> right now while dragging the mouse there is no more
MOA> than 2 frames a second refresh speed, if the show face is
Are you sure it's really that slow? Try to count the number of
times you're calling SHOW, you could be surprised.
I bet it's just that you're getting too much events. Romano's EAT
function or my event compressing WAKE-EVENT would probably fix the
problem for you.
MOA> is there a way to look-ahead for events and forget
MOA> events in some circumstances (like if there is already a more
MOA> recent mouse move event, I'd skip all those in the cue and
MOA> perform only the latest one... that is a very common process
MOA> amongst true signal based event handling).
Pasting my WAKE-EVENT here. (You can change the NO-QUEUE object to
decide what events should not be queued.)
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/
; 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
]
]