From d3d8f5effdececa43a553cde08bd62bea4d7ca08 Mon Sep 17 00:00:00 2001 From: Martin Gerhardy Date: Tue, 4 Jan 2022 22:36:39 +0100 Subject: [PATCH] VIDEO: disable multi viewport again - this isn't working properly yet https://github.com/libsdl-org/SDL/issues/5174 --- src/modules/ui/imgui/IMGUIApp.cpp | 13 ------------- src/modules/video/WindowedApp.cpp | 5 +++++ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/modules/ui/imgui/IMGUIApp.cpp b/src/modules/ui/imgui/IMGUIApp.cpp index 71bdafda9c..43b2bc9c74 100644 --- a/src/modules/ui/imgui/IMGUIApp.cpp +++ b/src/modules/ui/imgui/IMGUIApp.cpp @@ -758,19 +758,6 @@ void IMGUIApp::beforeUI() { // when straying out of bounds. int windowX = 0, windowY = 0; SDL_GetWindowPosition(mouseWindow, &windowX, &windowY); - int index = SDL_GetWindowDisplayIndex(mouseWindow); - if (index >= 0) { - SDL_Rect rect; - if (SDL_GetDisplayBounds(index, &rect) == 0) { - SDL_Point point; - point.x = mouseXGlobal; - point.y = mouseYGlobal; - if (!SDL_PointInRect(&point, &rect)) { - windowX -= rect.x; - windowY -= rect.y; - } - } - } io.MousePos = ImVec2((float)(mouseXGlobal - windowX), (float)(mouseYGlobal - windowY)); } } else { diff --git a/src/modules/video/WindowedApp.cpp b/src/modules/video/WindowedApp.cpp index cdc689bdc0..092d61e956 100644 --- a/src/modules/video/WindowedApp.cpp +++ b/src/modules/video/WindowedApp.cpp @@ -375,6 +375,7 @@ app::AppState WindowedApp::onInit() { if (isSingleWindowMode()) { _mouseCanUseGlobalState = false; } else { +#if 0 // Check and store if we are on a SDL backend that supports global mouse position // ("wayland" and "rpi" don't support it, but we chose to use a white-list instead of a black-list) const char *sdlBackend = SDL_GetCurrentVideoDriver(); @@ -384,6 +385,10 @@ app::AppState WindowedApp::onInit() { _mouseCanUseGlobalState = true; } } +#else + // TODO: the window (0:0) the mouse is hovering is on SDL display 0 (0:0:2560:1440), but the global mouse position is at 3646:769 + _mouseCanUseGlobalState = false; +#endif } video_trace_init();