[gnome-desktop] gnome-rr: Add dpms-mode information in debug
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-desktop] gnome-rr: Add dpms-mode information in debug
- Date: Thu, 2 Jul 2015 17:12:47 +0000 (UTC)
commit 27ce2df1ef6f8606c082137a2132f4be535572f4
Author: Bastien Nocera <hadess hadess net>
Date: Thu Jul 2 19:11:27 2015 +0200
gnome-rr: Add dpms-mode information in debug
When the DPMS mode changes, print the new value.
libgnome-desktop/gnome-rr-debug.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/libgnome-desktop/gnome-rr-debug.c b/libgnome-desktop/gnome-rr-debug.c
index 682e721..16d841e 100644
--- a/libgnome-desktop/gnome-rr-debug.c
+++ b/libgnome-desktop/gnome-rr-debug.c
@@ -25,6 +25,25 @@
#include <gtk/gtk.h>
#include <libgnome-desktop/gnome-rr.h>
+static const char *
+dpms_mode_to_str (GnomeRRDpmsMode mode)
+{
+ switch (mode) {
+ case GNOME_RR_DPMS_ON:
+ return "on";
+ case GNOME_RR_DPMS_STANDBY:
+ return "standby";
+ case GNOME_RR_DPMS_SUSPEND:
+ return "suspend";
+ case GNOME_RR_DPMS_OFF:
+ return "off";
+ case GNOME_RR_DPMS_UNKNOWN:
+ return "unknown";
+ default:
+ g_assert_not_reached ();
+ }
+}
+
static void
print_output (GnomeRROutput *output, const char *message)
{
@@ -92,6 +111,16 @@ output_connected (GnomeRRScreen *screen, GnomeRROutput *output, gpointer user_da
print_output (output, "connected");
}
+static void
+dpms_mode_changed (GnomeRRScreen *screen, GParamSpec *pspec, gpointer user_data)
+{
+ GnomeRRDpmsMode mode;
+
+ gnome_rr_screen_get_dpms_mode (screen, &mode, NULL);
+ g_print ("DPMS mode changed to: %s\n", dpms_mode_to_str (mode));
+ g_print ("\n");
+}
+
/**
* main:
**/
@@ -117,6 +146,7 @@ main (int argc, char *argv[])
g_signal_connect (screen, "changed", G_CALLBACK (screen_changed), NULL);
g_signal_connect (screen, "output-disconnected", G_CALLBACK (output_disconnected), NULL);
g_signal_connect (screen, "output-connected", G_CALLBACK (output_connected), NULL);
+ g_signal_connect (screen, "notify::dpms-mode", G_CALLBACK (dpms_mode_changed), NULL);
gtk_main ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]