handle inhibit

This commit is contained in:
vaxerski 2022-03-22 18:29:13 +01:00
parent db4b4ec0d3
commit aa64af95fe
11 changed files with 83 additions and 40 deletions

View file

@ -33,7 +33,7 @@ void Events::listener_keyboardMod(wl_listener* listener, void* data) {
}
void Events::listener_mouseFrame(wl_listener* listener, void* data) {
wlr_seat_pointer_notify_frame(g_pCompositor->m_sWLRSeat);
wlr_seat_pointer_notify_frame(g_pCompositor->m_sSeat.seat);
}
void Events::listener_mouseMove(wl_listener* listener, void* data) {
@ -51,13 +51,13 @@ void Events::listener_mouseButton(wl_listener* listener, void* data) {
void Events::listener_mouseAxis(wl_listener* listener, void* data) {
const auto E = (wlr_event_pointer_axis*)data;
wlr_seat_pointer_notify_axis(g_pCompositor->m_sWLRSeat, 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);
}
void Events::listener_requestMouse(wl_listener* listener, void* data) {
const auto EVENT = (wlr_seat_pointer_request_set_cursor_event*)data;
if (EVENT->seat_client == g_pCompositor->m_sWLRSeat->pointer_state.focused_client)
if (EVENT->seat_client == g_pCompositor->m_sSeat.seat->pointer_state.focused_client)
wlr_cursor_set_surface(g_pCompositor->m_sWLRCursor, EVENT->surface, EVENT->hotspot_x, EVENT->hotspot_y);
}
@ -79,5 +79,5 @@ void Events::listener_newInput(wl_listener* listener, void* data) {
uint32_t capabilities = WL_SEAT_CAPABILITY_POINTER | WL_SEAT_CAPABILITY_KEYBOARD;
wlr_seat_set_capabilities(g_pCompositor->m_sWLRSeat, capabilities);
wlr_seat_set_capabilities(g_pCompositor->m_sSeat.seat, capabilities);
}

View file

@ -85,4 +85,8 @@ namespace Events {
// Drag & Drop
LISTENER(requestDrag);
LISTENER(startDrag);
// Inhibit
LISTENER(InhibitActivate);
LISTENER(InhibitDeactivate);
};

View file

@ -27,12 +27,12 @@ void Events::listener_outputMgrTest(wl_listener* listener, void* data) {
void Events::listener_requestSetPrimarySel(wl_listener* listener, void* data) {
const auto EVENT = (wlr_seat_request_set_primary_selection_event*)data;
wlr_seat_set_primary_selection(g_pCompositor->m_sWLRSeat, EVENT->source, EVENT->serial);
wlr_seat_set_primary_selection(g_pCompositor->m_sSeat.seat, EVENT->source, EVENT->serial);
}
void Events::listener_requestSetSel(wl_listener* listener, void* data) {
const auto EVENT = (wlr_seat_request_set_selection_event*)data;
wlr_seat_set_selection(g_pCompositor->m_sWLRSeat, EVENT->source, EVENT->serial);
wlr_seat_set_selection(g_pCompositor->m_sSeat.seat, EVENT->source, EVENT->serial);
}
void Events::listener_readyXWayland(wl_listener* listener, void* data) {
@ -55,7 +55,7 @@ void Events::listener_readyXWayland(wl_listener* listener, void* data) {
ATOM.second = reply->atom;
}
wlr_xwayland_set_seat(g_pXWaylandManager->m_sWLRXWayland, g_pCompositor->m_sWLRSeat);
wlr_xwayland_set_seat(g_pXWaylandManager->m_sWLRXWayland, g_pCompositor->m_sSeat.seat);
const auto XCURSOR = wlr_xcursor_manager_get_xcursor(g_pCompositor->m_sWLRXCursorMgr, "left_ptr", 1);
if (XCURSOR) {
@ -68,15 +68,28 @@ void Events::listener_readyXWayland(wl_listener* listener, void* data) {
void Events::listener_requestDrag(wl_listener* listener, void* data) {
const auto E = (wlr_seat_request_start_drag_event*)data;
if (!wlr_seat_validate_pointer_grab_serial(g_pCompositor->m_sWLRSeat, E->origin, E->serial)) {
if (!wlr_seat_validate_pointer_grab_serial(g_pCompositor->m_sSeat.seat, E->origin, E->serial)) {
Debug::log(LOG, "Ignoring drag and drop request: serial mismatch.");
wlr_data_source_destroy(E->drag->source);
return;
}
wlr_seat_start_pointer_drag(g_pCompositor->m_sWLRSeat, E->drag, E->serial);
wlr_seat_start_pointer_drag(g_pCompositor->m_sSeat.seat, E->drag, E->serial);
}
void Events::listener_startDrag(wl_listener* listener, void* data) {
// TODO: draw the drag icon
}
void Events::listener_InhibitActivate(wl_listener* listener, void* data) {
g_pCompositor->m_sSeat.exclusiveClient = g_pCompositor->m_sWLRInhibitMgr->active_client;
Debug::log(LOG, "Activated exclusive for %x.", g_pCompositor->m_sSeat.exclusiveClient);
}
void Events::listener_InhibitDeactivate(wl_listener* listener, void* data) {
g_pCompositor->m_sSeat.exclusiveClient = nullptr;
g_pInputManager->refocus();
Debug::log(LOG, "Deactivated exclusive.");
}

View file

@ -39,7 +39,8 @@ void Events::listener_mapWindow(wl_listener* listener, void* data) {
else
g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW);
g_pCompositor->focusWindow(PWINDOW);
if (!PWINDOW->m_bIsModal)
g_pCompositor->focusWindow(PWINDOW);
Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.x, PWINDOW->m_vRealPosition.y, PWINDOW->m_vRealSize.x, PWINDOW->m_vRealSize.y);
}