From d5ebbcb4e5beba57ccac1da693908d903efb9acd Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 2 Jul 2019 09:43:26 -0400 Subject: [PATCH] dbus: Don't SimulateUserActivity if we're already inhibiting the screensaver. --- src/core/linux/SDL_dbus.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/linux/SDL_dbus.c b/src/core/linux/SDL_dbus.c index c2ba582b0..40b3bd307 100644 --- a/src/core/linux/SDL_dbus.c +++ b/src/core/linux/SDL_dbus.c @@ -310,9 +310,11 @@ SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface void SDL_DBus_ScreensaverTickle(void) { - /* org.gnome.ScreenSaver is the legacy interface, but it'll either do nothing or just be a second harmless tickle on newer systems, so we leave it for now. */ - SDL_DBus_CallVoidMethod("org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID); - SDL_DBus_CallVoidMethod("org.freedesktop.ScreenSaver", "/org/freedesktop/ScreenSaver", "org.freedesktop.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID); + if (screensaver_cookie == 0) { /* no need to tickle if we're inhibiting. */ + /* org.gnome.ScreenSaver is the legacy interface, but it'll either do nothing or just be a second harmless tickle on newer systems, so we leave it for now. */ + SDL_DBus_CallVoidMethod("org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID); + SDL_DBus_CallVoidMethod("org.freedesktop.ScreenSaver", "/org/freedesktop/ScreenSaver", "org.freedesktop.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID); + } } SDL_bool