From 646d5564c586d750f1e58cf3bf3c13ec97d7c3b0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 8 Nov 2012 11:15:02 -0800 Subject: [PATCH] Neither Windows nor Linux allow dragging out of the window without some sort of mouse capture, so for now punt on that behavior. --- src/events/SDL_mouse.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index c35cf3063..9444b287a 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -130,7 +130,21 @@ SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint8 buttonstate) } else { inWindow = SDL_TRUE; } + +/* Linux doesn't give you mouse events outside your window unless you grab + the pointer. + + Windows doesn't give you mouse events outside your window unless you call + SetCapture(). + + Both of these are slightly scary changes, so for now we'll punt and if the + mouse leaves the window you'll lose mouse focus and reset button state. +*/ +#ifdef SUPPORT_DRAG_OUTSIDE_WINDOW if (!inWindow && !buttonstate) { +#else + if (!inWindow) { +#endif if (window == mouse->focus) { #ifdef DEBUG_MOUSE printf("Mouse left window, synthesizing focus lost event\n");