[mythtv] [PATCH] mythmusic visualizations disable xscreensaver/dpms

Robert Tsai rtsai1111 at comcast.net
Sun May 1 19:13:42 UTC 2005


The attached patch causes all non-"Blank" visualizations to disable
the X screensaver/DPMS (using the gContext
DoDisableScreensaver/DoRestoreScreensaver methods) while the
visualizations are playing. This prevents the X screensaver from
kicking on while the visualizations are being enjoyed :).

--Rob
-------------- next part --------------
Index: mythmusic/mythmusic/mainvisual.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythplugins/mythmusic/mythmusic/mainvisual.cpp,v
retrieving revision 1.31
diff -u -r1.31 mainvisual.cpp
--- mythmusic/mythmusic/mainvisual.cpp	5 Feb 2005 08:10:38 -0000	1.31
+++ mythmusic/mythmusic/mainvisual.cpp	1 May 2005 19:10:04 -0000
@@ -59,7 +59,15 @@
     }
 }
 
+VisualBase::VisualBase(bool screensaverenable)
+    : xscreensaverenable(screensaverenable)
+{
+    if (!gContext->GetScreensaverEnabled())
+        return;
 
+    if (!xscreensaverenable)
+        gContext->DoDisableScreensaver();
+}
 
 MainVisual::MainVisual(QWidget *parent, const char *name)
     : QWidget( parent, name ), vis( 0 ), playing( FALSE ), fps( 20 )
@@ -834,6 +842,6 @@
     //	that derived classes
     //	can destruct properly
     //
+    if (!xscreensaverenable)
+        gContext->DoRestoreScreensaver();
 }
-
-
Index: mythmusic/mythmusic/mainvisual.h
===================================================================
RCS file: /var/lib/mythcvs/mythplugins/mythmusic/mythmusic/mainvisual.h,v
retrieving revision 1.16
diff -u -r1.16 mainvisual.h
--- mythmusic/mythmusic/mainvisual.h	9 Apr 2005 18:41:36 -0000	1.16
+++ mythmusic/mythmusic/mainvisual.h	1 May 2005 19:10:04 -0000
@@ -49,7 +49,8 @@
 class VisualBase
 {
   public:
-    virtual ~VisualBase();
+    VisualBase(bool screensaverenable = false);
+    virtual ~VisualBase(void);
 
     // return true if the output should stop
     virtual bool process( VisualNode *node ) = 0;
@@ -59,6 +60,7 @@
 
   protected:
     int fps;
+    bool xscreensaverenable;
 };
 
 // base class to handle things like frame rate...
Index: mythmusic/mythmusic/smartplaylist.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythplugins/mythmusic/mythmusic/smartplaylist.cpp,v
retrieving revision 1.7
diff -u -r1.7 smartplaylist.cpp
--- mythmusic/mythmusic/smartplaylist.cpp	10 Apr 2005 05:17:15 -0000	1.7
+++ mythmusic/mythmusic/smartplaylist.cpp	1 May 2005 19:10:06 -0000
@@ -32,19 +32,19 @@
 
 static SmartPLField SmartPLFields[] = 
 {
-    "",              "",                               ftString,   0,    0,    0,
-    "Artist",        "artist",                         ftString,   0,    0,    0,
-    "Album",         "album",                          ftString,   0,    0,    0,
-    "Title",         "title",                          ftString,   0,    0,    0,
-    "Genre",         "genre",                          ftString,   0,    0,    0,
-    "Year",          "year",                           ftNumeric,  1900, 2099, 2000,
-    "Track No.",     "tracknum",                       ftNumeric,  0,    99,   0,
-    "Rating",        "rating",                         ftNumeric,  0,    10,   0,
-    "Play Count",    "playcount",                      ftNumeric,  0,    9999, 0,
-    "Compilation",   "compilation",                    ftBoolean,  0,    0,    0,
-    "Comp. Artist",  "compilation_artist",             ftString,   0,    0,    0, 
-    "Last Play",     "FROM_DAYS(TO_DAYS(lastplay))",   ftDate,     0,    0,    0,
-    "Date Imported", "FROM_DAYS(TO_DAYS(date_added))", ftDate,     0,    0,    0   
+    { "",              "",                               ftString,   0,    0,    0 },
+    { "Artist",        "artist",                         ftString,   0,    0,    0 },
+    { "Album",         "album",                          ftString,   0,    0,    0 },
+    { "Title",         "title",                          ftString,   0,    0,    0 },
+    { "Genre",         "genre",                          ftString,   0,    0,    0 },
+    { "Year",          "year",                           ftNumeric,  1900, 2099, 2000 },
+    { "Track No.",     "tracknum",                       ftNumeric,  0,    99,   0 },
+    { "Rating",        "rating",                         ftNumeric,  0,    10,   0 },
+    { "Play Count",    "playcount",                      ftNumeric,  0,    9999, 0 },
+    { "Compilation",   "compilation",                    ftBoolean,  0,    0,    0 },
+    { "Comp. Artist",  "compilation_artist",             ftString,   0,    0,    0 },
+    { "Last Play",     "FROM_DAYS(TO_DAYS(lastplay))",   ftDate,     0,    0,    0 },
+    { "Date Imported", "FROM_DAYS(TO_DAYS(date_added))", ftDate,     0,    0,    0 },
 };        
 
 struct SmartPLOperator
@@ -57,14 +57,14 @@
 
 static SmartPLOperator SmartPLOperators[] = 
 {
-    "is equal to",     1,  false, true,
-    "is not equal to", 1,  false, true,
-    "is greater than", 1,  false, false,
-    "is less than",    1,  false, false,     
-    "starts with",     1,  true,  false,
-    "ends with",       1,  true,  false,
-    "contains",        1,  true,  false,
-    "is between",      2,  false, false,
+    { "is equal to",     1,  false, true },
+    { "is not equal to", 1,  false, true },
+    { "is greater than", 1,  false, false },
+    { "is less than",    1,  false, false },
+    { "starts with",     1,  true,  false },
+    { "ends with",       1,  true,  false },
+    { "contains",        1,  true,  false },
+    { "is between",      2,  false, false },
 };
 
 static int SmartPLOperatorsCount = sizeof(SmartPLOperators) / sizeof(SmartPLOperators[0]);
Index: mythmusic/mythmusic/visualize.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythplugins/mythmusic/mythmusic/visualize.cpp,v
retrieving revision 1.12
diff -u -r1.12 visualize.cpp
--- mythmusic/mythmusic/visualize.cpp	13 Feb 2004 06:02:56 -0000	1.12
+++ mythmusic/mythmusic/visualize.cpp	1 May 2005 19:10:07 -0000
@@ -349,6 +349,7 @@
 
 
 Blank::Blank()
+    : VisualBase(true)
 {
     fps = 20;
 }


More information about the mythtv-dev mailing list