libseat/backend/logind: stop waiting for CanGraphical

Upstream says compositors should wait for DRM nodes using udev instead.
This commit is contained in:
Simon Ser 2020-12-04 19:01:56 +00:00 committed by Kenny Levinsen
parent 1dbf100205
commit e3a357bade

View file

@ -39,7 +39,6 @@ struct backend_logind {
char *path; char *path;
char *seat_path; char *seat_path;
bool can_graphical;
bool active; bool active;
bool initial_setup; bool initial_setup;
int has_drm; int has_drm;
@ -384,8 +383,7 @@ static int properties_changed(sd_bus_message *msg, void *userdata, sd_bus_error
goto error; goto error;
} }
if ((is_session && strcmp(s, "Active") == 0) || if (is_session && strcmp(s, "Active") == 0) {
(is_seat && strcmp(s, "CanGraphical"))) {
int ret; int ret;
ret = sd_bus_message_enter_container(msg, 'v', "b"); ret = sd_bus_message_enter_container(msg, 'v', "b");
if (ret < 0) { 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); log_debugf("%s state changed: %d", s, value);
if (is_session) { set_active(session, value);
set_active(session, value);
} else {
session->can_graphical = value;
}
return 0; return 0;
} else { } else {
sd_bus_message_skip(msg, "{sv}"); 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 // PropertiesChanged arg 3: changed properties without values
sd_bus_message_enter_container(msg, 'a', "s"); sd_bus_message_enter_container(msg, 'a', "s");
while ((ret = sd_bus_message_read_basic(msg, 's', &s)) > 0) { while ((ret = sd_bus_message_read_basic(msg, 's', &s)) > 0) {
if ((is_session && strcmp(s, "Active") == 0) || if (is_session && strcmp(s, "Active") == 0) {
(is_seat && strcmp(s, "CanGraphical"))) {
sd_bus_error error = SD_BUS_ERROR_NULL; sd_bus_error error = SD_BUS_ERROR_NULL;
const char *obj = is_session ? "org.freedesktop.login1.Session" const char *obj = "org.freedesktop.login1.Session";
: "org.freedesktop.login1.Seat"; const char *field = "Active";
const char *field = is_session ? "Active" : "CanGraphical";
bool value; bool value;
ret = sd_bus_get_property_trivial(session->bus, "org.freedesktop.login1", ret = sd_bus_get_property_trivial(session->bus, "org.freedesktop.login1",
session->path, obj, field, &error, 'b', 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); log_debugf("%s state changed: %d", field, value);
if (is_session) { set_active(session, value);
set_active(session, value);
} else {
session->can_graphical = value;
}
return 0; return 0;
} }
} }
@ -650,14 +638,6 @@ static struct libseat *logind_open_seat(struct libseat_seat_listener *listener,
goto error; 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"); const char *env = getenv("XDG_SESSION_TYPE");
if (env != NULL) { if (env != NULL) {
set_type(backend, env); set_type(backend, env);