[gnome-power-manager] Only dim the screen on idle when on the active console



commit 34f5a18be7b3b61d0edf6ee9ad37f75b75b12187
Author: Chris Coulson <chrisccoulson googlemail com>
Date:   Sat Mar 27 16:25:33 2010 +0000

    Only dim the screen on idle when on the active console
    
    Check if we are on the active VT before dimming or blanking the
    screen on idle.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=614207

 src/gpm-backlight.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/gpm-backlight.c b/src/gpm-backlight.c
index ca99aa1..72861bc 100644
--- a/src/gpm-backlight.c
+++ b/src/gpm-backlight.c
@@ -54,6 +54,7 @@
 #include "gpm-marshal.h"
 #include "gpm-stock-icons.h"
 #include "gpm-prefs-server.h"
+#include "egg-console-kit.h"
 
 #define GPM_BACKLIGHT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_BACKLIGHT, GpmBacklightPrivate))
 
@@ -67,6 +68,7 @@ struct GpmBacklightPrivate
 	GpmControl		*control;
 	GpmDpms			*dpms;
 	GpmIdle			*idle;
+	EggConsoleKit		*consolekit;
 	gboolean		 can_dim;
 	gboolean		 system_is_idle;
 	GTimer			*idle_timer;
@@ -557,6 +559,12 @@ idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmBacklight *backlight)
 	if (gpm_button_is_lid_closed (backlight->priv->button))
 		return;
 
+	/* don't dim or undim the screen unless we are on the active console */
+	if (!egg_console_kit_is_active (backlight->priv->consolekit)) {
+		egg_debug ("ignoring as not on active console");
+		return;
+	}
+
 	if (mode == GPM_IDLE_MODE_NORMAL) {
 		/* sync lcd brightness */
 		gpm_backlight_notify_system_idle_changed (backlight, FALSE);
@@ -678,6 +686,7 @@ gpm_backlight_finalize (GObject *object)
 	g_object_unref (backlight->priv->button);
 	g_object_unref (backlight->priv->idle);
 	g_object_unref (backlight->priv->brightness);
+	g_object_unref (backlight->priv->consolekit);
 
 	g_return_if_fail (backlight->priv != NULL);
 	G_OBJECT_CLASS (gpm_backlight_parent_class)->finalize (object);
@@ -792,6 +801,9 @@ gpm_backlight_init (GpmBacklight *backlight)
 	g_signal_connect (backlight->priv->control, "resume",
 			  G_CALLBACK (control_resume_cb), backlight);
 
+	/* Don't do dimming on inactive console */
+	backlight->priv->consolekit = egg_console_kit_new ();
+
 	/* sync at startup */
 	gpm_backlight_brightness_evaluate_and_set (backlight, FALSE);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]