summaryrefslogtreecommitdiff
path: root/src/managers/InputManager.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-03-18 22:53:27 +0100
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-03-18 22:53:27 +0100
commit5811d968bffee6fbc68c198fb92e6700547a72b0 (patch)
tree3a262be3065465c3090f184527182ad2f8717fc5 /src/managers/InputManager.cpp
parenta1a8f3b6d579d5df3a46dff92a221b7ad48f3e84 (diff)
focus and move mouse to inputmanager
Diffstat (limited to 'src/managers/InputManager.cpp')
-rw-r--r--src/managers/InputManager.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/managers/InputManager.cpp b/src/managers/InputManager.cpp
index db5e049a..5fb67b0a 100644
--- a/src/managers/InputManager.cpp
+++ b/src/managers/InputManager.cpp
@@ -19,7 +19,8 @@ void CInputManager::onMouseMoved(wlr_event_pointer_motion* e) {
if (e->time_msec)
wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sWLRSeat);
- // todo: focus
+
+ g_pCompositor->focusWindow(g_pCompositor->vectorToWindow(getMouseCoordsInternal()));
// todo: pointer
}
@@ -74,6 +75,20 @@ void CInputManager::newKeyboard(wlr_input_device* keyboard) {
wlr_seat_set_keyboard(g_pCompositor->m_sWLRSeat, keyboard);
}
+void CInputManager::newMouse(wlr_input_device* mouse) {
+ if (wlr_input_device_is_libinput(mouse)) {
+ const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(mouse);
+
+ if (libinput_device_config_tap_get_finger_count(LIBINPUTDEV)) // this is for tapping (like on a laptop)
+ libinput_device_config_tap_set_enabled(LIBINPUTDEV, LIBINPUT_CONFIG_TAP_ENABLED);
+
+ if (libinput_device_config_scroll_has_natural_scroll(LIBINPUTDEV))
+ libinput_device_config_scroll_set_natural_scroll_enabled(LIBINPUTDEV, 0 /* Natural */);
+ }
+
+ wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, mouse);
+}
+
void CInputManager::onKeyboardKey(wlr_event_keyboard_key* event) {
}