[packages/mate-power-manager] restore original blacklight value when resuming from idle
glen
glen at pld-linux.org
Sat Mar 2 19:03:41 CET 2013
commit 5e5c651d8d289e987c036fca630da845036815e1
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Sat Mar 2 20:02:06 2013 +0200
restore original blacklight value when resuming from idle
[PATCH] Don't use the default backlight reduced-brightness value if
exiting idle state. This means the pre-idle backlight brightness will be
set instead of the default reduced-brightness value.
fa0afc54fc8b29ef3251b33cb55e590edb5e441e.patch | 137 +++++++++++++++++++++++++
mate-power-manager.spec | 4 +-
2 files changed, 140 insertions(+), 1 deletion(-)
---
diff --git a/mate-power-manager.spec b/mate-power-manager.spec
index 2276826..d227a32 100644
--- a/mate-power-manager.spec
+++ b/mate-power-manager.spec
@@ -5,7 +5,7 @@
Summary: MATE power management service
Name: mate-power-manager
Version: 1.5.1
-Release: 5
+Release: 6
License: GPL v2+
Group: X11/Applications
Source0: http://pub.mate-desktop.org/releases/1.5/%{name}-%{version}.tar.xz
@@ -15,6 +15,7 @@ Patch1: use-gnome-keyring.patch
Patch2: use-libnotify.patch
Patch3: systemd-fallback.patch
Patch4: uidir.patch
+Patch5: https://github.com/smkent/mate-power-manager/commit/fa0afc54fc8b29ef3251b33cb55e590edb5e441e.patch
URL: http://wiki.mate-desktop.org/mate-power-manager
BuildRequires: cairo-devel >= 1.0.0
BuildRequires: dbus-glib-devel
@@ -59,6 +60,7 @@ MATE session.
%patch2 -p1
%patch3 -p1
%patch4 -p1
+%patch5 -p1
%build
NOCONFIGURE=1 ./autogen.sh
diff --git a/fa0afc54fc8b29ef3251b33cb55e590edb5e441e.patch b/fa0afc54fc8b29ef3251b33cb55e590edb5e441e.patch
new file mode 100644
index 0000000..6bdbe2d
--- /dev/null
+++ b/fa0afc54fc8b29ef3251b33cb55e590edb5e441e.patch
@@ -0,0 +1,137 @@
+From fa0afc54fc8b29ef3251b33cb55e590edb5e441e Mon Sep 17 00:00:00 2001
+From: Stephen Kent <smkent at smkent.net>
+Date: Sat, 24 Nov 2012 22:41:07 -0800
+Subject: [PATCH] Don't use the default backlight reduced-brightness value if
+ exiting idle state. This means the pre-idle backlight
+ brightness will be set instead of the default
+ reduced-brightness value.
+
+---
+ src/gpm-backlight.c | 45 ++++++++++++++++++++++++---------------------
+ 1 file changed, 24 insertions(+), 21 deletions(-)
+
+diff --git a/src/gpm-backlight.c b/src/gpm-backlight.c
+index 573778a..c2d58e2 100644
+--- a/src/gpm-backlight.c
++++ b/src/gpm-backlight.c
+@@ -269,7 +269,7 @@ enum {
+ * gpm_backlight_brightness_evaluate_and_set:
+ **/
+ static gboolean
+-gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean interactive)
++gpm_backlight_brightness_evaluate_and_set (GpmBacklight *backlight, gboolean interactive, gboolean use_initial)
+ {
+ gfloat brightness;
+ gfloat scale;
+@@ -303,19 +303,22 @@ enum {
+ NULL);
+
+ /* reduce if on battery power if we should */
+- battery_reduce = g_settings_get_boolean (backlight->priv->settings, GPM_SETTINGS_BACKLIGHT_BATTERY_REDUCE);
+- if (on_battery && battery_reduce) {
+- value = g_settings_get_int (backlight->priv->settings, GPM_SETTINGS_BRIGHTNESS_DIM_BATT);
+- if (value > 100) {
+- egg_warning ("cannot use battery brightness value %i, correcting to 50", value);
+- value = 50;
++ if (use_initial) {
++ egg_debug ("Setting initial brightness level");
++ battery_reduce = g_settings_get_boolean (backlight->priv->settings, GPM_SETTINGS_BACKLIGHT_BATTERY_REDUCE);
++ if (on_battery && battery_reduce) {
++ value = g_settings_get_int (backlight->priv->settings, GPM_SETTINGS_BRIGHTNESS_DIM_BATT);
++ if (value > 100) {
++ egg_warning ("cannot use battery brightness value %i, correcting to 50", value);
++ value = 50;
++ }
++ scale = (100 - value) / 100.0f;
++ brightness *= scale;
++ } else {
++ scale = 1.0f;
+ }
+- scale = (100 - value) / 100.0f;
+- brightness *= scale;
+- } else {
+- scale = 1.0f;
++ egg_debug ("2. battery scale %f, brightness %f", scale, brightness);
+ }
+- egg_debug ("2. battery scale %f, brightness %f", scale, brightness);
+
+ /* reduce if system is momentarily idle */
+ if (!on_battery)
+@@ -379,17 +382,17 @@ enum {
+
+ if (!on_battery && g_strcmp0 (key, GPM_SETTINGS_BRIGHTNESS_AC) == 0) {
+ backlight->priv->master_percentage = g_settings_get_double (settings, key);
+- gpm_backlight_brightness_evaluate_and_set (backlight, FALSE);
++ gpm_backlight_brightness_evaluate_and_set (backlight, FALSE, TRUE);
+
+ } else if (on_battery && g_strcmp0 (key, GPM_SETTINGS_BRIGHTNESS_DIM_BATT) == 0) {
+- gpm_backlight_brightness_evaluate_and_set (backlight, FALSE);
++ gpm_backlight_brightness_evaluate_and_set (backlight, FALSE, TRUE);
+
+ } else if (g_strcmp0 (key, GPM_SETTINGS_IDLE_DIM_AC) == 0 ||
+ g_strcmp0 (key, GPM_SETTINGS_BACKLIGHT_ENABLE) == 0 ||
+ g_strcmp0 (key, GPM_SETTINGS_SLEEP_DISPLAY_BATT) == 0 ||
+ g_strcmp0 (key, GPM_SETTINGS_BACKLIGHT_BATTERY_REDUCE) == 0 ||
+ g_strcmp0 (key, GPM_SETTINGS_IDLE_BRIGHTNESS) == 0) {
+- gpm_backlight_brightness_evaluate_and_set (backlight, FALSE);
++ gpm_backlight_brightness_evaluate_and_set (backlight, FALSE, TRUE);
+
+ } else if (g_strcmp0 (key, GPM_SETTINGS_IDLE_DIM_TIME) == 0) {
+ backlight->priv->idle_dim_timeout = g_settings_get_int (settings, key);
+@@ -409,7 +412,7 @@ enum {
+ static void
+ gpm_backlight_client_changed_cb (UpClient *client, GpmBacklight *backlight)
+ {
+- gpm_backlight_brightness_evaluate_and_set (backlight, FALSE);
++ gpm_backlight_brightness_evaluate_and_set (backlight, FALSE, TRUE);
+ }
+
+ /**
+@@ -468,7 +471,7 @@ enum {
+ }
+ } else if (g_strcmp0 (type, GPM_BUTTON_LID_OPEN) == 0) {
+ /* make sure we undim when we lift the lid */
+- gpm_backlight_brightness_evaluate_and_set (backlight, FALSE);
++ gpm_backlight_brightness_evaluate_and_set (backlight, FALSE, TRUE);
+
+ /* ensure backlight is on */
+ ret = gpm_dpms_set_mode (backlight->priv->dpms, GPM_DPMS_MODE_ON, &error);
+@@ -560,7 +563,7 @@ enum {
+ if (mode == GPM_IDLE_MODE_NORMAL) {
+ /* sync lcd brightness */
+ gpm_backlight_notify_system_idle_changed (backlight, FALSE);
+- gpm_backlight_brightness_evaluate_and_set (backlight, FALSE);
++ gpm_backlight_brightness_evaluate_and_set (backlight, FALSE, FALSE);
+
+ /* ensure backlight is on */
+ ret = gpm_dpms_set_mode (backlight->priv->dpms, GPM_DPMS_MODE_ON, &error);
+@@ -573,7 +576,7 @@ enum {
+
+ /* sync lcd brightness */
+ gpm_backlight_notify_system_idle_changed (backlight, TRUE);
+- gpm_backlight_brightness_evaluate_and_set (backlight, FALSE);
++ gpm_backlight_brightness_evaluate_and_set (backlight, FALSE, FALSE);
+
+ /* ensure backlight is on */
+ ret = gpm_dpms_set_mode (backlight->priv->dpms, GPM_DPMS_MODE_ON, &error);
+@@ -586,7 +589,7 @@ enum {
+
+ /* sync lcd brightness */
+ gpm_backlight_notify_system_idle_changed (backlight, TRUE);
+- gpm_backlight_brightness_evaluate_and_set (backlight, FALSE);
++ gpm_backlight_brightness_evaluate_and_set (backlight, FALSE, FALSE);
+
+ /* get the DPMS state we're supposed to use on the power state */
+ g_object_get (backlight->priv->client,
+@@ -772,7 +775,7 @@ enum {
+ backlight->priv->consolekit = egg_console_kit_new ();
+
+ /* sync at startup */
+- gpm_backlight_brightness_evaluate_and_set (backlight, FALSE);
++ gpm_backlight_brightness_evaluate_and_set (backlight, FALSE, TRUE);
+ }
+
+ /**
+--
+1.7.10
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/mate-power-manager.git/commitdiff/5e5c651d8d289e987c036fca630da845036815e1
More information about the pld-cvs-commit
mailing list