[SDL] SDL gives incorrect mouse coordinates under Mac OS X

Michael Benfield leftfist at mac.com
Sun Sep 4 14:41:53 PDT 2005


Under Mac OS 10.3 with a recent SDL, I get incorrect mouse coordinates 
for button down events in a specific circumstance. If I pass another 
window over the SDL window, and then draw back that window, and then 
click in the middle of the SDL window, every subsequent click in the 
SDL window until I move the mouse will generate a mouse button down 
event with a Y coordinate of 0 regardless of where the click actually 
is. This doesn't happen under x86 Linux.

I'm including at the end of this email a tiny program that makes it 
easy to reproduce and see the issue.

Thanks,
Mike Benfield


#include<SDL.h>

int main(int argc, char** argv)
{
   SDL_Init(SDL_INIT_VIDEO);
   SDL_SetVideoMode(400, 400, 32, 0);

   SDL_Event e;
   for(;;) {
     if(SDL_PollEvent(&e))
       switch(e.type) {
       case SDL_MOUSEBUTTONDOWN:
         printf("click x: %d, y: %d\n", e.button.x, e.button.y);
         break;
       case SDL_QUIT:
         return 0;
       }
   }
}





More information about the SDL mailing list