[gnome-desktop/randr-hotplug: 2/9] Don't ask for RANDR events if the caller doesn't specify a callback



commit f177b20dd5ce3d5ab2e1df5f0d453ae01eb923d3
Author: Federico Mena Quintero <federico novell com>
Date:   Mon Jun 8 19:03:12 2009 -0500

    Don't ask for RANDR events if the caller doesn't specify a callback
    
    If the caller of GnomeRR specifies a NULL callback, it means that the
    caller is not interested in RANDR events.  In that case, it is not
    necessary to actually ask the X server for those events, or to register
    RANDR's events with GDK.
    
    This prevents spurious events from being generated by gnome-settings-daemon
    and gnome-control-center when they create a temporary GnomeRRScreen to save
    the current configuration for backup purposes.
    
    Signed-off-by: Federico Mena Quintero <federico novell com>
---
 libgnome-desktop/gnome-rr.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/libgnome-desktop/gnome-rr.c b/libgnome-desktop/gnome-rr.c
index 4debe2e..16e7ac3 100644
--- a/libgnome-desktop/gnome-rr.c
+++ b/libgnome-desktop/gnome-rr.c
@@ -584,16 +584,18 @@ gnome_rr_screen_new (GdkScreen *gdk_screen,
 	    return NULL;
 	}
 
-	XRRSelectInput (screen->xdisplay,
-			screen->xroot,
-			RRScreenChangeNotifyMask);
-
-	gdk_x11_register_standard_event_type (
-	    gdk_screen_get_display (gdk_screen),
-	    event_base,
-	    RRNotify + 1);
-	
-	gdk_window_add_filter (screen->gdk_root, screen_on_event, screen);
+	if (screen->callback) {
+	    XRRSelectInput (screen->xdisplay,
+			    screen->xroot,
+			    RRScreenChangeNotifyMask);
+
+	    gdk_x11_register_standard_event_type (gdk_screen_get_display (gdk_screen),
+						  event_base,
+						  RRNotify + 1);
+
+	    gdk_window_add_filter (screen->gdk_root, screen_on_event, screen);
+	}
+
 	return screen;
     }
     else



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