Ticket #3652: screensaver-x11.cpp+h.diff

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

gnome screensaver support patch (separate slots, just for sure?)

  • mythtv/libs/libmyth/screensaver-x11.h

    old new  
    2121
    2222  public slots:
    2323    void resetSlot();
     24    void resetSlotG();
    2425
    2526  protected:
    2627    class ScreenSaverX11Private *d;
  • mythtv/libs/libmyth/screensaver-x11.cpp

    old new  
    2121        int preferblank;
    2222        int allowexposure;
    2323        bool xscreensaverRunning;
     24        bool gscreensaverRunning;
    2425        BOOL dpmsaware;
    2526        BOOL dpmsenabled;
    2627        bool dpmsdeactivated;
     
    3839    d = new ScreenSaverX11Private();
    3940    d->state.xscreensaverRunning =
    4041                  (myth_system("xscreensaver-command -version >&- 2>&-") == 0);
     42    d->state.gscreensaverRunning =
     43              (myth_system("gnome-screensaver-command --help >&- 2>&-") == 0);
    4144    if (d->state.xscreensaverRunning)
    4245    {
    4346        d->resetTimer = new QTimer(this);
     
    4649        d->timeoutInterval = -1;
    4750        VERBOSE(VB_GENERAL, "XScreenSaver support enabled");
    4851    }
     52    else if (d->state.gscreensaverRunning)
     53    {
     54        d->resetTimer = new QTimer(this);
     55        connect(d->resetTimer, SIGNAL(timeout()), this, SLOT(resetSlotG()));
     56
     57        d->timeoutInterval = -1;
     58        VERBOSE(VB_GENERAL, "Gnome ScreenSaver support enabled");
     59    }
    4960
    5061    int dummy;
    5162    if ((d->state.dpmsaware = DPMSQueryExtension(qt_xdisplay(),&dummy,&dummy)))
     
    104115        VERBOSE(VB_GENERAL, "DPMS Deactivated ");
    105116    }
    106117
    107     if (d->state.xscreensaverRunning)
     118    if (d->state.xscreensaverRunning || d->state.gscreensaverRunning)
    108119    {
    109120        if (d->resetTimer)
    110121            d->resetTimer->stop();
     
    114125            d->timeoutInterval =
    115126                gContext->GetNumSettingOnHost("xscreensaverInterval",
    116127                                          gContext->GetHostName(),
    117                                           60) * 1000;
     128                                          50) * 1000;
    118129        }
    119130        if (d->timeoutInterval > 0)
    120131        {
     
    139150        VERBOSE(VB_GENERAL, "DPMS Reactivated.");
    140151    }
    141152
    142     if (d->state.xscreensaverRunning && d->resetTimer)
     153    if ((d->state.xscreensaverRunning || d->state.gscreensaverRunning)
     154        && d->resetTimer)
    143155        d->resetTimer->stop();
    144156}
    145157
     
    148160    XResetScreenSaver(qt_xdisplay());
    149161    if (d->state.xscreensaverRunning)
    150162        resetSlot();
     163    else if (d->state.gscreensaverRunning)
     164        resetSlotG();
    151165
    152166    if (Asleep())
    153167    {
     
    178192{
    179193    myth_system(QString("xscreensaver-command -deactivate >&- 2>&- &"));
    180194}
     195
     196void ScreenSaverX11::resetSlotG()
     197{
     198    myth_system(QString("gnome-screensaver-command --poke >&- 2>&- &"));
     199}