mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
backend/session: replace session_signal with events.active
This is more idiomatic wlroots API. The new name makes it clear that the signal is emitted when wlr_session.active changes.
This commit is contained in:
parent
cd95d70df0
commit
0e76f92de7
8 changed files with 16 additions and 16 deletions
|
@ -85,7 +85,7 @@ bool wlr_backend_is_drm(struct wlr_backend *b) {
|
||||||
static void session_signal(struct wl_listener *listener, void *data) {
|
static void session_signal(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_drm_backend *drm =
|
struct wlr_drm_backend *drm =
|
||||||
wl_container_of(listener, drm, session_signal);
|
wl_container_of(listener, drm, session_signal);
|
||||||
struct wlr_session *session = data;
|
struct wlr_session *session = drm->session;
|
||||||
|
|
||||||
if (session->active) {
|
if (session->active) {
|
||||||
wlr_log(WLR_INFO, "DRM fd resumed");
|
wlr_log(WLR_INFO, "DRM fd resumed");
|
||||||
|
@ -170,7 +170,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
|
||||||
}
|
}
|
||||||
|
|
||||||
drm->session_signal.notify = session_signal;
|
drm->session_signal.notify = session_signal;
|
||||||
wl_signal_add(&session->session_signal, &drm->session_signal);
|
wl_signal_add(&session->events.active, &drm->session_signal);
|
||||||
|
|
||||||
if (!check_drm_features(drm)) {
|
if (!check_drm_features(drm)) {
|
||||||
goto error_event;
|
goto error_event;
|
||||||
|
|
|
@ -175,7 +175,7 @@ bool wlr_backend_is_libinput(struct wlr_backend *b) {
|
||||||
static void session_signal(struct wl_listener *listener, void *data) {
|
static void session_signal(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_libinput_backend *backend =
|
struct wlr_libinput_backend *backend =
|
||||||
wl_container_of(listener, backend, session_signal);
|
wl_container_of(listener, backend, session_signal);
|
||||||
struct wlr_session *session = data;
|
struct wlr_session *session = backend->session;
|
||||||
|
|
||||||
if (!backend->libinput_context) {
|
if (!backend->libinput_context) {
|
||||||
return;
|
return;
|
||||||
|
@ -219,7 +219,7 @@ struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display,
|
||||||
backend->display = display;
|
backend->display = display;
|
||||||
|
|
||||||
backend->session_signal.notify = session_signal;
|
backend->session_signal.notify = session_signal;
|
||||||
wl_signal_add(&session->session_signal, &backend->session_signal);
|
wl_signal_add(&session->events.active, &backend->session_signal);
|
||||||
|
|
||||||
backend->session_destroy.notify = handle_session_destroy;
|
backend->session_destroy.notify = handle_session_destroy;
|
||||||
wl_signal_add(&session->events.destroy, &backend->session_destroy);
|
wl_signal_add(&session->events.destroy, &backend->session_destroy);
|
||||||
|
|
|
@ -115,7 +115,7 @@ static int vt_handler(int signo, void *data) {
|
||||||
|
|
||||||
if (session->base.active) {
|
if (session->base.active) {
|
||||||
session->base.active = false;
|
session->base.active = false;
|
||||||
wlr_signal_emit_safe(&session->base.session_signal, session);
|
wlr_signal_emit_safe(&session->base.events.active, NULL);
|
||||||
|
|
||||||
wl_list_for_each(dev, &session->base.devices, link) {
|
wl_list_for_each(dev, &session->base.devices, link) {
|
||||||
if (ioctl(dev->fd, DRM_IOCTL_VERSION, &dv) == 0) {
|
if (ioctl(dev->fd, DRM_IOCTL_VERSION, &dv) == 0) {
|
||||||
|
@ -134,7 +134,7 @@ static int vt_handler(int signo, void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
session->base.active = true;
|
session->base.active = true;
|
||||||
wlr_signal_emit_safe(&session->base.session_signal, session);
|
wlr_signal_emit_safe(&session->base.events.active, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -126,7 +126,7 @@ static int vt_handler(int signo, void *data) {
|
||||||
|
|
||||||
if (session->base.active) {
|
if (session->base.active) {
|
||||||
session->base.active = false;
|
session->base.active = false;
|
||||||
wlr_signal_emit_safe(&session->base.session_signal, session);
|
wlr_signal_emit_safe(&session->base.events.active, NULL);
|
||||||
|
|
||||||
struct wlr_device *dev;
|
struct wlr_device *dev;
|
||||||
wl_list_for_each(dev, &session->base.devices, link) {
|
wl_list_for_each(dev, &session->base.devices, link) {
|
||||||
|
@ -149,7 +149,7 @@ static int vt_handler(int signo, void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
session->base.active = true;
|
session->base.active = true;
|
||||||
wlr_signal_emit_safe(&session->base.session_signal, session);
|
wlr_signal_emit_safe(&session->base.events.active, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -35,13 +35,13 @@ struct libseat_session {
|
||||||
static void handle_enable_seat(struct libseat *seat, void *data) {
|
static void handle_enable_seat(struct libseat *seat, void *data) {
|
||||||
struct libseat_session *session = data;
|
struct libseat_session *session = data;
|
||||||
session->base.active = true;
|
session->base.active = true;
|
||||||
wlr_signal_emit_safe(&session->base.session_signal, session);
|
wlr_signal_emit_safe(&session->base.events.active, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_disable_seat(struct libseat *seat, void *data) {
|
static void handle_disable_seat(struct libseat *seat, void *data) {
|
||||||
struct libseat_session *session = data;
|
struct libseat_session *session = data;
|
||||||
session->base.active = false;
|
session->base.active = false;
|
||||||
wlr_signal_emit_safe(&session->base.session_signal, session);
|
wlr_signal_emit_safe(&session->base.events.active, NULL);
|
||||||
libseat_disable_seat(session->seat);
|
libseat_disable_seat(session->seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -306,7 +306,7 @@ static int pause_device(sd_bus_message *msg, void *userdata,
|
||||||
if (major == DRM_MAJOR && strcmp(type, "gone") != 0) {
|
if (major == DRM_MAJOR && strcmp(type, "gone") != 0) {
|
||||||
assert(session->has_drm);
|
assert(session->has_drm);
|
||||||
session->base.active = false;
|
session->base.active = false;
|
||||||
wlr_signal_emit_safe(&session->base.session_signal, session);
|
wlr_signal_emit_safe(&session->base.events.active, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(type, "pause") == 0) {
|
if (strcmp(type, "pause") == 0) {
|
||||||
|
@ -348,7 +348,7 @@ static int resume_device(sd_bus_message *msg, void *userdata,
|
||||||
|
|
||||||
if (!session->base.active) {
|
if (!session->base.active) {
|
||||||
session->base.active = true;
|
session->base.active = true;
|
||||||
wlr_signal_emit_safe(&session->base.session_signal, session);
|
wlr_signal_emit_safe(&session->base.events.active, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ static int session_properties_changed(sd_bus_message *msg, void *userdata,
|
||||||
|
|
||||||
if (session->base.active != active) {
|
if (session->base.active != active) {
|
||||||
session->base.active = active;
|
session->base.active = active;
|
||||||
wlr_signal_emit_safe(&session->base.session_signal, session);
|
wlr_signal_emit_safe(&session->base.events.active, NULL);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -447,7 +447,7 @@ static int session_properties_changed(sd_bus_message *msg, void *userdata,
|
||||||
|
|
||||||
if (session->base.active != active) {
|
if (session->base.active != active) {
|
||||||
session->base.active = active;
|
session->base.active = active;
|
||||||
wlr_signal_emit_safe(&session->base.session_signal, session);
|
wlr_signal_emit_safe(&session->base.events.active, NULL);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void session_init(struct wlr_session *session) {
|
void session_init(struct wlr_session *session) {
|
||||||
wl_signal_init(&session->session_signal);
|
wl_signal_init(&session->events.active);
|
||||||
wl_signal_init(&session->events.add_drm_card);
|
wl_signal_init(&session->events.add_drm_card);
|
||||||
wl_signal_init(&session->events.destroy);
|
wl_signal_init(&session->events.destroy);
|
||||||
wl_list_init(&session->devices);
|
wl_list_init(&session->devices);
|
||||||
|
|
|
@ -24,7 +24,6 @@ struct wlr_session {
|
||||||
* Signal for when the session becomes active/inactive.
|
* Signal for when the session becomes active/inactive.
|
||||||
* It's called when we swap virtual terminal.
|
* It's called when we swap virtual terminal.
|
||||||
*/
|
*/
|
||||||
struct wl_signal session_signal;
|
|
||||||
bool active;
|
bool active;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -44,6 +43,7 @@ struct wlr_session {
|
||||||
struct wl_listener display_destroy;
|
struct wl_listener display_destroy;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
struct wl_signal active;
|
||||||
struct wl_signal add_drm_card; // struct wlr_session_add_event
|
struct wl_signal add_drm_card; // struct wlr_session_add_event
|
||||||
struct wl_signal destroy;
|
struct wl_signal destroy;
|
||||||
} events;
|
} events;
|
||||||
|
|
Loading…
Reference in a new issue