feat: Add logging in MSWindowsScreen for setup and cursor centering
This commit is contained in:
parent
1fb2789cb1
commit
e184475a24
1 changed files with 9 additions and 7 deletions
|
|
@ -90,6 +90,8 @@ MSWindowsScreen::MSWindowsScreen(
|
||||||
m_hasMouse(GetSystemMetrics(SM_MOUSEPRESENT) != 0),
|
m_hasMouse(GetSystemMetrics(SM_MOUSEPRESENT) != 0),
|
||||||
m_events(events)
|
m_events(events)
|
||||||
{
|
{
|
||||||
|
LOG_DEBUG("settting up %s screen", m_isPrimary ? "primary" : "secondary");
|
||||||
|
|
||||||
assert(s_windowInstance != nullptr);
|
assert(s_windowInstance != nullptr);
|
||||||
assert(s_screen == nullptr);
|
assert(s_screen == nullptr);
|
||||||
|
|
||||||
|
|
@ -173,6 +175,8 @@ MSWindowsScreen::getWindowInstance()
|
||||||
|
|
||||||
void MSWindowsScreen::enable()
|
void MSWindowsScreen::enable()
|
||||||
{
|
{
|
||||||
|
LOG_DEBUG("enabling %s screen", m_isPrimary ? "primary" : "secondary");
|
||||||
|
|
||||||
assert(m_isOnScreen == m_isPrimary);
|
assert(m_isOnScreen == m_isPrimary);
|
||||||
|
|
||||||
// we need to poll some things to fix them
|
// we need to poll some things to fix them
|
||||||
|
|
@ -198,6 +202,8 @@ void MSWindowsScreen::enable()
|
||||||
|
|
||||||
void MSWindowsScreen::disable()
|
void MSWindowsScreen::disable()
|
||||||
{
|
{
|
||||||
|
LOG_DEBUG("disabling %s screen", m_isPrimary ? "primary" : "secondary");
|
||||||
|
|
||||||
// stop tracking the active desk
|
// stop tracking the active desk
|
||||||
m_desks->disable();
|
m_desks->disable();
|
||||||
|
|
||||||
|
|
@ -284,9 +290,7 @@ void MSWindowsScreen::leave()
|
||||||
m_desks->leave(m_keyLayout);
|
m_desks->leave(m_keyLayout);
|
||||||
|
|
||||||
if (m_isPrimary) {
|
if (m_isPrimary) {
|
||||||
|
LOG_DEBUG1("centering cursor on leave: %+d, %+d", m_xCenter, m_yCenter);
|
||||||
// warp to center
|
|
||||||
LOG((CLOG_DEBUG1 "warping cursor to center: %+d, %+d", m_xCenter, m_yCenter));
|
|
||||||
warpCursor(m_xCenter, m_yCenter);
|
warpCursor(m_xCenter, m_yCenter);
|
||||||
|
|
||||||
// disable special key sequences on win95 family
|
// disable special key sequences on win95 family
|
||||||
|
|
@ -1235,7 +1239,7 @@ bool MSWindowsScreen::onMouseMove(int32_t mx, int32_t my)
|
||||||
// center on the server screen. if we don't do this, then the mouse
|
// center on the server screen. if we don't do this, then the mouse
|
||||||
// will always try to return to the original entry point on the
|
// will always try to return to the original entry point on the
|
||||||
// secondary screen.
|
// secondary screen.
|
||||||
LOG((CLOG_DEBUG5 "warping server cursor to center: %+d,%+d", m_xCenter, m_yCenter));
|
LOG((CLOG_DEBUG5 "centering cursor on motion: %+d,%+d", m_xCenter, m_yCenter));
|
||||||
warpCursorNoFlush(m_xCenter, m_yCenter);
|
warpCursorNoFlush(m_xCenter, m_yCenter);
|
||||||
|
|
||||||
// examine the motion. if it's about the distance
|
// examine the motion. if it's about the distance
|
||||||
|
|
@ -1308,10 +1312,8 @@ bool MSWindowsScreen::onDisplayChange()
|
||||||
// do nothing if resolution hasn't changed
|
// do nothing if resolution hasn't changed
|
||||||
if (xOld != m_x || yOld != m_y || wOld != m_w || hOld != m_h) {
|
if (xOld != m_x || yOld != m_y || wOld != m_w || hOld != m_h) {
|
||||||
if (m_isPrimary) {
|
if (m_isPrimary) {
|
||||||
// warp mouse to center if off screen
|
|
||||||
if (!m_isOnScreen) {
|
if (!m_isOnScreen) {
|
||||||
|
LOG_DEBUG1("centering cursor on display change: %+d, %+d", m_xCenter, m_yCenter);
|
||||||
LOG((CLOG_DEBUG1 "warping cursor to center: %+d, %+d", m_xCenter, m_yCenter));
|
|
||||||
warpCursor(m_xCenter, m_yCenter);
|
warpCursor(m_xCenter, m_yCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue