Ticket #5893: mythtv-fixes-5893--throttle_screensaver_deactivate.patch

File mythtv-fixes-5893--throttle_screensaver_deactivate.patch, 1.4 KB (added by sphery <mtdean@…>, 11 years ago)

Patch for -fixes

  • libs/libmyth/screensaver-x11.cpp

    old new  
    11#define QT_CLEAN_NAMESPACE // no qt 1.x compatability, INT32 conflicts with X
    22#include "screensaver-x11.h"
     3#include <qdatetime.h>
    34#include <qtimer.h>
    45
    56#include <X11/Xlib.h>
    class ScreenSaverX11Private 
    135136
    136137    void ResetScreenSaver()
    137138    {
    138         if (m_xscreensaverRunning)
    139             myth_system("xscreensaver-command -deactivate >&- 2>&- &");
    140         else
    141             myth_system("gnome-screensaver-command --poke >&- 2>&- &");
     139        if (IsScreenSaverRunning())
     140        {
     141            QDateTime current_time = QDateTime::currentDateTime ();
     142            if ((!m_last_deactivated.isValid()) ||
     143                (m_last_deactivated.secsTo(current_time) > 30))
     144            {
     145                if (m_xscreensaverRunning)
     146                    myth_system("xscreensaver-command -deactivate >&- 2>&- &");
     147                else if (m_gscreensaverRunning)
     148                    myth_system("gnome-screensaver-command --poke >&- 2>&- &");
     149                m_last_deactivated = current_time;
     150            }
     151        }
    142152    }
    143153
    144154  private:
    class ScreenSaverX11Private 
    162172    int m_timeoutInterval;
    163173    QTimer *m_resetTimer;
    164174
     175    QDateTime m_last_deactivated;
     176
    165177    ScreenSaverState m_state;
    166178};
    167179