update for latest wlroots

This commit is contained in:
vaxerski 2022-03-24 15:57:46 +01:00
parent 411a050169
commit 97501fc034
4 changed files with 24 additions and 18 deletions

View file

@ -17,6 +17,12 @@ CCompositor::CCompositor() {
return; return;
} }
const auto DRMFD = wlr_backend_get_drm_fd(m_sWLRBackend);
if (DRMFD < 0) {
Debug::log(CRIT, "Couldn't query the DRM FD!");
return;
}
m_sWLRRenderer = wlr_renderer_autocreate(m_sWLRBackend); m_sWLRRenderer = wlr_renderer_autocreate(m_sWLRBackend);
if (!m_sWLRRenderer) { if (!m_sWLRRenderer) {

View file

@ -24,7 +24,7 @@ void Events::listener_keyboardDestroy(wl_listener* listener, void* data) {
void Events::listener_keyboardKey(wl_listener* listener, void* data) { void Events::listener_keyboardKey(wl_listener* listener, void* data) {
SKeyboard* PKEYBOARD = wl_container_of(listener, PKEYBOARD, listen_keyboardKey); SKeyboard* PKEYBOARD = wl_container_of(listener, PKEYBOARD, listen_keyboardKey);
g_pInputManager->onKeyboardKey((wlr_event_keyboard_key*)data, PKEYBOARD); g_pInputManager->onKeyboardKey((wlr_keyboard_key_event*)data, PKEYBOARD);
} }
void Events::listener_keyboardMod(wl_listener* listener, void* data) { void Events::listener_keyboardMod(wl_listener* listener, void* data) {
@ -37,19 +37,19 @@ void Events::listener_mouseFrame(wl_listener* listener, void* data) {
} }
void Events::listener_mouseMove(wl_listener* listener, void* data) { void Events::listener_mouseMove(wl_listener* listener, void* data) {
g_pInputManager->onMouseMoved((wlr_event_pointer_motion*)data); g_pInputManager->onMouseMoved((wlr_pointer_motion_event*)data);
} }
void Events::listener_mouseMoveAbsolute(wl_listener* listener, void* data) { void Events::listener_mouseMoveAbsolute(wl_listener* listener, void* data) {
g_pInputManager->onMouseWarp((wlr_event_pointer_motion_absolute*)data); g_pInputManager->onMouseWarp((wlr_pointer_motion_absolute_event*)data);
} }
void Events::listener_mouseButton(wl_listener* listener, void* data) { void Events::listener_mouseButton(wl_listener* listener, void* data) {
g_pInputManager->onMouseButton((wlr_event_pointer_button*)data); g_pInputManager->onMouseButton((wlr_pointer_button_event*)data);
} }
void Events::listener_mouseAxis(wl_listener* listener, void* data) { void Events::listener_mouseAxis(wl_listener* listener, void* data) {
const auto E = (wlr_event_pointer_axis*)data; const auto E = (wlr_pointer_axis_event*)data;
wlr_seat_pointer_notify_axis(g_pCompositor->m_sSeat.seat, E->time_msec, E->orientation, E->delta, E->delta_discrete, E->source); wlr_seat_pointer_notify_axis(g_pCompositor->m_sSeat.seat, E->time_msec, E->orientation, E->delta, E->delta_discrete, E->source);
} }

View file

@ -1,19 +1,19 @@
#include "InputManager.hpp" #include "InputManager.hpp"
#include "../Compositor.hpp" #include "../Compositor.hpp"
void CInputManager::onMouseMoved(wlr_event_pointer_motion* e) { void CInputManager::onMouseMoved(wlr_pointer_motion_event* e) {
// TODO: sensitivity // TODO: sensitivity
float sensitivity = g_pConfigManager->getFloat("general:sensitivity"); float sensitivity = g_pConfigManager->getFloat("general:sensitivity");
wlr_cursor_move(g_pCompositor->m_sWLRCursor, e->device, e->delta_x * sensitivity, e->delta_y * sensitivity); wlr_cursor_move(g_pCompositor->m_sWLRCursor, &e->pointer->base, e->delta_x * sensitivity, e->delta_y * sensitivity);
mouseMoveUnified(e->time_msec); mouseMoveUnified(e->time_msec);
// todo: pointer // todo: pointer
} }
void CInputManager::onMouseWarp(wlr_event_pointer_motion_absolute* e) { void CInputManager::onMouseWarp(wlr_pointer_motion_absolute_event* e) {
wlr_cursor_warp_absolute(g_pCompositor->m_sWLRCursor, e->device, e->x, e->y); wlr_cursor_warp_absolute(g_pCompositor->m_sWLRCursor, &e->pointer->base, e->x, e->y);
mouseMoveUnified(e->time_msec); mouseMoveUnified(e->time_msec);
} }
@ -84,7 +84,7 @@ void CInputManager::mouseMoveUnified(uint32_t time) {
g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal()); g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal());
} }
void CInputManager::onMouseButton(wlr_event_pointer_button* e) { void CInputManager::onMouseButton(wlr_pointer_button_event* e) {
wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sSeat.seat); wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sSeat.seat);
const auto PKEYBOARD = wlr_seat_get_keyboard(g_pCompositor->m_sSeat.seat); const auto PKEYBOARD = wlr_seat_get_keyboard(g_pCompositor->m_sSeat.seat);
@ -141,7 +141,7 @@ void CInputManager::newKeyboard(wlr_input_device* keyboard) {
wl_signal_add(&keyboard->keyboard->events.key, &PNEWKEYBOARD->listen_keyboardKey); wl_signal_add(&keyboard->keyboard->events.key, &PNEWKEYBOARD->listen_keyboardKey);
wl_signal_add(&keyboard->events.destroy, &PNEWKEYBOARD->listen_keyboardDestroy); wl_signal_add(&keyboard->events.destroy, &PNEWKEYBOARD->listen_keyboardDestroy);
wlr_seat_set_keyboard(g_pCompositor->m_sSeat.seat, keyboard); wlr_seat_set_keyboard(g_pCompositor->m_sSeat.seat, keyboard->keyboard);
Debug::log(LOG, "New keyboard created, pointers Hypr: %x and WLR: %x", PNEWKEYBOARD, keyboard); Debug::log(LOG, "New keyboard created, pointers Hypr: %x and WLR: %x", PNEWKEYBOARD, keyboard);
} }
@ -174,7 +174,7 @@ void CInputManager::destroyMouse(wlr_input_device* mouse) {
// //
} }
void CInputManager::onKeyboardKey(wlr_event_keyboard_key* e, SKeyboard* pKeyboard) { void CInputManager::onKeyboardKey(wlr_keyboard_key_event* e, SKeyboard* pKeyboard) {
const auto KEYCODE = e->keycode + 8; // Because to xkbcommon it's +8 from libinput const auto KEYCODE = e->keycode + 8; // Because to xkbcommon it's +8 from libinput
const xkb_keysym_t* keysyms; const xkb_keysym_t* keysyms;
@ -195,13 +195,13 @@ void CInputManager::onKeyboardKey(wlr_event_keyboard_key* e, SKeyboard* pKeyboar
} }
if (!found) { if (!found) {
wlr_seat_set_keyboard(g_pCompositor->m_sSeat.seat, pKeyboard->keyboard); wlr_seat_set_keyboard(g_pCompositor->m_sSeat.seat, pKeyboard->keyboard->keyboard);
wlr_seat_keyboard_notify_key(g_pCompositor->m_sSeat.seat, e->time_msec, e->keycode, e->state); wlr_seat_keyboard_notify_key(g_pCompositor->m_sSeat.seat, e->time_msec, e->keycode, e->state);
} }
} }
void CInputManager::onKeyboardMod(void* data, SKeyboard* pKeyboard) { void CInputManager::onKeyboardMod(void* data, SKeyboard* pKeyboard) {
wlr_seat_set_keyboard(g_pCompositor->m_sSeat.seat, pKeyboard->keyboard); wlr_seat_set_keyboard(g_pCompositor->m_sSeat.seat, pKeyboard->keyboard->keyboard);
wlr_seat_keyboard_notify_modifiers(g_pCompositor->m_sSeat.seat, &pKeyboard->keyboard->keyboard->modifiers); wlr_seat_keyboard_notify_modifiers(g_pCompositor->m_sSeat.seat, &pKeyboard->keyboard->keyboard->modifiers);
} }

View file

@ -8,10 +8,10 @@
class CInputManager { class CInputManager {
public: public:
void onMouseMoved(wlr_event_pointer_motion*); void onMouseMoved(wlr_pointer_motion_event*);
void onMouseWarp(wlr_event_pointer_motion_absolute*); void onMouseWarp(wlr_pointer_motion_absolute_event*);
void onMouseButton(wlr_event_pointer_button*); void onMouseButton(wlr_pointer_button_event*);
void onKeyboardKey(wlr_event_keyboard_key*, SKeyboard*); void onKeyboardKey(wlr_keyboard_key_event*, SKeyboard*);
void onKeyboardMod(void*, SKeyboard*); void onKeyboardMod(void*, SKeyboard*);
void newKeyboard(wlr_input_device*); void newKeyboard(wlr_input_device*);