Ticket #3652: screensaver-x11.cpp.diff

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

gnome screensaver support patch (simpler)

  • 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);
    41     if (d->state.xscreensaverRunning)
     42    d->state.gscreensaverRunning =
     43              (myth_system("gnome-screensaver-command --help >&- 2>&-") == 0);
     44    if (d->state.xscreensaverRunning || d->state.gscreensaverRunning)
    4245    {
    4346        d->resetTimer = new QTimer(this);
    4447        connect(d->resetTimer, SIGNAL(timeout()), this, SLOT(resetSlot()));
     
    104107        VERBOSE(VB_GENERAL, "DPMS Deactivated ");
    105108    }
    106109
    107     if (d->state.xscreensaverRunning)
     110    if (d->state.xscreensaverRunning || d->state.gscreensaverRunning)
    108111    {
    109112        if (d->resetTimer)
    110113            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        {
     
    139142        VERBOSE(VB_GENERAL, "DPMS Reactivated.");
    140143    }
    141144
    142     if (d->state.xscreensaverRunning && d->resetTimer)
     145    if ((d->state.xscreensaverRunning || d->state.gscreensaverRunning)
     146        && d->resetTimer)
    143147        d->resetTimer->stop();
    144148}
    145149
    146150void ScreenSaverX11::Reset(void)
    147151{
    148152    XResetScreenSaver(qt_xdisplay());
    149     if (d->state.xscreensaverRunning)
     153    if (d->state.xscreensaverRunning || d->state.gscreensaverRunning)
    150154        resetSlot();
    151155
    152156    if (Asleep())
     
    176180
    177181void ScreenSaverX11::resetSlot()
    178182{
    179     myth_system(QString("xscreensaver-command -deactivate >&- 2>&- &"));
     183    if (d->state.gscreensaverRunning)
     184        myth_system(QString("gnome-screensaver-command --poke >&- 2>&- &"));
     185    else
     186        myth_system(QString("xscreensaver-command -deactivate >&- 2>&- &"));
    180187}