Ticket #3652: screensaver-x11.cpp.2.diff

File screensaver-x11.cpp.2.diff, 2.0 KB (added by Petr Stehlik <pstehlik@…>, 13 years ago)

updated for current trunk

  • libs/libmyth/screensaver-x11.cpp

     
    2121    {
    2222        m_xscreensaverRunning =
    2323                (myth_system("xscreensaver-command -version >&- 2>&-") == 0);
    24         if (m_xscreensaverRunning)
     24        m_gscreensaverRunning =
     25                (myth_system("gnome-screensaver-command --help >&- 2>&-") == 0);
     26        if (m_xscreensaverRunning || m_gscreensaverRunning)
    2527        {
    2628            m_resetTimer = new QTimer(outer);
    2729            QObject::connect(m_resetTimer, SIGNAL(timeout()),
     
    5860        delete m_resetTimer;
    5961    }
    6062
    61     bool IsScreenSaverRunning() { return m_xscreensaverRunning; }
     63    bool IsScreenSaverRunning() { return m_xscreensaverRunning || m_gscreensaverRunning; }
    6264
    6365    bool IsDPMSEnabled() { return m_dpmsenabled; }
    6466
     
    7779        if (m_timeoutInterval == -1)
    7880        {
    7981            m_timeoutInterval = gContext->GetNumSettingOnHost(
    80                 "xscreensaverInterval", gContext->GetHostName(), 60) * 1000;
     82                "xscreensaverInterval", gContext->GetHostName(), 50) * 1000;
    8183        }
    8284
    8385        if (m_timeoutInterval > 0)
     
    127129        }
    128130    }
    129131
     132    void ResetScreenSaver()
     133    {
     134        if (m_gscreensaverRunning)
     135            myth_system(QString("gnome-screensaver-command --poke >&- 2>&- &"));
     136        else
     137            myth_system(QString("xscreensaver-command -deactivate >&- 2>&- &"));
     138    }
     139
    130140  private:
    131141    struct ScreenSaverState
    132142    {
     
    141151  private:
    142152    bool m_dpmsaware;
    143153    bool m_xscreensaverRunning;
     154    bool m_gscreensaverRunning;
    144155    BOOL m_dpmsenabled;
    145156    bool m_dpmsdeactivated; // true if we disabled DPMS
    146157
     
    222233
    223234void ScreenSaverX11::resetSlot()
    224235{
    225     myth_system(QString("xscreensaver-command -deactivate >&- 2>&- &"));
     236    d->ResetScreenSaver();
    226237}