On Sat, 4 Apr 2020 16:08:32 +0200 Martin Guy <martinw...@gmail.com> said:

you can't. there is no peek. the events are in the queue and will be processed
in that order.

instead don't DO the heavy work every event - use ecore_job to queue a job to
do later in the event queue processing. jobs are queued at the end of the
current event queue. if there is an old job - delete that job handle then add
the new one and store that job handle (onc e the job callback is called, clear
the handle to NULL).

even better .... use an animator. this means it will only be called as often as
the screen needs a refresh. so if  you get 10 or 20 mouse events between 2
frames you'll only do the heavy work (rendering) once regardless of how those
events are delivered. this is much better than any peeking hacks as your event
handling just stores the mouse input information and state changes you need and
then the animator evaluates it later to generate a frame. delete the animator
once it has called the animator callback (at end of callback) and set animator
handle to NULL. like with the jobs, if there is a mouse event, add an animator
if animator handle is null, store handle.

this technique works with any kind of input event queue, not just input events
- can work with ipc/network protocols or any kind of stream of requests where
you can do the work less often than the requests.

> Hi!
>    When receiving a mouse move event, I'd like to be able to peek at
> the queue of pending Evas events to see if there are any *other*
> mouse-move events pending, so that I can react to the most recent -
> otherwise my app redraws the screen at every pixel motion of teh
> mouse, which can get horribly slow.
> 
>    I haven't managed to find anything of the kind in the Enlightenment
> manuals, something like SDL's
> 
> if (SDL_PeepEvents(eventp, 1, SDL_GETEVENT,
> SDL_EVENTMASK(SDL_MOUSEMOTION)) == 1) {
> 
> Is there maybe a way to do this that I'm missing?
> 
> Thanks!
> 
>    M
> 
> 
> _______________________________________________
> enlightenment-users mailing list
> enlightenment-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-users
> 


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
Carsten Haitzler - ras...@rasterman.com



_______________________________________________
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users

Reply via email to