Not getting SDL_WINDOWEVENT_ENTER or LEAVE events on Windows

In porting my Mac game to Windows, I’ve traced some bugs to the fact that I’m not getting these events on the Windows side:

SDL_WINDOWEVENT_ENTER
SDL_WINDOWEVENT_LEAVE

I use these events to hide my custom sprite-based cursor and show the system cursor when it moves ouside the window, and vice-versa when it re-enters the window.

Can anyone else on Windows confirm that these events aren’t working on Windows?

Looking at the headers, I see they state “The window has gained / lost mouse focus” for these events.

Is this a possible case of these events behaving differently on Windows than on the Mac? On the Mac, simply moving the mouse inside or outside the window triggers these events. But on Windows, maybe “focus” is changed only when clicking between multiple windows owned by the same application, and given that my application has only 1 window, this never happens?

src/video/windows/SDL_windowsevents.c

253 #ifdef WM_MOUSELEAVE
254 /* FIXME: Do we need the SDL 1.2 hack to generate WM_MOUSELEAVE
now? /
255 case WM_MOUSELEAVE:
256 if (SDL_GetMouseFocus() == data->window) {
257 SDL_SetMouseFocus(NULL);
258 }
259 returnCode = 0;
260 break;
261 #endif /
WM_MOUSELEAVE */

Looks like the Win32 code could use some help.On Wed, Nov 16, 2011 at 2:08 PM, VernJensen wrote:

**
Looking at the headers, I see they state “The window has gained / lost
mouse focus” for these events.

Is this a possible case of these events behaving differently on Windows
than on the Mac? On the Mac, simply moving the mouse inside or outside the
window triggers these events. But on Windows, maybe “focus” is changed only
when clicking between multiple windows owned by the same application, and
given that my application has only 1 window, this never happens?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org