[Xfce4-commits] <xfce4-power-manager:master> Don't lock screen on lid event when multiple monitor is connected

Ali Abdallah aliov at xfce.org
Sun Aug 16 18:40:02 CEST 2009


Updating branch refs/heads/master
         to 3e1a43725331dd8ca7d0be0171545681be32b417 (commit)
       from 2b6b3b16843b9d3f59d780d0058bf8b247f8e44b (commit)

commit 3e1a43725331dd8ca7d0be0171545681be32b417
Author: Ali Abdallah <aliov at xfce.org>
Date:   Sun Aug 16 18:01:27 2009 +0200

    Don't lock screen on lid event when multiple monitor is connected

 configure.ac.in       |    4 ++--
 libxfpm/xfpm-common.c |   35 +++++++++++++++++++++++++++++++++++
 libxfpm/xfpm-common.h |    2 ++
 src/xfpm-engine.c     |    5 ++++-
 4 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index 3b0696b..ae1c503 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -1,7 +1,7 @@
 m4_define([intltool_minimum_version], [0.31])
 m4_define([xfpm_version_major],  [0])
-m4_define([xfpm_version_minor],  [8])
-m4_define([xfpm_version_micro],  [3.1])
+m4_define([xfpm_version_minor],  [9])
+m4_define([xfpm_version_micro],  [90])
 m4_define([xfpm_version_build],  [])
 m4_define([xfpm_version_tag],[])
 m4_define([xfpm_version], [xfpm_version_major().xfpm_version_minor().xfpm_version_micro()ifelse(xfpm_version_tag(), [svn], [xfpm_version_tag().xfpm_version_build()], [xfpm_version_tag()])])
diff --git a/libxfpm/xfpm-common.c b/libxfpm/xfpm-common.c
index 0bd65c1..99ebb49 100644
--- a/libxfpm/xfpm-common.c
+++ b/libxfpm/xfpm-common.c
@@ -165,3 +165,38 @@ xfpm_about (GtkWidget *widget, gpointer data)
 		     NULL);
 						 
 }
+
+gboolean xfpm_guess_is_multimonitor (void)
+{
+    GdkDisplay *dpy;
+    GdkScreen *screen;
+    gint nscreen;
+    gint nmonitor;
+    
+    dpy = gdk_display_get_default ();
+    
+    nscreen = gdk_display_get_n_screens (dpy);
+    
+    if ( nscreen == 1 )
+    {
+	screen = gdk_display_get_screen (dpy, 0);
+	if ( screen )
+	{
+	    nmonitor = gdk_screen_get_n_monitors (screen);
+	    if ( nmonitor > 1 )
+	    {
+		g_debug ("Multiple monitor connected");
+		return TRUE; 
+	    }
+	    else
+		return FALSE;
+	}
+    }
+    else if ( nscreen > 1 )
+    {
+	g_debug ("Multiple screen connected");
+	return TRUE;
+    }
+    
+    return FALSE;
+}
diff --git a/libxfpm/xfpm-common.h b/libxfpm/xfpm-common.h
index 717dcc0..9ab0fb3 100644
--- a/libxfpm/xfpm-common.h
+++ b/libxfpm/xfpm-common.h
@@ -47,6 +47,8 @@ void            xfpm_quit                       (void);
 void       	xfpm_about			(GtkWidget *widget, 
 						 gpointer data);
 
+gboolean	xfpm_guess_is_multimonitor	(void);
+
 G_END_DECLS
 
 #endif /* XFPM_COMMON_H */
diff --git a/src/xfpm-engine.c b/src/xfpm-engine.c
index 110d737..00dfbff 100644
--- a/src/xfpm-engine.c
+++ b/src/xfpm-engine.c
@@ -241,7 +241,10 @@ xfpm_engine_lid_event (XfpmEngine *engine)
     XFPM_DEBUG_ENUM ("LID close event", action, XFPM_TYPE_LID_TRIGGER_ACTION);
     
     if ( action == LID_TRIGGER_LOCK_SCREEN )
-	xfpm_lock_screen ();
+    {
+	if ( !xfpm_guess_is_multimonitor () )
+	    xfpm_lock_screen ();
+    }
     else 
 	xfpm_engine_shutdown_request (engine, action, FALSE);
 }



More information about the Xfce4-commits mailing list