[Bf-blender-cvs] [db4d5d15833] master: Fix T90110: Dupli Window Not Immediately Active

Lictex Steaven noreply at git.blender.org
Thu Mar 24 17:41:39 CET 2022


Commit: db4d5d15833dfcc79f54163c972de1dba6399639
Author: Lictex Steaven
Date:   Thu Mar 24 09:40:18 2022 -0700
Branches: master
https://developer.blender.org/rBdb4d5d15833dfcc79f54163c972de1dba6399639

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

===================================================================

M	intern/ghost/intern/GHOST_WindowWin32.cpp
M	intern/ghost/intern/GHOST_WindowWin32.h

===================================================================

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();



More information about the Bf-blender-cvs mailing list