dbus: Don't SimulateUserActivity if we're already inhibiting the screensaver.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 02 Jul 2019 09:43:26 -0400
changeset 129215959fcbe6dfe
parent 12920 3505a39d5aa6
child 12922 db02dca46a9e
dbus: Don't SimulateUserActivity if we're already inhibiting the screensaver.
src/core/linux/SDL_dbus.c
     1.1 --- a/src/core/linux/SDL_dbus.c	Tue Jul 02 09:38:31 2019 -0400
     1.2 +++ b/src/core/linux/SDL_dbus.c	Tue Jul 02 09:43:26 2019 -0400
     1.3 @@ -310,9 +310,11 @@
     1.4  void
     1.5  SDL_DBus_ScreensaverTickle(void)
     1.6  {
     1.7 -    /* 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. */
     1.8 -    SDL_DBus_CallVoidMethod("org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID);
     1.9 -    SDL_DBus_CallVoidMethod("org.freedesktop.ScreenSaver", "/org/freedesktop/ScreenSaver", "org.freedesktop.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID);
    1.10 +    if (screensaver_cookie == 0) {  /* no need to tickle if we're inhibiting. */
    1.11 +        /* 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. */
    1.12 +        SDL_DBus_CallVoidMethod("org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID);
    1.13 +        SDL_DBus_CallVoidMethod("org.freedesktop.ScreenSaver", "/org/freedesktop/ScreenSaver", "org.freedesktop.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID);
    1.14 +    }
    1.15  }
    1.16  
    1.17  SDL_bool