From db4d5d15833dfcc79f54163c972de1dba6399639 Mon Sep 17 00:00:00 2001 From: Lictex Steaven Date: Thu, 24 Mar 2022 09:40:18 -0700 Subject: Fix T90110: Dupli Window Not Immediately Active When creating a new window from a duplicated area - by shift-dragging on corner action zones - on the Windows platform the resulting window is initially unresponsive. This patch fixes this by releasing the parent window's mouse capture. See D14085 for more details. Differential Revision: https://developer.blender.org/D14085 Reviewed by Ray Molenkamp --- intern/ghost/intern/GHOST_WindowWin32.cpp | 6 ++++++ intern/ghost/intern/GHOST_WindowWin32.h | 9 ++++----- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'intern') diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 0f4b5147082..11a3c097958 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -151,6 +151,12 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system, ::SetWindowPos(m_hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); } + if (parentwindow) { + /* Release any parent capture to allow immediate interaction (T90110). */ + ::ReleaseCapture(); + parentwindow->lostMouseCapture(); + } + /* Show the window. */ int nCmdShow; switch (state) { diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h index 79b4e9d0cf6..d5f47871aff 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.h +++ b/intern/ghost/intern/GHOST_WindowWin32.h @@ -206,9 +206,7 @@ class GHOST_WindowWin32 : public GHOST_Window { GHOST_TSuccess endProgressBar(); /** - * Register a mouse capture state (should be called - * for any real button press, controls mouse - * capturing). + * Set or Release mouse capture (should be called for any real button press). * * \param event: Whether mouse was pressed and released, * or an operator grabbed or ungrabbed the mouse. @@ -216,8 +214,9 @@ class GHOST_WindowWin32 : public GHOST_Window { void updateMouseCapture(GHOST_MouseCaptureEventWin32 event); /** - * Inform the window that it has lost mouse capture, - * called in response to native window system messages. + * Inform the window that it has lost mouse capture, called in response to native window system + * messages (WA_INACTIVE, WM_CAPTURECHANGED) or if ReleaseCapture() is explicitly called (for new + * window creation). */ void lostMouseCapture(); -- cgit v1.2.3