mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
Rework session handling
Sessions can now be retrieved from a backend in a more general manner. Multi-backend gets back its `session` field that contains the session if one was created, removing the interfacing from multi backend with the drm backend directly. This adds the possibility to use sessions even without the drm backend. It additionally fixes the bug that 2 session objects got created when WLR_BACKENDS were set to "libinput,drm". To allow vt switching without drm backend (and drm fd) on logind, start listening to PropertiesChanged signals from dbus and parse the session "Active" property when no master fd was created (this does not change current drm backend behaviour in any way).
This commit is contained in:
parent
5b687b4a96
commit
7b52388424
9 changed files with 189 additions and 43 deletions
|
|
@ -1,7 +1,6 @@
|
|||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <wlr/backend/drm.h>
|
||||
#include <wlr/backend/interface.h>
|
||||
#include <wlr/backend/session.h>
|
||||
#include <wlr/util/log.h>
|
||||
|
|
@ -72,10 +71,17 @@ static struct wlr_renderer *multi_backend_get_renderer(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static struct wlr_session *multi_backend_get_session(
|
||||
struct wlr_backend *_backend) {
|
||||
struct wlr_multi_backend *backend = multi_backend_from_backend(_backend);
|
||||
return backend->session;
|
||||
}
|
||||
|
||||
struct wlr_backend_impl backend_impl = {
|
||||
.start = multi_backend_start,
|
||||
.destroy = multi_backend_destroy,
|
||||
.get_renderer = multi_backend_get_renderer,
|
||||
.get_session = multi_backend_get_session,
|
||||
};
|
||||
|
||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||
|
|
@ -191,17 +197,6 @@ void wlr_multi_backend_remove(struct wlr_backend *_multi,
|
|||
}
|
||||
}
|
||||
|
||||
struct wlr_session *wlr_multi_get_session(struct wlr_backend *_backend) {
|
||||
struct wlr_multi_backend *backend = multi_backend_from_backend(_backend);
|
||||
struct subbackend_state *sub;
|
||||
wl_list_for_each(sub, &backend->backends, link) {
|
||||
if (wlr_backend_is_drm(sub->backend)) {
|
||||
return wlr_drm_backend_get_session(sub->backend);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool wlr_multi_is_empty(struct wlr_backend *_backend) {
|
||||
assert(wlr_backend_is_multi(_backend));
|
||||
struct wlr_multi_backend *backend = (struct wlr_multi_backend *)_backend;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue