forked from metin-server/m2dev-client-src
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_fGlobalTime(0.0f),
|
||||||
m_fGlobalElapsedTime(0.0f),
|
m_fGlobalElapsedTime(0.0f),
|
||||||
m_dwLButtonDownTime(0),
|
m_dwLButtonDownTime(0),
|
||||||
m_dwLastIdleTime(0)
|
m_dwLastIdleTime(0),
|
||||||
|
m_IsMovingMainWindow(false)
|
||||||
{
|
{
|
||||||
#ifndef _DEBUG
|
#ifndef _DEBUG
|
||||||
SetEterExceptionHandler();
|
SetEterExceptionHandler();
|
||||||
@@ -90,6 +91,8 @@ m_dwLastIdleTime(0)
|
|||||||
m_iForceSightRange = -1;
|
m_iForceSightRange = -1;
|
||||||
|
|
||||||
CCameraManager::Instance().AddCamera(EVENT_CAMERA_NUMBER);
|
CCameraManager::Instance().AddCamera(EVENT_CAMERA_NUMBER);
|
||||||
|
|
||||||
|
m_InitialMouseMovingPoint = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
CPythonApplication::~CPythonApplication()
|
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()
|
void CPythonApplication::Loop()
|
||||||
{
|
{
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
if (IsUserMovingMainWindow())
|
||||||
|
UpdateMainWindowPosition();
|
||||||
|
|
||||||
if (IsMessage())
|
if (IsMessage())
|
||||||
{
|
{
|
||||||
if (!MessageProcess())
|
if (!MessageProcess())
|
||||||
|
|||||||
@@ -151,6 +151,10 @@ class CPythonApplication : public CMSApplication, public CInputKeyboard, public
|
|||||||
void Exit();
|
void Exit();
|
||||||
void Abort();
|
void Abort();
|
||||||
|
|
||||||
|
bool IsUserMovingMainWindow() const;
|
||||||
|
void SetUserMovingMainWindow(bool flag);
|
||||||
|
void UpdateMainWindowPosition();
|
||||||
|
|
||||||
void SetMinFog(float fMinFog);
|
void SetMinFog(float fMinFog);
|
||||||
void SetFrameSkip(bool isEnable);
|
void SetFrameSkip(bool isEnable);
|
||||||
void SkipRenderBuffering(DWORD dwSleepMSec);
|
void SkipRenderBuffering(DWORD dwSleepMSec);
|
||||||
@@ -437,6 +441,8 @@ class CPythonApplication : public CMSApplication, public CInputKeyboard, public
|
|||||||
int m_iForceSightRange;
|
int m_iForceSightRange;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool m_IsMovingMainWindow;
|
||||||
|
POINT m_InitialMouseMovingPoint;
|
||||||
int m_iCursorNum;
|
int m_iCursorNum;
|
||||||
int m_iContinuousCursorNum;
|
int m_iContinuousCursorNum;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -79,6 +79,11 @@ LRESULT CPythonApplication::WindowProcedure(HWND hWnd, UINT uiMsg, WPARAM wParam
|
|||||||
{
|
{
|
||||||
__MinimizeFullScreenWindow(hWnd, m_dwWidth, m_dwHeight);
|
__MinimizeFullScreenWindow(hWnd, m_dwWidth, m_dwHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsUserMovingMainWindow())
|
||||||
|
{
|
||||||
|
SetUserMovingMainWindow(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -112,6 +117,8 @@ LRESULT CPythonApplication::WindowProcedure(HWND hWnd, UINT uiMsg, WPARAM wParam
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
|
if (wParam == VK_ESCAPE && IsUserMovingMainWindow())
|
||||||
|
SetUserMovingMainWindow(false);
|
||||||
OnIMEKeyDown(LOWORD(wParam));
|
OnIMEKeyDown(LOWORD(wParam));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -135,6 +142,9 @@ LRESULT CPythonApplication::WindowProcedure(HWND hWnd, UINT uiMsg, WPARAM wParam
|
|||||||
|
|
||||||
s_xDownPosition = LOWORD(lParam);
|
s_xDownPosition = LOWORD(lParam);
|
||||||
s_yDownPosition = HIWORD(lParam);
|
s_yDownPosition = HIWORD(lParam);
|
||||||
|
|
||||||
|
if (IsUserMovingMainWindow())
|
||||||
|
SetUserMovingMainWindow(false);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
@@ -225,7 +235,45 @@ LRESULT CPythonApplication::WindowProcedure(HWND hWnd, UINT uiMsg, WPARAM wParam
|
|||||||
OnSizeChange(short(LOWORD(lParam)), short(HIWORD(lParam)));
|
OnSizeChange(short(LOWORD(lParam)), short(HIWORD(lParam)));
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case WM_SYSKEYDOWN:
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user