Added Amun fix for window freeze on drag
This commit is contained in:
@@ -37,7 +37,8 @@ m_dwFaceCount(0),
|
||||
m_fGlobalTime(0.0f),
|
||||
m_fGlobalElapsedTime(0.0f),
|
||||
m_dwLButtonDownTime(0),
|
||||
m_dwLastIdleTime(0)
|
||||
m_dwLastIdleTime(0),
|
||||
m_IsMovingMainWindow(false)
|
||||
{
|
||||
#ifndef _DEBUG
|
||||
SetEterExceptionHandler();
|
||||
@@ -90,6 +91,8 @@ m_dwLastIdleTime(0)
|
||||
m_iForceSightRange = -1;
|
||||
|
||||
CCameraManager::Instance().AddCamera(EVENT_CAMERA_NUMBER);
|
||||
|
||||
m_InitialMouseMovingPoint = {};
|
||||
}
|
||||
|
||||
CPythonApplication::~CPythonApplication()
|
||||
@@ -821,10 +824,42 @@ bool CPythonApplication::CreateDevice(int width, int height, int Windowed, int b
|
||||
}
|
||||
}
|
||||
|
||||
void CPythonApplication::SetUserMovingMainWindow(bool flag)
|
||||
{
|
||||
if (flag && !GetCursorPos(&m_InitialMouseMovingPoint))
|
||||
return;
|
||||
|
||||
m_IsMovingMainWindow = flag;
|
||||
}
|
||||
|
||||
bool CPythonApplication::IsUserMovingMainWindow() const
|
||||
{
|
||||
return m_IsMovingMainWindow;
|
||||
}
|
||||
|
||||
void CPythonApplication::UpdateMainWindowPosition()
|
||||
{
|
||||
POINT finalPoint{};
|
||||
if (GetCursorPos(&finalPoint))
|
||||
{
|
||||
LONG xDiff = finalPoint.x - m_InitialMouseMovingPoint.x;
|
||||
LONG yDiff = finalPoint.y - m_InitialMouseMovingPoint.y;
|
||||
|
||||
RECT r{};
|
||||
GetWindowRect(&r);
|
||||
|
||||
SetPosition(r.left + xDiff, r.top + yDiff);
|
||||
m_InitialMouseMovingPoint = finalPoint;
|
||||
}
|
||||
}
|
||||
|
||||
void CPythonApplication::Loop()
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
if (IsUserMovingMainWindow())
|
||||
UpdateMainWindowPosition();
|
||||
|
||||
if (IsMessage())
|
||||
{
|
||||
if (!MessageProcess())
|
||||
|
||||
@@ -151,6 +151,10 @@ class CPythonApplication : public CMSApplication, public CInputKeyboard, public
|
||||
void Exit();
|
||||
void Abort();
|
||||
|
||||
bool IsUserMovingMainWindow() const;
|
||||
void SetUserMovingMainWindow(bool flag);
|
||||
void UpdateMainWindowPosition();
|
||||
|
||||
void SetMinFog(float fMinFog);
|
||||
void SetFrameSkip(bool isEnable);
|
||||
void SkipRenderBuffering(DWORD dwSleepMSec);
|
||||
@@ -437,6 +441,8 @@ class CPythonApplication : public CMSApplication, public CInputKeyboard, public
|
||||
int m_iForceSightRange;
|
||||
|
||||
protected:
|
||||
bool m_IsMovingMainWindow;
|
||||
POINT m_InitialMouseMovingPoint;
|
||||
int m_iCursorNum;
|
||||
int m_iContinuousCursorNum;
|
||||
};
|
||||
|
||||
@@ -79,6 +79,11 @@ LRESULT CPythonApplication::WindowProcedure(HWND hWnd, UINT uiMsg, WPARAM wParam
|
||||
{
|
||||
__MinimizeFullScreenWindow(hWnd, m_dwWidth, m_dwHeight);
|
||||
}
|
||||
|
||||
if (IsUserMovingMainWindow())
|
||||
{
|
||||
SetUserMovingMainWindow(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -112,6 +117,8 @@ LRESULT CPythonApplication::WindowProcedure(HWND hWnd, UINT uiMsg, WPARAM wParam
|
||||
break;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
if (wParam == VK_ESCAPE && IsUserMovingMainWindow())
|
||||
SetUserMovingMainWindow(false);
|
||||
OnIMEKeyDown(LOWORD(wParam));
|
||||
break;
|
||||
|
||||
@@ -135,6 +142,9 @@ LRESULT CPythonApplication::WindowProcedure(HWND hWnd, UINT uiMsg, WPARAM wParam
|
||||
|
||||
s_xDownPosition = LOWORD(lParam);
|
||||
s_yDownPosition = HIWORD(lParam);
|
||||
|
||||
if (IsUserMovingMainWindow())
|
||||
SetUserMovingMainWindow(false);
|
||||
return 0;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
@@ -225,7 +235,45 @@ LRESULT CPythonApplication::WindowProcedure(HWND hWnd, UINT uiMsg, WPARAM wParam
|
||||
OnSizeChange(short(LOWORD(lParam)), short(HIWORD(lParam)));
|
||||
}
|
||||
break;
|
||||
case WM_NCLBUTTONDOWN:
|
||||
{
|
||||
switch (wParam)
|
||||
{
|
||||
case HTMAXBUTTON:
|
||||
case HTSYSMENU:
|
||||
return 0;
|
||||
case HTMINBUTTON:
|
||||
ShowWindow(hWnd, SW_MINIMIZE);
|
||||
return 0;
|
||||
case HTCLOSE:
|
||||
RunPressExitKey();
|
||||
return 0;
|
||||
case HTCAPTION:
|
||||
if (!IsUserMovingMainWindow())
|
||||
SetUserMovingMainWindow(true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_NCLBUTTONUP:
|
||||
{
|
||||
if (IsUserMovingMainWindow())
|
||||
SetUserMovingMainWindow(false);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_NCRBUTTONDOWN:
|
||||
case WM_NCRBUTTONUP:
|
||||
case WM_CONTEXTMENU:
|
||||
return 0;
|
||||
case WM_SYSCOMMAND:
|
||||
if (wParam == SC_KEYMENU)
|
||||
return 0;
|
||||
break;
|
||||
case WM_SYSKEYDOWN:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user