[gnome-settings-daemon/docking-stations] Refresh the GnomeRRScreen when the laptop's lid is opened or closed



commit 1347329d97ca6bbd40e301684406c5dc71e3cdc8
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Dec 7 13:08:02 2011 -0600

    Refresh the GnomeRRScreen when the laptop's lid is opened or closed
    
    One common scenario may be:  you plug or unplug an external monitor, and you close or open
    the laptop's lid.  At *that* time, we can afford to probe the RANDR outputs (which is
    an expensive operation).  This way we can deal properly with not having hotplug detection;
    we can make use of the user's delay in reacting after opening/closing the lid to
    get a better view of the state of the outputs.
    
    Signed-off-by: Federico Mena Quintero <federico gnome org>

 plugins/xrandr/gsd-xrandr-manager.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index 79246a2..6bff7d7 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -1936,6 +1936,14 @@ power_client_changed_cb (UpClient *client, gpointer data)
         if (is_closed != priv->laptop_lid_is_closed) {
                 priv->laptop_lid_is_closed = is_closed;
 
+                /* Refresh the RANDR state.  The lid just got opened/closed, so we can afford to
+                 * probe the outputs right now.  It will also help the case where we can't detect
+                 * hotplug/unplug, but the fact that the lid's state changed lets us know that the
+                 * user probably did something interesting.
+                 */
+
+                gnome_rr_screen_refresh (priv->rw_screen, NULL); /* NULL-GError */
+
                 if (is_closed)
                         turn_off_laptop_display (manager, GDK_CURRENT_TIME); /* sucks not to have a timestamp for the notification */
                 else



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]