Ticket #5893: mythtv-5893-throttle_screensaver_deactivate.patch

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

fixes missing check for active GNOME screensaver and throttles screensaver deactivation

  • libs/libmythui/screensaver-x11.cpp

    old new  
     1#include <QDateTime>
    12#include <QTimer>
    23#include <QX11Info>
    34
     
    141142
    142143    void ResetScreenSaver()
    143144    {
    144         if (m_xscreensaverRunning)
    145             myth_system("xscreensaver-command -deactivate >&- 2>&- &");
    146         else
    147             myth_system("gnome-screensaver-command --poke >&- 2>&- &");
     145        QDateTime current_time = QDateTime::currentDateTime ();
     146        if ((!m_last_deactivated.isValid()) ||
     147            (m_last_deactivated.secsTo(current_time) > 30))
     148        {
     149            if (m_xscreensaverRunning)
     150                myth_system("xscreensaver-command -deactivate >&- 2>&- &");
     151            else if (m_gscreensaverRunning)
     152                myth_system("gnome-screensaver-command --poke >&- 2>&- &");
     153            m_last_deactivated = current_time;
     154        }
    148155    }
    149156
    150157  private:
     
    170177    int m_timeoutInterval;
    171178    QTimer *m_resetTimer;
    172179
     180    QDateTime m_last_deactivated;
     181
    173182    ScreenSaverState m_state;
    174183};
    175184