summaryrefslogtreecommitdiff
path: root/src/managers/input/InputManager.cpp
diff options
context:
space:
mode:
authorriChar <wxsychi@163.com>2023-01-08 23:35:24 +0800
committerGitHub <noreply@github.com>2023-01-08 16:35:24 +0100
commite5dcbf73d881178c7f9c6306d287ed610d6efea1 (patch)
treed157de8ddd40b44a6b42dddd7013a403731fb5ac /src/managers/input/InputManager.cpp
parent50e106f2e60785126331eaf2a9c43595a2a768d4 (diff)
Add "on" and "off" for the bind of switch (#1342)
Diffstat (limited to 'src/managers/input/InputManager.cpp')
-rw-r--r--src/managers/input/InputManager.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index c67bcba3..a5ff20f7 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -1,5 +1,6 @@
#include "InputManager.hpp"
#include "../../Compositor.hpp"
+#include "wlr/types/wlr_switch.h"
void CInputManager::onMouseMoved(wlr_pointer_motion_event* e) {
static auto* const PSENS = &g_pConfigManager->getConfigValuePtr("general:sensitivity")->floatValue;
@@ -1215,6 +1216,18 @@ void CInputManager::newSwitch(wlr_input_device* pDevice) {
Debug::log(LOG, "Switch %s fired, triggering binds.", NAME.c_str());
g_pKeybindManager->onSwitchEvent(NAME);
+
+ const auto event_data = (wlr_switch_toggle_event*)data;
+ switch (event_data->switch_state) {
+ case WLR_SWITCH_STATE_ON:
+ Debug::log(LOG, "Switch %s turn on, triggering binds.", NAME.c_str());
+ g_pKeybindManager->onSwitchOnEvent(NAME);
+ break;
+ case WLR_SWITCH_STATE_OFF:
+ Debug::log(LOG, "Switch %s turn off, triggering binds.", NAME.c_str());
+ g_pKeybindManager->onSwitchOffEvent(NAME);
+ break;
+ }
},
PNEWDEV, "SwitchDevice");
}