Compare commits

...

2 Commits

Author SHA1 Message Date
Ray Strode
711dd04444 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.
2015-10-17 15:04:51 -04:00
Ray Strode
87b11cc409 wip! stage: add new api for making the stage not paint children
We want to darken the stage before dpms, so this commit adds
a way to do that.

Note this probably doesn't work since we have no-clear hint set
on the stage.
2015-10-17 15:04:27 -04:00
3 changed files with 40 additions and 0 deletions

View File

@@ -41,6 +41,7 @@ typedef struct {
struct _MetaStagePrivate {
MetaOverlay cursor_overlay;
gboolean is_active;
gboolean is_black;
};
typedef struct _MetaStagePrivate MetaStagePrivate;
@@ -121,6 +122,9 @@ meta_stage_paint (ClutterActor *actor)
MetaStage *stage = META_STAGE (actor);
MetaStagePrivate *priv = meta_stage_get_instance_private (stage);
if (priv->is_black)
return;
CLUTTER_ACTOR_CLASS (meta_stage_parent_class)->paint (actor);
meta_overlay_paint (&priv->cursor_overlay);
@@ -261,3 +265,16 @@ meta_stage_set_active (MetaStage *stage,
*/
clutter_stage_event (CLUTTER_STAGE (stage), &event);
}
void
meta_stage_set_black (MetaStage *stage,
gboolean is_black)
{
MetaStagePrivate *priv = meta_stage_get_instance_private (stage);
if (priv->is_black != is_black)
{
priv->is_black = is_black;
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
}
}

View File

@@ -57,6 +57,8 @@ void meta_stage_set_cursor (MetaStage *stage,
void meta_stage_set_active (MetaStage *stage,
gboolean is_active);
void meta_stage_set_black (MetaStage *stage,
gboolean is_black);
G_END_DECLS
#endif /* META_STAGE_H */

View File

@@ -43,6 +43,8 @@
#include <meta/errors.h>
#include "meta-monitor-config.h"
#include "meta-stage.h"
#define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)
/* Look for DPI_FALLBACK in:
@@ -646,6 +648,23 @@ get_xmode_name (XRRModeInfo *xmode)
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
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;
}
update_stage_visibility_for_power_save_mode (manager);
XRRGetScreenSizeRange (manager_xrandr->xdisplay, DefaultRootWindow (manager_xrandr->xdisplay),
&min_width,
&min_height,