On Sun, 5 Apr 2020 10:10:41 +0200 Martin Guy <martinw...@gmail.com> said:
> On 04/04/2020, Carsten Haitzler <ras...@rasterman.com> wrote: > > On Sat, 4 Apr 2020 16:08:32 +0200 Martin Guy <martinw...@gmail.com> said: > >> 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. > > > > 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 > > Many thanks, that's perfect, and has helped me think about > restructuring the app so that it's motion will be more fluid in all > scenarios. use the idea of "just store state and queue the heavy work until later, throwing out duplicates in the queue" for just about anything that can work this way... :) it's handy. > > even better .... use an animator. > > Nice! Unfortunately the redrawing work it has to do is not simple > enough for such a handy mechanism, but it's good to know about that > too you don't have to DO the draw in the animator - just trigger the draw - e.g. have a thread do the work and when results come back from the thread, update the appropriate object. Keep track of how many of these threaded draws you have in flight so they don't start stacking on top of each other and you submit draws from animators faster than they can be done, so e.g. only allow 2 draws in flight at any time by the draw thread and just have them queued so while one is busy, another is in the pipeline waiting to get worked on when the first finishes and submits results back to the mainloop for display. if a new draw is submitted before the 2nd queued draw is done, throw it out (the input state) and replace it with the newly queued one. this kind of strategy works regardless of the complexity of the draw - if it takes 1ms or 1000ms. -- ------------- 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