Blob Blame History Raw
From 47af2a6b8349a3edbea7aab2152d859d6c4c23bd Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Mon, 28 Apr 2014 21:56:51 +0200
Subject: [PATCH] power: Check that the output is connected when determining if
 it's ON

It might happen that there's no device connected and yet the CRTC
associated with an output has a valid mode.

RRGetOutputInfo tells us if the hardware was able to detect a device
connected to the output so let's use that.

Note that in versions newer than 3.8, this check isn't required since
the list of outputs that we get from mutter's DisplayConfig interface
is already filtered by mutter and doesn't contain any disconnected
outputs.

https://bugzilla.redhat.com/show_bug.cgi?id=1081093
---
 plugins/power/gpm-common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/plugins/power/gpm-common.c b/plugins/power/gpm-common.c
index b1ce32a..70e4591 100644
--- a/plugins/power/gpm-common.c
+++ b/plugins/power/gpm-common.c
@@ -1694,6 +1694,8 @@ randr_output_is_on (GnomeRROutput *output)
 {
         GnomeRRCrtc *crtc;
 
+        if (!gnome_rr_output_is_connected (output))
+                return FALSE;
         crtc = gnome_rr_output_get_crtc (output);
         if (!crtc)
                 return FALSE;
-- 
1.9.0