gnome-power-manager r2770 - in trunk: . src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r2770 - in trunk: . src
- Date: Thu, 10 Apr 2008 03:22:11 +0100 (BST)
Author: rhughes
Date: Thu Apr 10 03:22:11 2008
New Revision: 2770
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=2770&view=rev
Log:
2008-04-10 Richard Hughes <richard hughsie com>
* src/gpm-backlight.c: (brightness_changed_cb):
* src/gpm-brightness-hal.c: (gpm_brightness_hal_up),
(gpm_brightness_hal_down):
* src/gpm-brightness-xrandr.c:
(gpm_brightness_xrandr_output_get_limits),
(gpm_brightness_xrandr_may_have_changed),
(gpm_brightness_xrandr_filter_xevents):
More code in preparation to emit a ::changed signal when xrandr changes.
Also don't emit this when we do up&down in the HAL backend, else we will get
a double notification event.
Modified:
trunk/ChangeLog
trunk/src/gpm-backlight.c
trunk/src/gpm-brightness-hal.c
trunk/src/gpm-brightness-xrandr.c
Modified: trunk/src/gpm-backlight.c
==============================================================================
--- trunk/src/gpm-backlight.c (original)
+++ trunk/src/gpm-backlight.c Thu Apr 10 03:22:11 2008
@@ -683,13 +683,15 @@
* This callback is called when the brightness value changes.
**/
static void
-brightness_changed_cb (GpmBrightness *brightness,
- guint percentage,
- GpmBacklight *backlight)
+brightness_changed_cb (GpmBrightness *brightness, guint percentage, GpmBacklight *backlight)
{
+ /* display the widget when something else changed the backlight */
gpm_debug ("Need to display backlight feedback value %i", percentage);
gpm_feedback_display_value (backlight->priv->feedback, (float) percentage / 100.0f);
+ /* save the new percentage */
+ backlight->priv->master_percentage = percentage;
+
/* we emit a signal for the brightness applet */
gpm_debug ("emitting brightness-changed : %i", percentage);
g_signal_emit (backlight, signals [BRIGHTNESS_CHANGED], 0, percentage);
Modified: trunk/src/gpm-brightness-hal.c
==============================================================================
--- trunk/src/gpm-brightness-hal.c (original)
+++ trunk/src/gpm-brightness-hal.c Thu Apr 10 03:22:11 2008
@@ -328,11 +328,6 @@
gpm_brightness_hal_set_hw (brightness, brightness->priv->last_set_hw + step);
}
- percentage = gpm_discrete_to_percent (brightness->priv->last_set_hw,
- brightness->priv->levels);
- gpm_debug ("emitting brightness-changed (%i)", percentage);
- g_signal_emit (brightness, signals [BRIGHTNESS_CHANGED], 0, percentage);
-
return TRUE;
}
@@ -367,11 +362,6 @@
gpm_brightness_hal_set_hw (brightness, brightness->priv->last_set_hw - step);
}
- percentage = gpm_discrete_to_percent (brightness->priv->last_set_hw,
- brightness->priv->levels);
- gpm_debug ("emitting brightness-changed (%i)", percentage);
- g_signal_emit (brightness, signals [BRIGHTNESS_CHANGED], 0, percentage);
-
return TRUE;
}
Modified: trunk/src/gpm-brightness-xrandr.c
==============================================================================
--- trunk/src/gpm-brightness-xrandr.c (original)
+++ trunk/src/gpm-brightness-xrandr.c Thu Apr 10 03:22:11 2008
@@ -163,7 +163,8 @@
* gpm_brightness_xrandr_output_get_limits:
**/
static gboolean
-gpm_brightness_xrandr_output_get_limits (GpmBrightnessXRandR *brightness, RROutput output, guint *min, guint *max)
+gpm_brightness_xrandr_output_get_limits (GpmBrightnessXRandR *brightness, RROutput output,
+ guint *min, guint *max)
{
XRRPropertyInfo *info;
gboolean ret = TRUE;
@@ -471,6 +472,23 @@
}
/**
+ * gpm_brightness_xrandr_may_have_changed:
+ **/
+static void
+gpm_brightness_xrandr_may_have_changed (GpmBrightnessXRandR *brightness)
+{
+ gboolean ret;
+ guint percentage;
+ ret = gpm_brightness_xrandr_get (brightness, &percentage);
+ if (!ret) {
+ gpm_warning ("failed to get output");
+ return;
+ }
+ gpm_debug ("emitting brightness-changed (%i)", percentage);
+ g_signal_emit (brightness, signals [BRIGHTNESS_CHANGED], 0, percentage);
+}
+
+/**
* gpm_brightness_xrandr_filter_xevents:
**/
static GdkFilterReturn
@@ -478,6 +496,9 @@
{
GpmBrightnessXRandR *brightness = GPM_BRIGHTNESS_XRANDR (data);
gpm_warning ("Event0 %p", brightness);
+ if (FALSE) {
+ gpm_brightness_xrandr_may_have_changed (brightness);
+ }
return GDK_FILTER_CONTINUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]