aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-11-06 11:34:55 +0100
committerSimon Ser <contact@emersion.fr>2020-11-19 22:47:49 +0100
commit0e76f92de7f5ee53a3d35ad3128b5224b9a305aa (patch)
tree88cca37d3cd6064481dd0dbb88c80d11ad29c66d
parentcd95d70df094e59b625073688e5fd3e783183424 (diff)
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.
-rw-r--r--backend/drm/backend.c4
-rw-r--r--backend/libinput/backend.c4
-rw-r--r--backend/session/direct-freebsd.c4
-rw-r--r--backend/session/direct.c4
-rw-r--r--backend/session/libseat.c4
-rw-r--r--backend/session/logind.c8
-rw-r--r--backend/session/session.c2
-rw-r--r--include/wlr/backend/session.h2
8 files changed, 16 insertions, 16 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c
index 3b7ed93c..b2da7cb3 100644
--- a/backend/drm/backend.c
+++ b/backend/drm/backend.c
@@ -85,7 +85,7 @@ bool wlr_backend_is_drm(struct wlr_backend *b) {
static void session_signal(struct wl_listener *listener, void *data) {
struct wlr_drm_backend *drm =
wl_container_of(listener, drm, session_signal);
- struct wlr_session *session = data;
+ struct wlr_session *session = drm->session;
if (session->active) {
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;
- wl_signal_add(&session->session_signal, &drm->session_signal);
+ wl_signal_add(&session->events.active, &drm->session_signal);
if (!check_drm_features(drm)) {
goto error_event;
diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c
index 7037084d..e31ecf06 100644
--- a/backend/libinput/backend.c
+++ b/backend/libinput/backend.c
@@ -175,7 +175,7 @@ bool wlr_backend_is_libinput(struct wlr_backend *b) {
static void session_signal(struct wl_listener *listener, void *data) {
struct wlr_libinput_backend *backend =
wl_container_of(listener, backend, session_signal);
- struct wlr_session *session = data;
+ struct wlr_session *session = backend->session;
if (!backend->libinput_context) {
return;
@@ -219,7 +219,7 @@ struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display,
backend->display = display;
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;
wl_signal_add(&session->events.destroy, &backend->session_destroy);
diff --git a/backend/session/direct-freebsd.c b/backend/session/direct-freebsd.c
index e4b6c792..302b0ff4 100644
--- a/backend/session/direct-freebsd.c
+++ b/backend/session/direct-freebsd.c
@@ -115,7 +115,7 @@ static int vt_handler(int signo, void *data) {
if (session->base.active) {
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) {
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;
- wlr_signal_emit_safe(&session->base.session_signal, session);
+ wlr_signal_emit_safe(&session->base.events.active, NULL);
}
return 1;
diff --git a/backend/session/direct.c b/backend/session/direct.c
index f9041070..b6d9f06a 100644
--- a/backend/session/direct.c
+++ b/backend/session/direct.c
@@ -126,7 +126,7 @@ static int vt_handler(int signo, void *data) {
if (session->base.active) {
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;
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;
- wlr_signal_emit_safe(&session->base.session_signal, session);
+ wlr_signal_emit_safe(&session->base.events.active, NULL);
}
return 1;
diff --git a/backend/session/libseat.c b/backend/session/libseat.c
index 751adcd3..180ce215 100644
--- a/backend/session/libseat.c
+++ b/backend/session/libseat.c
@@ -35,13 +35,13 @@ struct libseat_session {
static void handle_enable_seat(struct libseat *seat, void *data) {
struct libseat_session *session = data;
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) {
struct libseat_session *session = data;
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);
}
diff --git a/backend/session/logind.c b/backend/session/logind.c
index 30519a78..8859f1a2 100644
--- a/backend/session/logind.c
+++ b/backend/session/logind.c
@@ -306,7 +306,7 @@ static int pause_device(sd_bus_message *msg, void *userdata,
if (major == DRM_MAJOR && strcmp(type, "gone") != 0) {
assert(session->has_drm);
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) {
@@ -348,7 +348,7 @@ static int resume_device(sd_bus_message *msg, void *userdata,
if (!session->base.active) {
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) {
session->base.active = active;
- wlr_signal_emit_safe(&session->base.session_signal, session);
+ wlr_signal_emit_safe(&session->base.events.active, NULL);
}
return 0;
} else {
@@ -447,7 +447,7 @@ static int session_properties_changed(sd_bus_message *msg, void *userdata,
if (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;
}
diff --git a/backend/session/session.c b/backend/session/session.c
index c7808212..a25e78f2 100644
--- a/backend/session/session.c
+++ b/backend/session/session.c
@@ -101,7 +101,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
}
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.destroy);
wl_list_init(&session->devices);
diff --git a/include/wlr/backend/session.h b/include/wlr/backend/session.h
index 692d7be1..06c23d73 100644
--- a/include/wlr/backend/session.h
+++ b/include/wlr/backend/session.h
@@ -24,7 +24,6 @@ struct wlr_session {
* Signal for when the session becomes active/inactive.
* It's called when we swap virtual terminal.
*/
- struct wl_signal session_signal;
bool active;
/*
@@ -44,6 +43,7 @@ struct wlr_session {
struct wl_listener display_destroy;
struct {
+ struct wl_signal active;
struct wl_signal add_drm_card; // struct wlr_session_add_event
struct wl_signal destroy;
} events;