[gnome-settings-daemon] power: add a method to retrieve the backlight output id
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: add a method to retrieve the backlight output id
- Date: Thu, 13 Nov 2014 18:34:59 +0000 (UTC)
commit a653c34b468f5f42f42832e887f10ba4dd4bae98
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Nov 13 10:22:01 2014 -0800
power: add a method to retrieve the backlight output id
We're going to use this later.
https://bugzilla.gnome.org/show_bug.cgi?id=704086
plugins/power/gpm-common.c | 22 ++++++++++++++++++++++
plugins/power/gpm-common.h | 1 +
2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/plugins/power/gpm-common.c b/plugins/power/gpm-common.c
index 1b97af1..b3eeeac 100644
--- a/plugins/power/gpm-common.c
+++ b/plugins/power/gpm-common.c
@@ -512,6 +512,28 @@ out:
}
int
+backlight_get_output_id (GnomeRRScreen *rr_screen)
+{
+ GnomeRROutput *output;
+ GnomeRRCrtc *crtc;
+ GdkScreen *gdk_screen;
+ gint x, y;
+
+ output = get_primary_output (rr_screen);
+ if (output == NULL)
+ return -1;
+
+ crtc = gnome_rr_output_get_crtc (output);
+ if (crtc == NULL)
+ return -1;
+
+ gdk_screen = gdk_screen_get_default ();
+ gnome_rr_crtc_get_position (crtc, &x, &y);
+
+ return gdk_screen_get_monitor_at_point (gdk_screen, x, y);
+}
+
+int
backlight_get_abs (GnomeRRScreen *rr_screen, GError **error)
{
GnomeRROutput *output;
diff --git a/plugins/power/gpm-common.h b/plugins/power/gpm-common.h
index 675dfeb..481c358 100644
--- a/plugins/power/gpm-common.h
+++ b/plugins/power/gpm-common.h
@@ -45,6 +45,7 @@ void reset_idletime (void);
int gsd_power_backlight_abs_to_percentage (int min, int max, int value);
gboolean backlight_available (GnomeRRScreen *rr_screen);
+int backlight_get_output_id (GnomeRRScreen *rr_screen);
int backlight_get_abs (GnomeRRScreen *rr_screen, GError **error);
int backlight_get_percentage (GnomeRRScreen *rr_screen, GError **error);
int backlight_get_min (GnomeRRScreen *rr_screen);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]