@@ -492,17 +492,7 @@ static void X11_DispatchFocusOut(SDL_VideoDevice *_this, SDL_WindowData *data)
492
492
/* If another window has already processed a focus in, then don't try to
493
493
* remove focus here. Doing so will incorrectly remove focus from that
494
494
* window, and the focus lost event for this window will have already
495
- * been dispatched anyway.
496
- */
497
- if (data -> tracking_mouse_outside_window && data -> window == SDL_GetMouseFocus ()) {
498
- // If tracking the pointer and keyboard focus is lost, raise all buttons and relinquish mouse focus.
499
- SDL_SendMouseButton (0 , data -> window , SDL_GLOBAL_MOUSE_ID , SDL_BUTTON_LEFT , false);
500
- SDL_SendMouseButton (0 , data -> window , SDL_GLOBAL_MOUSE_ID , SDL_BUTTON_MIDDLE , false);
501
- SDL_SendMouseButton (0 , data -> window , SDL_GLOBAL_MOUSE_ID , SDL_BUTTON_RIGHT , false);
502
- SDL_SendMouseButton (0 , data -> window , SDL_GLOBAL_MOUSE_ID , SDL_BUTTON_X1 , false);
503
- SDL_SendMouseButton (0 , data -> window , SDL_GLOBAL_MOUSE_ID , SDL_BUTTON_X2 , false);
504
- SDL_SetMouseFocus (NULL );
505
- }
495
+ * been dispatched anyway. */
506
496
if (data -> window == SDL_GetKeyboardFocus ()) {
507
497
SDL_SetKeyboardFocus (NULL );
508
498
}
@@ -1084,16 +1074,6 @@ void X11_HandleButtonRelease(SDL_VideoDevice *_this, SDL_WindowData *windowdata,
1084
1074
// see explanation at case ButtonPress
1085
1075
button -= (8 - SDL_BUTTON_X1 );
1086
1076
}
1087
-
1088
- /* If the mouse is captured and all buttons are now released, clear the capture
1089
- * flag so the focus will be cleared if the mouse is outside the window.
1090
- */
1091
- if ((window -> flags & SDL_WINDOW_MOUSE_CAPTURE ) &&
1092
- !(SDL_GetMouseState (NULL , NULL ) & ~SDL_BUTTON_MASK (button ))) {
1093
- window -> flags &= ~SDL_WINDOW_MOUSE_CAPTURE ;
1094
- windowdata -> tracking_mouse_outside_window = false;
1095
- }
1096
-
1097
1077
SDL_SendMouseButton (timestamp , window , mouseID , button , false);
1098
1078
}
1099
1079
}
@@ -1339,8 +1319,6 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
1339
1319
SDL_Log ("Mode: NotifyUngrab" );
1340
1320
}
1341
1321
#endif
1342
- data -> tracking_mouse_outside_window = false;
1343
-
1344
1322
SDL_SetMouseFocus (data -> window );
1345
1323
1346
1324
mouse -> last_x = xevent -> xcrossing .x ;
@@ -1387,17 +1365,14 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
1387
1365
if (xevent -> xcrossing .mode != NotifyGrab &&
1388
1366
xevent -> xcrossing .mode != NotifyUngrab &&
1389
1367
xevent -> xcrossing .detail != NotifyInferior ) {
1390
- if (!(data -> window -> flags & SDL_WINDOW_MOUSE_CAPTURE )) {
1391
- /* In order for interaction with the window decorations and menu to work properly
1392
- on Mutter, we need to ungrab the keyboard when the mouse leaves. */
1393
- if (!(data -> window -> flags & SDL_WINDOW_FULLSCREEN )) {
1394
- X11_SetWindowKeyboardGrab (_this , data -> window , false);
1395
- }
1396
1368
1397
- SDL_SetMouseFocus (NULL );
1398
- } else {
1399
- data -> tracking_mouse_outside_window = true;
1369
+ /* In order for interaction with the window decorations and menu to work properly
1370
+ on Mutter, we need to ungrab the keyboard when the mouse leaves. */
1371
+ if (!(data -> window -> flags & SDL_WINDOW_FULLSCREEN )) {
1372
+ X11_SetWindowKeyboardGrab (_this , data -> window , false);
1400
1373
}
1374
+
1375
+ SDL_SetMouseFocus (NULL );
1401
1376
}
1402
1377
} break ;
1403
1378
0 commit comments