diff options
| author | Ikalco <73481042+ikalco@users.noreply.github.com> | 2024-09-14 17:37:18 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-14 23:37:18 +0100 |
| commit | e74efd87e5aa38f9cf84cb3848ee1ab26e5e4bcb (patch) | |
| tree | 3bcccd577801e01e385410de74be40341a832e2e /src/managers/PointerManager.cpp | |
| parent | 4dbdb556fe441506ec5cf129c65b14e514dbcc5a (diff) | |
internal: fix initial cursor warping (#7793)
Diffstat (limited to 'src/managers/PointerManager.cpp')
| -rw-r--r-- | src/managers/PointerManager.cpp | 40 |
1 files changed, 1 insertions, 39 deletions
diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp index 6b2a40f5..5a192e13 100644 --- a/src/managers/PointerManager.cpp +++ b/src/managers/PointerManager.cpp @@ -18,13 +18,7 @@ CPointerManager::CPointerManager() { onMonitorLayoutChange(); PMONITOR->events.modeChanged.registerStaticListener( - [this, PMONITOR](void* owner, std::any data) { - g_pEventLoopManager->doLater([this, PMONITOR]() { - onMonitorLayoutChange(); - checkDefaultCursorWarp(PMONITOR, PMONITOR->output->name); - }); - }, - nullptr); + [this, PMONITOR](void* owner, std::any data) { g_pEventLoopManager->doLater([this, PMONITOR]() { onMonitorLayoutChange(); }); }, nullptr); PMONITOR->events.disconnect.registerStaticListener( [this, PMONITOR](void* owner, std::any data) { g_pEventLoopManager->doLater([this, PMONITOR]() { onMonitorLayoutChange(); }); }, nullptr); PMONITOR->events.destroy.registerStaticListener( @@ -44,38 +38,6 @@ CPointerManager::CPointerManager() { }); } -void CPointerManager::checkDefaultCursorWarp(SP<CMonitor> monitor, std::string monitorName) { - static auto PCURSORMONITOR = CConfigValue<std::string>("cursor:default_monitor"); - static bool cursorDefaultDone = false; - static bool firstLaunch = true; - - const auto POS = monitor->middle(); - - // by default, cursor should be set to first monitor detected - // this is needed as a default if the monitor given in config above doesn't exist - if (firstLaunch) { - firstLaunch = false; - g_pCompositor->warpCursorTo(POS, true); - g_pInputManager->refocus(); - return; - } - - if (!cursorDefaultDone && *PCURSORMONITOR != STRVAL_EMPTY) { - if (*PCURSORMONITOR == monitorName) { - cursorDefaultDone = true; - g_pCompositor->warpCursorTo(POS, true); - g_pInputManager->refocus(); - return; - } - } - - // modechange happend check if cursor is on that monitor and warp it to middle to not place it out of bounds if resolution changed. - if (g_pCompositor->getMonitorFromCursor() == monitor.get()) { - g_pCompositor->warpCursorTo(POS, true); - g_pInputManager->refocus(); - } -} - void CPointerManager::lockSoftwareAll() { for (auto const& state : monitorStates) state->softwareLocks++; |
