mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-12-17 13:34:20 +01:00
Remove workaround for macOS TODO
TODO refs 3031 TODO refs SDL 5340 5976
This commit is contained in:
@@ -81,24 +81,6 @@ sc_mouse_capture_handle_event(struct sc_mouse_capture *mc,
|
|||||||
|
|
||||||
void
|
void
|
||||||
sc_mouse_capture_set_active(struct sc_mouse_capture *mc, bool capture) {
|
sc_mouse_capture_set_active(struct sc_mouse_capture *mc, bool capture) {
|
||||||
#ifdef __APPLE__
|
|
||||||
// Workaround for SDL bug on macOS:
|
|
||||||
// <https://github.com/libsdl-org/SDL/issues/5340>
|
|
||||||
if (capture) {
|
|
||||||
float mouse_x, mouse_y;
|
|
||||||
SDL_GetGlobalMouseState(&mouse_x, &mouse_y);
|
|
||||||
|
|
||||||
int x, y, w, h;
|
|
||||||
SDL_GetWindowPosition(mc->window, &x, &y);
|
|
||||||
SDL_GetWindowSize(mc->window, &w, &h);
|
|
||||||
|
|
||||||
bool outside_window = mouse_x < x || mouse_x >= x + w
|
|
||||||
|| mouse_y < y || mouse_y >= y + h;
|
|
||||||
if (outside_window) {
|
|
||||||
SDL_WarpMouseInWindow(mc->window, w / 2, h / 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
bool ok = SDL_SetWindowRelativeMouseMode(mc->window, capture);
|
bool ok = SDL_SetWindowRelativeMouseMode(mc->window, capture);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
LOGE("Could not set relative mouse mode to %s: %s",
|
LOGE("Could not set relative mouse mode to %s: %s",
|
||||||
|
|||||||
Reference in New Issue
Block a user