ext-idle-notify: move to new impl
This commit is contained in:
parent
86133983a9
commit
f2b03e9679
13 changed files with 186 additions and 82 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue