소스 검색

Added simulated mouse up event for resize/move events

Marko Pintera 12 년 전
부모
커밋
e217ac68ce
3개의 변경된 파일18개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 0
      CamelotCore/Include/CmPlatformWndProc.h
  2. 16 0
      CamelotCore/Source/CmPlatformWndProc.cpp
  3. 0 3
      EditorWindowDock.txt

+ 2 - 0
CamelotCore/Include/CmPlatformWndProc.h

@@ -11,6 +11,8 @@ namespace CamelotFramework
 		static LRESULT CALLBACK _win32WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
 		static LRESULT CALLBACK _win32WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
 
 
 	private:
 	private:
+		static UINT32 mMoveResizeMouseUpState; // 0 - Didn't receive and not waiting for mouse up, 1 - Awaiting mouse up, 2 - Received mouse up
+
 		static LRESULT translateNonClientAreaType(NonClientAreaBorderType type);
 		static LRESULT translateNonClientAreaType(NonClientAreaBorderType type);
 	};
 	};
 }
 }

+ 16 - 0
CamelotCore/Source/CmPlatformWndProc.cpp

@@ -1,9 +1,12 @@
 #include "CmPlatformWndProc.h"
 #include "CmPlatformWndProc.h"
 #include "CmRenderWindow.h"
 #include "CmRenderWindow.h"
 #include "CmApplication.h"
 #include "CmApplication.h"
+#include "CmInput.h"
 
 
 namespace CamelotFramework
 namespace CamelotFramework
 {
 {
+	UINT32 PlatformWndProc::mMoveResizeMouseUpState = 0;
+
 	LRESULT CALLBACK PlatformWndProc::_win32WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 	LRESULT CALLBACK PlatformWndProc::_win32WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 	{
 	{
 		if (uMsg == WM_CREATE)
 		if (uMsg == WM_CREATE)
@@ -65,8 +68,14 @@ namespace CamelotFramework
 				return 0;
 				return 0;
 			break;
 			break;
 		case WM_ENTERSIZEMOVE:
 		case WM_ENTERSIZEMOVE:
+			mMoveResizeMouseUpState = 1;
 			break;
 			break;
 		case WM_EXITSIZEMOVE:
 		case WM_EXITSIZEMOVE:
+			// HACK - Windows doesn't send mouseUp event after move/resize if the cursor moved out of the original window bounds
+			if(mMoveResizeMouseUpState != 2)
+				gInput().instance().simulateButtonUp(BC_MOUSE_LEFT);
+
+			mMoveResizeMouseUpState = 0;
 			break;
 			break;
 		case WM_MOVE:
 		case WM_MOVE:
 			windowMovedOrResized(win);
 			windowMovedOrResized(win);
@@ -190,6 +199,13 @@ namespace CamelotFramework
 				}
 				}
 			}
 			}
 			break;
 			break;
+		case WM_NCLBUTTONUP:
+		case WM_LBUTTONUP:
+			// Part of a hack that's done in WM_EXITSIZEMOVE (see there)
+			if(mMoveResizeMouseUpState = 1)
+				mMoveResizeMouseUpState = 2;
+
+			break;
 		case WM_NCMOUSEMOVE:
 		case WM_NCMOUSEMOVE:
 		case WM_MOUSEMOVE:
 		case WM_MOUSEMOVE:
 			{
 			{

+ 0 - 3
EditorWindowDock.txt

@@ -15,9 +15,6 @@ Possible solution to MouseUp problem:
   on WM_ENTERSIZEMOVE call OIS and SetCooperativeLevel(BACKGROUND)
   on WM_ENTERSIZEMOVE call OIS and SetCooperativeLevel(BACKGROUND)
   and on WM_EXITSIZEMOVE revert back to FOREGROUND coop level
   and on WM_EXITSIZEMOVE revert back to FOREGROUND coop level
 
 
-And for MouseMove problem:
-  Track mouse leave events, add a handler to Platform and hook up GUIManager to it
-
 ------------------------
 ------------------------
 
 
 Other things to remember:
 Other things to remember: