[SDL] Getting the mouse position

Peter Mackay mackay.pete+gmane at gmail.com
Fri Sep 15 02:10:00 PDT 2006

I think there's a Win32 function called ClientToScreen() or something like 
that. Hopefully it does the "right thing" with multiple desktops and so on.


"Charles MacDonald" <chamacd at gmail.com> wrote in message 
news:486a04420609140953i6e7df321s29d7377ce167f89c at mail.gmail.com...
> Hello,
> I'd like to add a standard Windows right-click popup menu to my
> program. The mouse coordinates returned by an SDL mouse event are
> relative to the application window's upper-left corner, however I need
> them relative to the upper-left corner of the desktop.
> I tried using SDL_EventState() to ignore the SDL_MOUSEBUTTONDOWN/UP
> event, but the window dialog proc never picks up a mouse event. Though
> ideally I'd like to keep SDL mouse event handling intact.
> Is there another way I can either get the absolute mouse position on
> the screen/desktop, or the position of the application window to
> adjust the window-relative coordinates by?
> Regards,
> Charles 

More information about the SDL mailing list