[Bf-blender-cvs] [fef9463] master: Fix T40065: Pressing Esc in separate render result window does not focus main window.

Tamito Kajiyama noreply at git.blender.org
Tue Jul 1 08:08:08 CEST 2014


Commit: fef946312380683489874923cd44790741157377
Author: Tamito Kajiyama
Date:   Tue Jul 1 15:01:02 2014 +0900
https://developer.blender.org/rBfef946312380683489874923cd44790741157377

Fix T40065: Pressing Esc in separate render result window does not focus main window.

The problem is that the render window keeps keybord input focus even after it has been
lowered. Windows maintains the Z-order of windows, so the present solution is to raise
the window that has been just below the render window.

Differential revision: https://developer.blender.org/D594
Reviewed by: campbellbarton

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

M	intern/ghost/intern/GHOST_WindowWin32.cpp

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

diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 8436e3b..3000140 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -646,8 +646,23 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
 
 GHOST_TSuccess GHOST_WindowWin32::setOrder(GHOST_TWindowOrder order)
 {
-	HWND hWndInsertAfter = order == GHOST_kWindowOrderTop ? HWND_TOP : HWND_BOTTOM;
-	return ::SetWindowPos(m_hWnd, hWndInsertAfter, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
+	HWND hWndInsertAfter, hWndToRaise;
+
+	if (order == GHOST_kWindowOrderBottom) {
+		hWndInsertAfter = HWND_BOTTOM;
+		hWndToRaise = ::GetWindow(m_hWnd, GW_HWNDNEXT); /* the window to raise */
+	}
+	else {
+		hWndInsertAfter = HWND_TOP;
+		hWndToRaise = NULL;
+	}
+	if (::SetWindowPos(m_hWnd, hWndInsertAfter, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) == FALSE) {
+		return GHOST_kFailure;
+	}
+	if (hWndToRaise && ::SetWindowPos(hWndToRaise, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE) == FALSE) {
+		return GHOST_kFailure;
+	}
+	return GHOST_kSuccess;
 }




More information about the Bf-blender-cvs mailing list