mirror of
https://github.com/mpv-player/mpv
synced 2025-03-11 08:37:59 +00:00
x11: never enable DPMS if we didn't disable it
Enabling DPMS even though you disabled it globally is pretty unfriendly, so don't do it. Instead, we only disable DPMS if it was enabled, and only enable it if we disabled it ourselves. The other way should never happen (disabling DPMS permanently), unless mpv crashes during playback.
This commit is contained in:
parent
42a51310c1
commit
d9bd5bacc1
@ -1562,12 +1562,15 @@ static void set_screensaver(struct vo_x11_state *x11, bool enabled)
|
||||
BOOL onoff = 0;
|
||||
CARD16 state;
|
||||
DPMSInfo(mDisplay, &state, &onoff);
|
||||
if (!x11->dpms_touched && enabled)
|
||||
return; // enable DPMS only we we disabled it before
|
||||
if (enabled != !!onoff) {
|
||||
MP_VERBOSE(x11, "Setting DMPS: %s.\n", enabled ? "on" : "off");
|
||||
if (enabled) {
|
||||
DPMSEnable(mDisplay);
|
||||
} else {
|
||||
DPMSDisable(mDisplay);
|
||||
x11->dpms_touched = true;
|
||||
}
|
||||
DPMSInfo(mDisplay, &state, &onoff);
|
||||
if (enabled != !!onoff)
|
||||
|
@ -41,6 +41,7 @@ struct vo_x11_state {
|
||||
struct mp_rect screenrc;
|
||||
|
||||
bool screensaver_enabled;
|
||||
bool dpms_touched;
|
||||
double screensaver_time_last;
|
||||
|
||||
XIM xim;
|
||||
|
Loading…
Reference in New Issue
Block a user