wl_backend: fix standalone VT switching and relative pointer motion

- Store wlr_session from wlr_backend_autocreate.
- Skip frame commit when session is inactive (VT switched away).
- Wire ptr->events.motion (relative) for libinput devices so cursor
  moves in standalone DRM/KMS mode.
This commit is contained in:
Levi Neely 2026-05-14 18:49:32 +02:00
parent 62b8e4254e
commit 90cd607b1e
1 changed files with 5 additions and 2 deletions

View File

@ -116,6 +116,7 @@
#include <wayland-server-core.h>
#include <wlr/backend.h>
#include <wlr/backend/headless.h>
#include <wlr/backend/session.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/interfaces/wlr_output.h>
#include <wlr/types/wlr_compositor.h>
@ -386,6 +387,7 @@ struct wl_compositor_state {
int is_nested; /* 1 if using wlr_wl_backend */
struct wlr_backend *headless_inner; /* headless backend (always) */
struct wlr_backend *wl_backend_inner; /* wl backend (nested only) */
struct wlr_session *session; /* DRM session (standalone only) */
struct wlr_allocator *allocator;
struct wlr_scene *scene;
struct wlr_scene_output *scene_output;
@ -1810,10 +1812,10 @@ static void
handle_output_frame(struct wl_listener *listener, void *data)
{
(void)listener; (void)data;
/* Skip rendering while the startup pump thread is running — wlr_scene_output_commit
* involves EGL/DRM operations bound to the main thread's GL context. */
if (wl_state.startup_pump_running)
return;
if (wl_state.session && !wl_state.session->active)
return;
if (!wl_state.scene_output)
return;
if (wl_state.allocator) {
@ -2092,6 +2094,7 @@ wl_display_open(const char *name)
struct wlr_session *session = NULL;
wl_state.backend = wlr_backend_autocreate(
wl_display_get_event_loop(wl_state.display), &session);
wl_state.session = session;
if (!wl_state.backend) {
wwarning("wl_backend: wlr_backend_autocreate failed; falling back to headless");
wl_state.backend = wl_state.headless_inner;