From 169838613976ca8f1c0a33b1da3b730d4f41e243 Mon Sep 17 00:00:00 2001 From: SirMangler Date: Fri, 18 Jun 2021 12:27:36 +0100 Subject: [PATCH] RenderWidget: Set Window to Top for Cursor Lock --- Source/Core/DolphinQt/RenderWidget.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/Core/DolphinQt/RenderWidget.cpp b/Source/Core/DolphinQt/RenderWidget.cpp index 6ce9d6336f..4951649727 100644 --- a/Source/Core/DolphinQt/RenderWidget.cpp +++ b/Source/Core/DolphinQt/RenderWidget.cpp @@ -254,6 +254,10 @@ void RenderWidget::SetCursorLocked(bool locked, bool follow_aspect_ratio) if (locked) { #ifdef _WIN32 + // This will prevent the mouse from interacting with the task bar + // while in windowed / borderless fullscreen. + SetWindowPos((HWND) winId(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + RECT rect; rect.left = render_rect.left(); rect.right = render_rect.right(); @@ -280,6 +284,7 @@ void RenderWidget::SetCursorLocked(bool locked, bool follow_aspect_ratio) else { #ifdef _WIN32 + SetWindowPos((HWND) winId(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); ClipCursor(nullptr); #endif