support more wlr_cursor events

This commit is contained in:
Vaxry 2022-09-22 21:14:02 +01:00
parent 37f2e1ddbe
commit e5d143b238
5 changed files with 31 additions and 1 deletions

View file

@ -198,6 +198,9 @@ void CCompositor::initAllSignals() {
addWLSignal(&m_sWLRCursor->events.touch_down, &Events::listen_touchBegin, m_sWLRCursor, "WLRCursor");
addWLSignal(&m_sWLRCursor->events.touch_up, &Events::listen_touchEnd, m_sWLRCursor, "WLRCursor");
addWLSignal(&m_sWLRCursor->events.touch_motion, &Events::listen_touchUpdate, m_sWLRCursor, "WLRCursor");
addWLSignal(&m_sWLRCursor->events.touch_frame, &Events::listen_touchFrame, m_sWLRCursor, "WLRCursor");
addWLSignal(&m_sWLRCursor->events.hold_begin, &Events::listen_holdBegin, m_sWLRCursor, "WLRCursor");
addWLSignal(&m_sWLRCursor->events.hold_end, &Events::listen_holdEnd, m_sWLRCursor, "WLRCursor");
addWLSignal(&m_sWLRBackend->events.new_input, &Events::listen_newInput, m_sWLRBackend, "Backend");
addWLSignal(&m_sSeat.seat->events.request_set_cursor, &Events::listen_requestMouse, &m_sSeat, "Seat");
addWLSignal(&m_sSeat.seat->events.request_set_selection, &Events::listen_requestSetSel, &m_sSeat, "Seat");

View file

@ -207,3 +207,15 @@ void Events::listener_touchEnd(wl_listener* listener, void* data) {
void Events::listener_touchUpdate(wl_listener* listener, void* data) {
g_pInputManager->onTouchMove((wlr_touch_motion_event*)data);
}
void Events::listener_touchFrame(wl_listener* listener, void* data) {
wlr_seat_touch_notify_frame(g_pCompositor->m_sSeat.seat);
}
void Events::listener_holdBegin(wl_listener* listener, void* data) {
g_pInputManager->onPointerHoldBegin((wlr_pointer_hold_begin_event*)data);
}
void Events::listener_holdEnd(wl_listener* listener, void* data) {
g_pInputManager->onPointerHoldEnd((wlr_pointer_hold_end_event*)data);
}

View file

@ -152,4 +152,8 @@ namespace Events {
LISTENER(touchBegin);
LISTENER(touchEnd);
LISTENER(touchUpdate);
LISTENER(touchFrame);
LISTENER(holdBegin);
LISTENER(holdEnd);
};

View file

@ -63,6 +63,9 @@ public:
void onTouchUp(wlr_touch_up_event*);
void onTouchMove(wlr_touch_motion_event*);
void onPointerHoldBegin(wlr_pointer_hold_begin_event*);
void onPointerHoldEnd(wlr_pointer_hold_end_event*);
STouchData m_sTouchData;
// for dragging floating windows

View file

@ -41,3 +41,11 @@ void CInputManager::onTouchMove(wlr_touch_motion_event* e){
wlr_seat_touch_notify_motion(g_pCompositor->m_sSeat.seat, e->time_msec, e->touch_id, local.x, local.y);
}
}
void CInputManager::onPointerHoldBegin(wlr_pointer_hold_begin_event* e) {
wlr_pointer_gestures_v1_send_hold_begin(g_pCompositor->m_sWLRPointerGestures, g_pCompositor->m_sSeat.seat, e->time_msec, e->fingers);
}
void CInputManager::onPointerHoldEnd(wlr_pointer_hold_end_event* e) {
wlr_pointer_gestures_v1_send_hold_end(g_pCompositor->m_sWLRPointerGestures, g_pCompositor->m_sSeat.seat, e->time_msec, e->cancelled);
}