1
0
mirror of synced 2025-04-18 23:24:01 +03:00

Limit mouse movements outside of the screen

This commit is contained in:
nzeemin 2025-01-11 16:18:38 +03:00
parent 619a884ca3
commit 1e592718af
2 changed files with 9 additions and 9 deletions

View File

@ -660,14 +660,14 @@ void ScreenView_UpdateMouse()
RECT rcScreen = { m_xScreenOffset, m_yScreenOffset, m_xScreenOffset + m_cxScreenWidth, m_yScreenOffset + m_cyScreenHeight };
::MapWindowPoints(g_hwndScreen, NULL, (LPPOINT)&rcScreen, 2);
if (mousepos.x < rcScreen.left)
dx -= rcScreen.left - mousepos.x;
if (mousepos.x > rcScreen.right)
dx += mousepos.x - rcScreen.right;
if (mousepos.y < rcScreen.top)
dy -= rcScreen.top - mousepos.y;
if (mousepos.y > rcScreen.bottom)
dy += mousepos.y - rcScreen.bottom;
if (dx != 0 && mousepos.x < rcScreen.left)
dx -= (rcScreen.left - mousepos.x) / 2;
if (dx != 0 && mousepos.x > rcScreen.right)
dx += (mousepos.x - rcScreen.right) / 2;
if (dy != 0 && mousepos.y < rcScreen.top)
dy -= (rcScreen.top - mousepos.y) / 2;
if (dy != 0 && mousepos.y > rcScreen.bottom)
dy += (mousepos.y - rcScreen.bottom) / 2;
if (m_cxScreenWidth != UKNC_SCREEN_WIDTH)
dx = dx * UKNC_SCREEN_WIDTH / m_cxScreenWidth;

View File

@ -202,7 +202,7 @@ BEGIN
LTEXT "UKNCBTL version 1.0.???",IDC_VERSION,10,10,139,8,SS_NOPREFIX
LTEXT "Build date: ????",IDC_BUILDDATE,10,20,139,8
CONTROL "<a>https://github.com/nzeemin/ukncbtl</a>",IDC_SYSLINK1,"SysLink",WS_TABSTOP,10,32,193,19
LTEXT "Copyright (C) 2007-2024",IDC_STATIC,10,44,139,8
LTEXT "Copyright (C) 2007-2025",IDC_STATIC,10,44,139,8
LTEXT "Authors:\r\nNikita Zimin\r\nFelix Lazarev\r\nAlexey Kisly",IDC_STATIC,10,60,174,36
LTEXT "Special thanks to:\r\nArseny Gordin",IDC_STATIC,10,98,174,22
CONTROL 140,IDC_STATIC,"Static",SS_BITMAP,10,130,199,105