Mouse movement issue

If SDL is running in a window, and you click outside the window, then return
to the window, further mouse movements are delayed. It’s like it’s getting
queued up in the input buffer, and then th ebuffer gets really full, then it
slowly displays the buffer. It looks kinda like slow motion of what you
just did. Try this with any of the Agar demos: http://www.libagar.org or
svn co http://dev.hypertriton.com/trunk/agar--
H. E. Gilliland III

“Astronomy compels the soul to look upwards and leads us from this world to
another.”
? Plato

Hi.

The only time I have observed this kind of behaviour is when someones
code uses if(SDL_PollEvent()) rather than while(SDL_PollEvent()) ? If
you are not already doing so (the only reference I found to
SDL_PollEvent seems to be using an if statement), use a loop to clear
the event buffer.

Regards,

Brian.On Mon, Nov 24, 2008 at 11:20 PM, Herbert Elwood Gilliland III <herb.gilliland at gmail.com> wrote:

If SDL is running in a window, and you click outside the window, then return
to the window, further mouse movements are delayed. It’s like it’s getting
queued up in the input buffer, and then th ebuffer gets really full, then it
slowly displays the buffer. It looks kinda like slow motion of what you
just did. Try this with any of the Agar demos: http://www.libagar.org or
svn co http://dev.hypertriton.com/trunk/agar

I have been unable to reproduce this apparently elusive bug, but here
is an attempt at rectifying the common SDL misuse that Brian
identified as a potential culprit.

donny at teamspace:~/agar$ svn diff gui/view.c
Index: gui/view.cOn Mon, Nov 24, 2008 at 8:32 PM, Brian <brian.ripoff at gmail.com> wrote:

Hi.

The only time I have observed this kind of behaviour is when someones
code uses if(SDL_PollEvent()) rather than while(SDL_PollEvent()) ? If
you are not already doing so (the only reference I found to
SDL_PollEvent seems to be using an if statement), use a loop to clear
the event buffer.

===================================================================
— gui/view.c (revision 8000)
+++ gui/view.c (working copy)
@@ -1493,6 +1493,14 @@
#endif
Tr1 = SDL_GetTicks();
for (;:wink: {

  •    while (SDL_PollEvent(&ev) != 0) {
    
  •        printf("SDL EVENT!\n");
    
  •        if (AG_ProcessEvent(&ev) == -1) return;
    

+#ifdef AG_DEBUG

  •                   agEventAvg++;
    

+#endif

  •    }
    
  •           Tr2 = SDL_GetTicks();
              if (Tr2-Tr1 >= agView->rNom) {
                      AG_LockVFS(agView);
    

@@ -1515,12 +1523,6 @@
if (agView->rCur < 1) {
agView->rCur = 1;
}

  •           } else if (SDL_PollEvent(&ev) != 0) {
    
  •                   if (AG_ProcessEvent(&ev) == -1)
    
  •                           return;
    

-#ifdef AG_DEBUG

  •                   agEventAvg++;
    

-#endif
} else if (AG_TIMEOUTS_QUEUED()) { /* Safe */
AG_ProcessTimeouts(Tr2);
} else if (agView->rCur > agIdleThresh) {


http://codebad.com/