summaryrefslogtreecommitdiff
path: root/src/managers/input
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2024-04-29 17:42:07 +0100
committerVaxry <vaxry@vaxry.net>2024-04-29 17:50:07 +0100
commitf2b03e9679bc1a091fecffd98b50a4179b5c7d43 (patch)
treec86033d3436b0354db17e9209633ac7a6594631f /src/managers/input
parent86133983a94a6ad52933e0577b6098dd8e98ed8c (diff)
ext-idle-notify: move to new impl
Diffstat (limited to 'src/managers/input')
-rw-r--r--src/managers/input/IdleInhibitor.cpp19
-rw-r--r--src/managers/input/InputManager.cpp9
-rw-r--r--src/managers/input/Tablets.cpp9
-rw-r--r--src/managers/input/Touch.cpp3
4 files changed, 22 insertions, 18 deletions
diff --git a/src/managers/input/IdleInhibitor.cpp b/src/managers/input/IdleInhibitor.cpp
index 6ec5fc81..40c8c637 100644
--- a/src/managers/input/IdleInhibitor.cpp
+++ b/src/managers/input/IdleInhibitor.cpp
@@ -1,6 +1,7 @@
#include "InputManager.hpp"
#include "../../Compositor.hpp"
#include "../../protocols/IdleInhibit.hpp"
+#include "../../protocols/IdleNotify.hpp"
void CInputManager::newIdleInhibitor(std::any inhibitor) {
const auto PINHIBIT = m_vIdleInhibitors.emplace_back(std::make_unique<SIdleInhibitor>()).get();
@@ -29,11 +30,11 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) {
void CInputManager::recheckIdleInhibitorStatus() {
for (auto& ii : m_vIdleInhibitors) {
- if (ii->pWindow.expired()) {
- g_pCompositor->setIdleActivityInhibit(false);
- return;
- } else if (g_pHyprRenderer->shouldRenderWindow(ii->pWindow.lock())) {
- g_pCompositor->setIdleActivityInhibit(false);
+ if (ii->pWindow.expired())
+ continue;
+
+ if (g_pHyprRenderer->shouldRenderWindow(ii->pWindow.lock())) {
+ PROTO::idle->setInhibit(true);
return;
}
}
@@ -44,21 +45,21 @@ void CInputManager::recheckIdleInhibitorStatus() {
continue;
if (w->m_eIdleInhibitMode == IDLEINHIBIT_ALWAYS) {
- g_pCompositor->setIdleActivityInhibit(false);
+ PROTO::idle->setInhibit(true);
return;
}
if (w->m_eIdleInhibitMode == IDLEINHIBIT_FOCUS && g_pCompositor->isWindowActive(w)) {
- g_pCompositor->setIdleActivityInhibit(false);
+ PROTO::idle->setInhibit(true);
return;
}
if (w->m_eIdleInhibitMode == IDLEINHIBIT_FULLSCREEN && w->m_bIsFullscreen && g_pCompositor->isWorkspaceVisible(w->m_pWorkspace)) {
- g_pCompositor->setIdleActivityInhibit(false);
+ PROTO::idle->setInhibit(true);
return;
}
}
- g_pCompositor->setIdleActivityInhibit(true);
+ PROTO::idle->setInhibit(false);
return;
}
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index adfa5029..47dc2bf6 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -8,6 +8,7 @@
#include "../../protocols/IdleInhibit.hpp"
#include "../../protocols/RelativePointer.hpp"
#include "../../protocols/PointerConstraints.hpp"
+#include "../../protocols/IdleNotify.hpp"
CInputManager::CInputManager() {
m_sListeners.setCursorShape = PROTO::cursorShape->events.setShape.registerListener([this](std::any data) {
@@ -144,7 +145,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
EMIT_HOOK_EVENT_CANCELLABLE("mouseMove", MOUSECOORDSFLOORED);
if (time)
- g_pCompositor->notifyIdleActivity();
+ PROTO::idle->onActivity();
m_vLastCursorPosFloored = MOUSECOORDSFLOORED;
@@ -480,7 +481,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
void CInputManager::onMouseButton(wlr_pointer_button_event* e) {
EMIT_HOOK_EVENT_CANCELLABLE("mouseButton", e);
- g_pCompositor->notifyIdleActivity();
+ PROTO::idle->onActivity();
m_tmrLastCursorMovement.reset();
@@ -705,7 +706,7 @@ void CInputManager::onMouseWheel(wlr_pointer_axis_event* e) {
bool passEvent = g_pKeybindManager->onAxisEvent(e);
- g_pCompositor->notifyIdleActivity();
+ PROTO::idle->onActivity();
if (!passEvent)
return;
@@ -1216,7 +1217,7 @@ void CInputManager::onKeyboardKey(wlr_keyboard_key_event* e, SKeyboard* pKeyboar
bool passEvent = g_pKeybindManager->onKeyEvent(e, pKeyboard);
- g_pCompositor->notifyIdleActivity();
+ PROTO::idle->onActivity();
if (passEvent) {
diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp
index d60a6a6f..979eb1a7 100644
--- a/src/managers/input/Tablets.cpp
+++ b/src/managers/input/Tablets.cpp
@@ -1,5 +1,6 @@
#include "InputManager.hpp"
#include "../../Compositor.hpp"
+#include "../../protocols/IdleNotify.hpp"
void CInputManager::newTabletTool(wlr_input_device* pDevice) {
const auto PNEWTABLET = &m_lTablets.emplace_back();
@@ -99,7 +100,7 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
if (EVENT->updated_axes & (WLR_TABLET_TOOL_AXIS_TILT_X | WLR_TABLET_TOOL_AXIS_TILT_Y))
wlr_tablet_v2_tablet_tool_notify_tilt(PTOOL->wlrTabletToolV2, PTOOL->tiltX, PTOOL->tiltY);
- g_pCompositor->notifyIdleActivity();
+ PROTO::idle->onActivity();
},
PNEWTABLET, "Tablet");
@@ -120,7 +121,7 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
wlr_send_tablet_v2_tablet_tool_up(PTOOL->wlrTabletToolV2);
}
- g_pCompositor->notifyIdleActivity();
+ PROTO::idle->onActivity();
},
PNEWTABLET, "Tablet");
@@ -132,7 +133,7 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
const auto PTOOL = g_pInputManager->ensureTabletToolPresent(EVENT->tool);
wlr_tablet_v2_tablet_tool_notify_button(PTOOL->wlrTabletToolV2, (zwp_tablet_pad_v2_button_state)EVENT->button, (zwp_tablet_pad_v2_button_state)EVENT->state);
- g_pCompositor->notifyIdleActivity();
+ PROTO::idle->onActivity();
},
PNEWTABLET, "Tablet");
@@ -158,7 +159,7 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
g_pInputManager->focusTablet(PTAB, EVENT->tool);
}
- g_pCompositor->notifyIdleActivity();
+ PROTO::idle->onActivity();
},
PNEWTABLET, "Tablet");
diff --git a/src/managers/input/Touch.cpp b/src/managers/input/Touch.cpp
index 302d9e1d..a3f28ac0 100644
--- a/src/managers/input/Touch.cpp
+++ b/src/managers/input/Touch.cpp
@@ -1,6 +1,7 @@
#include "InputManager.hpp"
#include "../../Compositor.hpp"
#include "../../config/ConfigValue.hpp"
+#include "../../protocols/IdleNotify.hpp"
void CInputManager::onTouchDown(wlr_touch_down_event* e) {
static auto PSWIPETOUCH = CConfigValue<Hyprlang::INT>("gestures:workspace_swipe_touch");
@@ -83,7 +84,7 @@ void CInputManager::onTouchDown(wlr_touch_down_event* e) {
wlr_seat_touch_notify_down(g_pCompositor->m_sSeat.seat, m_sTouchData.touchFocusSurface, e->time_msec, e->touch_id, local.x, local.y);
- g_pCompositor->notifyIdleActivity();
+ PROTO::idle->onActivity();
}
void CInputManager::onTouchUp(wlr_touch_up_event* e) {