mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-06-13 14:32:57 -04:00
backend/session: decouple udev
This commit is contained in:
parent
68764dc6ac
commit
326bd749ee
5 changed files with 249 additions and 161 deletions
|
|
@ -2,6 +2,31 @@
|
|||
#define BACKEND_SESSION_SESSION_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <xf86drm.h>
|
||||
|
||||
// for some reason libdrm does not define MAX3, but has defs that depend on it
|
||||
#define MAX3(a, b, c) ((a) > (b) && (a) > (c) ? (a) : \
|
||||
(b) > (c) ? (b) : (c))
|
||||
|
||||
struct drm_event_monitor;
|
||||
|
||||
enum drm_event_action {
|
||||
DRM_EVENT_ACTION_NONE,
|
||||
DRM_EVENT_ACTION_ADD,
|
||||
DRM_EVENT_ACTION_CHANGE,
|
||||
DRM_EVENT_ACTION_REMOVE,
|
||||
};
|
||||
|
||||
struct drm_event_content {
|
||||
char devnode[DRM_NODE_NAME_MAX];
|
||||
dev_t devnum;
|
||||
enum drm_event_action type;
|
||||
int16_t conn_id;
|
||||
int16_t prop_id;
|
||||
bool has_lease;
|
||||
};
|
||||
|
||||
struct wl_display;
|
||||
struct wlr_session;
|
||||
|
|
@ -17,4 +42,13 @@ void session_init(struct wlr_session *session);
|
|||
struct wlr_device *session_open_if_kms(struct wlr_session *restrict session,
|
||||
const char *restrict path);
|
||||
|
||||
struct drm_event_monitor *monitor_drm_events(int *fd);
|
||||
void drm_event_monitor_free(struct drm_event_monitor *ctx);
|
||||
|
||||
int receive_drm_device(struct drm_event_monitor *ctx,
|
||||
struct drm_event_content *ev);
|
||||
|
||||
const char *get_device_seat(struct drm_event_monitor *ctx, const char *devnode);
|
||||
bool is_drm_device_primary(struct drm_event_monitor *ctx, const char *devnode);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include <wayland-server-core.h>
|
||||
|
||||
struct libseat;
|
||||
struct drm_event_monitor;
|
||||
|
||||
/**
|
||||
* An opened physical device.
|
||||
|
|
@ -45,9 +46,8 @@ struct wlr_session {
|
|||
|
||||
char seat[256];
|
||||
|
||||
struct udev *udev;
|
||||
struct udev_monitor *mon;
|
||||
struct wl_event_source *udev_event;
|
||||
struct drm_event_monitor *drm_handle;
|
||||
struct wl_event_source *drm_event;
|
||||
|
||||
struct libseat *seat_handle;
|
||||
struct wl_event_source *libseat_event;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue