[vlc-commits] inhibit: add third choice for disable-screensaver

Rémi Denis-Courmont git at videolan.org
Sat Apr 13 18:23:16 CEST 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Apr 13 19:00:16 2019 +0300| [b2d33fc595765abebbd7eadb16b6c4304969fc6e] | committer: Rémi Denis-Courmont

inhibit: add third choice for disable-screensaver

This retains the existing meanings of 0 and 1 for backward
compatibility with existing vlcrc files. 2 is added for fullscreen-only
inhibit (refs #8912).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b2d33fc595765abebbd7eadb16b6c4304969fc6e
---

 src/libvlc-module.c       | 9 +++++++--
 src/video_output/window.c | 2 +-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index b6c119668e..958fb4014c 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -374,6 +374,11 @@ static const char *const ppsz_pos_descriptions[] =
 #define SS_TEXT N_("Disable screensaver")
 #define SS_LONGTEXT N_("Disable the screensaver during video playback." )
 
+static const int screensaver_values[] = { 0, 2, 1, };
+static const char *const screensaver_texts[] = {
+    N_("Never"), N_("When fullscreen"), N_("Always"),
+};
+
 #define VIDEO_DECO_TEXT N_("Window decorations")
 #define VIDEO_DECO_LONGTEXT N_( \
     "VLC can avoid creating window caption, frames, etc... around the video" \
@@ -1623,8 +1628,8 @@ vlc_module_begin ()
               VIDEO_ON_TOP_LONGTEXT, false )
     add_bool( "video-wallpaper", false, WALLPAPER_TEXT,
               WALLPAPER_LONGTEXT, false )
-    add_bool( "disable-screensaver", true, SS_TEXT, SS_LONGTEXT,
-              true )
+    add_integer("disable-screensaver", 1, SS_TEXT, SS_LONGTEXT, true)
+        change_integer_list(screensaver_values, screensaver_texts)
 
     add_bool( "video-title-show", 1, VIDEO_TITLE_SHOW_TEXT,
               VIDEO_TITLE_SHOW_LONGTEXT, false )
diff --git a/src/video_output/window.c b/src/video_output/window.c
index 80b1f6c6c7..4aba087abc 100644
--- a/src/video_output/window.c
+++ b/src/video_output/window.c
@@ -79,7 +79,7 @@ vout_window_t *vout_window_New(vlc_object_t *obj, const char *module,
     }
 
     /* Hook for screensaver inhibition */
-    if (var_InheritBool(obj, "disable-screensaver"))
+    if (var_InheritInteger(obj, "disable-screensaver"))
         w->inhibit = vlc_inhibit_Create(VLC_OBJECT(window));
     else
         w->inhibit = NULL;



More information about the vlc-commits mailing list