xrandr: set stage to black before dpms off

redraws aren't processed when dpms has been turned
off, so we need to set the stage to black before
the screen goes dark, so that when it comes back
it's not showing stale contents.
This commit is contained in:
Ray Strode 2015-10-17 15:01:17 -04:00
parent 87b11cc409
commit 711dd04444

View File

@ -43,6 +43,8 @@
#include <meta/errors.h> #include <meta/errors.h>
#include "meta-monitor-config.h" #include "meta-monitor-config.h"
#include "meta-stage.h"
#define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1) #define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)
/* Look for DPI_FALLBACK in: /* Look for DPI_FALLBACK in:
@ -646,6 +648,23 @@ get_xmode_name (XRRModeInfo *xmode)
return g_strdup_printf ("%dx%d", width, height); return g_strdup_printf ("%dx%d", width, height);
} }
static void
update_stage_visibility_for_power_save_mode (MetaMonitorManager *manager)
{
MetaBackend *backend = meta_get_backend ();
ClutterActor *stage = meta_backend_get_stage (backend);
if ((manager->power_save_mode != META_POWER_SAVE_ON) &&
(manager->power_save_mode != META_POWER_SAVE_UNSUPPORTED))
{
meta_stage_set_black (META_STAGE (stage), TRUE);
}
else
{
meta_stage_set_black (META_STAGE (stage), FALSE);
}
}
static void static void
meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager) meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
{ {
@ -693,6 +712,8 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
manager->power_save_mode = META_POWER_SAVE_UNSUPPORTED; manager->power_save_mode = META_POWER_SAVE_UNSUPPORTED;
} }
update_stage_visibility_for_power_save_mode (manager);
XRRGetScreenSizeRange (manager_xrandr->xdisplay, DefaultRootWindow (manager_xrandr->xdisplay), XRRGetScreenSizeRange (manager_xrandr->xdisplay, DefaultRootWindow (manager_xrandr->xdisplay),
&min_width, &min_width,
&min_height, &min_height,