From 4749c073ebef7160af94b9a622090ec922d26aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 7 Aug 2023 22:42:18 +0200 Subject: [PATCH] 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: --- src/backends/x11/meta-monitor-manager-xrandr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c index c50006200..128a34b9f 100644 --- a/src/backends/x11/meta-monitor-manager-xrandr.c +++ b/src/backends/x11/meta-monitor-manager-xrandr.c @@ -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