~kennylevinsen/public-inbox

seatd: libseat/backend/logind: stop waiting for CanGraphical v1 APPLIED

Simon Ser: 1
 libseat/backend/logind: stop waiting for CanGraphical

 1 files changed, 6 insertions(+), 26 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~kennylevinsen/public-inbox/patches/15471/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH seatd] libseat/backend/logind: stop waiting for CanGraphical Export this patch

Upstream says compositors should wait for DRM nodes using udev instead.
---
 libseat/backend/logind.c | 32 ++++++--------------------------
 1 file changed, 6 insertions(+), 26 deletions(-)

diff --git a/libseat/backend/logind.c b/libseat/backend/logind.c
index 76297ce397d4..996697d460c6 100644
--- a/libseat/backend/logind.c
+++ b/libseat/backend/logind.c
@@ -39,7 +39,6 @@ struct backend_logind {
	char *path;
	char *seat_path;

	bool can_graphical;
	bool active;
	bool initial_setup;
	int has_drm;
@@ -384,8 +383,7 @@ static int properties_changed(sd_bus_message *msg, void *userdata, sd_bus_error
			goto error;
		}

		if ((is_session && strcmp(s, "Active") == 0) ||
		    (is_seat && strcmp(s, "CanGraphical"))) {
		if (is_session && strcmp(s, "Active") == 0) {
			int ret;
			ret = sd_bus_message_enter_container(msg, 'v', "b");
			if (ret < 0) {
@@ -399,11 +397,7 @@ static int properties_changed(sd_bus_message *msg, void *userdata, sd_bus_error
			}

			log_debugf("%s state changed: %d", s, value);
			if (is_session) {
				set_active(session, value);
			} else {
				session->can_graphical = value;
			}
			set_active(session, value);
			return 0;
		} else {
			sd_bus_message_skip(msg, "{sv}");
@@ -427,12 +421,10 @@ static int properties_changed(sd_bus_message *msg, void *userdata, sd_bus_error
	// PropertiesChanged arg 3: changed properties without values
	sd_bus_message_enter_container(msg, 'a', "s");
	while ((ret = sd_bus_message_read_basic(msg, 's', &s)) > 0) {
		if ((is_session && strcmp(s, "Active") == 0) ||
		    (is_seat && strcmp(s, "CanGraphical"))) {
		if (is_session && strcmp(s, "Active") == 0) {
			sd_bus_error error = SD_BUS_ERROR_NULL;
			const char *obj = is_session ? "org.freedesktop.login1.Session"
						     : "org.freedesktop.login1.Seat";
			const char *field = is_session ? "Active" : "CanGraphical";
			const char *obj = "org.freedesktop.login1.Session";
			const char *field = "Active";
			bool value;
			ret = sd_bus_get_property_trivial(session->bus, "org.freedesktop.login1",
							  session->path, obj, field, &error, 'b',
@@ -443,11 +435,7 @@ static int properties_changed(sd_bus_message *msg, void *userdata, sd_bus_error
			}

			log_debugf("%s state changed: %d", field, value);
			if (is_session) {
				set_active(session, value);
			} else {
				session->can_graphical = value;
			}
			set_active(session, value);
			return 0;
		}
	}
@@ -650,14 +638,6 @@ static struct libseat *logind_open_seat(struct libseat_seat_listener *listener,
		goto error;
	}

	backend->can_graphical = sd_seat_can_graphical(backend->seat);
	while (!backend->can_graphical) {
		if (poll_connection(backend, -1) == -1) {
			log_errorf("Could not poll connection: %s", strerror(errno));
			goto error;
		}
	}

	const char *env = getenv("XDG_SESSION_TYPE");
	if (env != NULL) {
		set_type(backend, env);
-- 
2.29.2
Applied, thanks!