monitor-manager/xrandr: Trap DPMS changes

Apparently DPMSForceLevel() can fail to force a valid level sometimes.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2857
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6883
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3160>
This commit is contained in:
Jonas Ådahl 2023-08-07 22:42:18 +02:00 committed by Marge Bot
parent 4075847278
commit 4749c073eb

View File

@ -58,7 +58,7 @@
#include "backends/x11/meta-output-xrandr.h"
#include "clutter/clutter.h"
#include "meta/main.h"
#include "meta/meta-x11-errors.h"
#include "mtk/mtk-x11.h"
/* Look for DPI_FALLBACK in:
* http://git.gnome.org/browse/gnome-settings-daemon/tree/plugins/xsettings/gsd-xsettings-manager.c
@ -185,8 +185,10 @@ meta_monitor_manager_xrandr_set_power_save_mode (MetaMonitorManager *manager,
return;
}
mtk_x11_error_trap_push (manager_xrandr->xdisplay);
DPMSForceLevel (manager_xrandr->xdisplay, state);
DPMSSetTimeouts (manager_xrandr->xdisplay, 0, 0, 0);
mtk_x11_error_trap_pop (manager_xrandr->xdisplay);
}
static xcb_randr_rotation_t