xserver: Branch 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jun 12 22:48:05 UTC 2023
hw/xfree86/os-support/linux/systemd-logind.c | 28 +++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
New commits:
commit 2260dea7d81591305efb5b807ce6246aebee1027
Author: Aaron Dill <aaronsacks2006 at gmail.com>
Date: Mon Jun 12 22:48:03 2023 +0000
logind: call SetType on the logind session
This allows manual handling of IdleAction and IdleHint rather than automatically
calling the IdleAction every IdleSecs, due to inactivity on the underlying tty.
Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1194
Signed-off-by: aarondill <aaronsacks2006 at gmail.com>
Reviewed-by: Hans de Goede <hdegoede at redhat.com>
diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c
index d97e92ff8..16a9df675 100644
--- a/hw/xfree86/os-support/linux/systemd-logind.c
+++ b/hw/xfree86/os-support/linux/systemd-logind.c
@@ -444,6 +444,7 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data)
static void
connect_hook(DBusConnection *connection, void *data)
{
+ const char *session_type = "x11";
struct systemd_logind_info *info = data;
DBusError error;
DBusMessage *msg = NULL;
@@ -510,6 +511,33 @@ connect_hook(DBusConnection *connection, void *data)
error.message);
goto cleanup;
}
+ dbus_message_unref(msg);
+ dbus_message_unref(reply);
+ reply = NULL;
+
+ msg = dbus_message_new_method_call("org.freedesktop.login1",
+ session, "org.freedesktop.login1.Session", "SetType");
+ if (!msg) {
+ LogMessage(X_ERROR, "systemd-logind: out of memory\n");
+ goto cleanup;
+ }
+
+ if (!dbus_message_append_args(msg, DBUS_TYPE_STRING, &session_type,
+ DBUS_TYPE_INVALID)) {
+ LogMessage(X_ERROR, "systemd-logind: out of memory\n");
+ goto cleanup;
+ }
+
+ reply = dbus_connection_send_with_reply_and_block(connection, msg,
+ DBUS_TIMEOUT_USE_DEFAULT, &error);
+ /* Requires systemd >= 246, SetType() is not critical for xserver function */
+ if (!reply) {
+ /* unprevileged users get access denied rather than unknown method */
+ if (!dbus_error_has_name(&error, DBUS_ERROR_ACCESS_DENIED) &&
+ !dbus_error_has_name(&error, DBUS_ERROR_UNKNOWN_METHOD))
+ LogMessage(X_WARNING, "systemd-logind: SetType failed: %s\n", error.message);
+ dbus_error_free(&error);
+ }
dbus_bus_add_match(connection,
"type='signal',sender='org.freedesktop.login1',interface='org.freedesktop.login1.Session',member='PauseDevice'",
More information about the xorg-commit
mailing list