[gnome-power-manager] Only disable deprecated code for --enable-strict builds (defaulting to true for git)



commit 17818dea5a8e5c6eebd43248ba7aa41838a97ad2
Author: Richard Hughes <richard hughsie com>
Date:   Wed Sep 15 11:34:54 2010 +0100

    Only disable deprecated code for --enable-strict builds (defaulting to true for git)

 configure.ac         |   18 ++++--------------
 src/gpm-brightness.c |   11 ++++++-----
 src/gpm-button.c     |    4 ++--
 src/gpm-dpms.c       |   14 ++++++++------
 src/gpm-idletime.c   |    2 +-
 src/gpm-manager.c    |   13 +++++++++----
 6 files changed, 30 insertions(+), 32 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 655d5ab..9507349 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,14 +23,6 @@ GNOME_DOC_INIT
 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
 
 dnl ---------------------------------------------------------------------------
-dnl - Extra verbose warning switches
-dnl ---------------------------------------------------------------------------
-CPPFLAGS="$CPPFLAGS -DG_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES"
-CPPFLAGS="$CPPFLAGS -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED"
-#CPPFLAGS="$CPPFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE"
-CPPFLAGS="$CPPFLAGS -DGSEAL_ENABLE"
-
-dnl ---------------------------------------------------------------------------
 dnl - Use strict options (default enabled for devs, disabled in releases)
 dnl ---------------------------------------------------------------------------
 if test -d ".git"; then
@@ -43,6 +35,10 @@ AC_ARG_ENABLE(strict, AS_HELP_STRING([--enable-strict],
 		[Enable strict compilation options]), enable_strict=$enableval,
 		enable_strict=$default_strict)
 if test x$enable_strict != xno; then
+	CPPFLAGS="$CPPFLAGS -DG_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES"
+	CPPFLAGS="$CPPFLAGS -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED"
+	CPPFLAGS="$CPPFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE"
+	CPPFLAGS="$CPPFLAGS -DGSEAL_ENABLE"
 	if test "$GCC" = "yes"; then
 		WARNINGFLAGS="$WARNINGFLAGS -Werror"
 	fi
@@ -89,12 +85,6 @@ CPPFLAGS="$CPPFLAGS -g"
 CPPFLAGS="$CPPFLAGS -fexceptions"
 
 dnl ---------------------------------------------------------------------------
-dnl - GProf switches (do not use for normal building)
-dnl ---------------------------------------------------------------------------
-#CPPFLAGS="$CPPFLAGS -c -pg"
-#LDFLAGS="$LDFLAGS -pg"
-
-dnl ---------------------------------------------------------------------------
 dnl - gettext stuff
 dnl ---------------------------------------------------------------------------
 GETTEXT_PACKAGE=AC_PACKAGE_NAME
diff --git a/src/gpm-brightness.c b/src/gpm-brightness.c
index a7bcbaf..f623560 100644
--- a/src/gpm-brightness.c
+++ b/src/gpm-brightness.c
@@ -230,7 +230,7 @@ gpm_brightness_setup_display (GpmBrightness *brightness)
 	g_return_val_if_fail (GPM_IS_BRIGHTNESS (brightness), FALSE);
 
 	/* get the display */
-	brightness->priv->dpy = GDK_DISPLAY();
+	brightness->priv->dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default());
 	if (!brightness->priv->dpy) {
 		egg_error ("Cannot open display");
 		return FALSE;
@@ -265,7 +265,7 @@ gpm_brightness_setup_version (GpmBrightness *brightness)
 	g_return_val_if_fail (GPM_IS_BRIGHTNESS (brightness), FALSE);
 
 	/* get the display */
-	brightness->priv->dpy = GDK_DISPLAY();
+	brightness->priv->dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default());
 	if (!brightness->priv->dpy) {
 		egg_error ("Cannot open display");
 		return FALSE;
@@ -956,8 +956,8 @@ gpm_brightness_init (GpmBrightness *brightness)
 	display = gdk_display_get_default ();
 
 	/* as we a filtering by a window, we have to add an event type */
-	if (!XRRQueryExtension (GDK_DISPLAY(), &event_base, &ignore)) {
-		egg_error ("can't get event_base for XRR");
+	if (!XRRQueryExtension (GDK_DISPLAY_XDISPLAY (gdk_display_get_default()), &event_base, &ignore)) {
+		egg_warning ("can't get event_base for XRR");
 	}
 	gdk_x11_register_standard_event_type (display, event_base, RRNotify + 1);
 	gdk_window_add_filter (brightness->priv->root_window,
@@ -965,7 +965,8 @@ gpm_brightness_init (GpmBrightness *brightness)
 
 	/* don't abort on error */
 	gdk_error_trap_push ();
-	XRRSelectInput (GDK_DISPLAY(), GDK_WINDOW_XID (brightness->priv->root_window),
+	XRRSelectInput (GDK_DISPLAY_XDISPLAY (gdk_display_get_default()),
+			GDK_WINDOW_XID (brightness->priv->root_window),
 			RRScreenChangeNotifyMask |
 			RROutputPropertyNotifyMask); /* <--- the only one we need, but see rh:345551 */
 	gdk_flush ();
diff --git a/src/gpm-button.c b/src/gpm-button.c
index 4ea6dea..cb5cd50 100644
--- a/src/gpm-button.c
+++ b/src/gpm-button.c
@@ -144,7 +144,7 @@ gpm_button_grab_keystring (GpmButton *button, guint64 keycode)
 	gint ret;
 
 	/* get the current X Display */
-	display = GDK_DISPLAY ();
+	display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default());
 
 	/* don't abort on error */
 	gdk_error_trap_push ();
@@ -198,7 +198,7 @@ gpm_button_xevent_key (GpmButton *button, guint keysym, const gchar *key_name)
 	guint keycode;
 
 	/* convert from keysym to keycode */
-	keycode = XKeysymToKeycode (GDK_DISPLAY (), keysym);
+	keycode = XKeysymToKeycode (GDK_DISPLAY_XDISPLAY (gdk_display_get_default()), keysym);
 	if (keycode == 0) {
 		egg_warning ("could not map keysym %x to keycode", keysym);
 		return FALSE;
diff --git a/src/gpm-dpms.c b/src/gpm-dpms.c
index 77d9d4a..fa4faf6 100644
--- a/src/gpm-dpms.c
+++ b/src/gpm-dpms.c
@@ -55,6 +55,7 @@ struct GpmDpmsPrivate
 	gboolean		 dpms_capable;
 	GpmDpmsMode		 mode;
 	guint			 timer_id;
+	Display			*display;
 };
 
 enum {
@@ -95,7 +96,7 @@ gpm_dpms_x11_get_mode (GpmDpms *dpms, GpmDpmsMode *mode, GError **error)
 		goto out;
 	}
 
-	DPMSInfo (GDK_DISPLAY (), &state, &enabled);
+	DPMSInfo (dpms->priv->display, &state, &enabled);
 	if (!enabled) {
 		/* Server says DPMS is disabled -- so the monitor is on. */
 		result = GPM_DPMS_MODE_ON;
@@ -143,7 +144,7 @@ gpm_dpms_x11_set_mode (GpmDpms *dpms, GpmDpmsMode mode, GError **error)
 		return FALSE;
 	}
 
-	if (!DPMSInfo (GDK_DISPLAY (), &current_state, &current_enabled)) {
+	if (!DPMSInfo (dpms->priv->display, &current_state, &current_enabled)) {
 		egg_debug ("couldn't get DPMS info");
 		g_set_error (error, GPM_DPMS_ERROR, GPM_DPMS_ERROR_GENERAL,
 			     "Unable to get DPMS state");
@@ -177,12 +178,12 @@ gpm_dpms_x11_set_mode (GpmDpms *dpms, GpmDpmsMode mode, GError **error)
 
 	gpm_dpms_x11_get_mode (dpms, &current_mode, NULL);
 	if (current_mode != mode) {
-		if (! DPMSForceLevel (GDK_DISPLAY (), state)) {
+		if (! DPMSForceLevel (dpms->priv->display, state)) {
 			g_set_error (error, GPM_DPMS_ERROR, GPM_DPMS_ERROR_GENERAL,
 				     "Could not change DPMS mode");
 			return FALSE;
 		}
-		XSync (GDK_DISPLAY (), FALSE);
+		XSync (dpms->priv->display, FALSE);
 	}
 
 	return TRUE;
@@ -309,7 +310,7 @@ gpm_dpms_clear_timeouts (GpmDpms *dpms)
 	}
 
 	egg_debug ("set timeouts to zero");
-	ret = DPMSSetTimeouts (GDK_DISPLAY (), 0, 0, 0);
+	ret = DPMSSetTimeouts (dpms->priv->display, 0, 0, 0);
 
 out:
 	return ret;
@@ -344,7 +345,8 @@ gpm_dpms_init (GpmDpms *dpms)
 	dpms->priv = GPM_DPMS_GET_PRIVATE (dpms);
 
 	/* DPMSCapable() can never change for a given display */
-	dpms->priv->dpms_capable = DPMSCapable (GDK_DISPLAY ());
+	dpms->priv->display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default());
+	dpms->priv->dpms_capable = DPMSCapable (dpms->priv->display);
 	dpms->priv->timer_id = g_timeout_add_seconds (GPM_DPMS_POLL_TIME, (GSourceFunc)gpm_dpms_poll_mode_cb, dpms);
 #if GLIB_CHECK_VERSION(2,25,8)
 	g_source_set_name_by_id (dpms->priv->timer_id, "[GpmDpms] poll");
diff --git a/src/gpm-idletime.c b/src/gpm-idletime.c
index 569b816..64c8ebe 100644
--- a/src/gpm-idletime.c
+++ b/src/gpm-idletime.c
@@ -399,7 +399,7 @@ gpm_idletime_init (GpmIdletime *idletime)
 	idletime->priv->reset_set = FALSE;
 	idletime->priv->idle_counter = None;
 	idletime->priv->sync_event = 0;
-	idletime->priv->dpy = GDK_DISPLAY ();
+	idletime->priv->dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default());
 
 	/* get the sync event */
 	if (!XSyncQueryExtension (idletime->priv->dpy, &idletime->priv->sync_event, &sync_error)) {
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 6e97824..fc5e3f9 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -158,8 +158,9 @@ gpm_manager_error_get_type (void)
 static gboolean
 gpm_manager_play_loop_timeout_cb (GpmManager *manager)
 {
-	ca_context_play_full (ca_gtk_context_get (),
-			      0,
+	ca_context *context;
+	context = ca_gtk_context_get_for_screen (gdk_screen_get_default ());
+	ca_context_play_full (context, 0,
 			      manager->priv->critical_alert_loop_props,
 			      NULL,
 			      NULL);
@@ -196,6 +197,7 @@ gpm_manager_play_loop_start (GpmManager *manager, GpmManagerSound action, gboole
 	const gchar *desc = NULL;
 	gboolean ret;
 	gint retval;
+	ca_context *context;
 
 	ret = g_settings_get_boolean (manager->priv->settings, GPM_SETTINGS_ENABLE_SOUND);
 	if (!ret && !force) {
@@ -240,7 +242,8 @@ gpm_manager_play_loop_start (GpmManager *manager, GpmManagerSound action, gboole
 #endif
 
 	/* play the sound, using sounds from the naming spec */
-	retval = ca_context_play (ca_gtk_context_get (), 0,
+	context = ca_gtk_context_get_for_screen (gdk_screen_get_default ());
+	retval = ca_context_play (context, 0,
 				  CA_PROP_EVENT_ID, id,
 				  CA_PROP_EVENT_DESCRIPTION, desc, NULL);
 	if (retval < 0)
@@ -258,6 +261,7 @@ gpm_manager_play (GpmManager *manager, GpmManagerSound action, gboolean force)
 	const gchar *desc = NULL;
 	gboolean ret;
 	gint retval;
+	ca_context *context;
 
 	ret = g_settings_get_boolean (manager->priv->settings, GPM_SETTINGS_ENABLE_SOUND);
 	if (!ret && !force) {
@@ -314,7 +318,8 @@ gpm_manager_play (GpmManager *manager, GpmManagerSound action, gboolean force)
 	}
 
 	/* play the sound, using sounds from the naming spec */
-	retval = ca_context_play (ca_gtk_context_get (), 0,
+	context = ca_gtk_context_get_for_screen (gdk_screen_get_default ());
+	retval = ca_context_play (context, 0,
 				  CA_PROP_EVENT_ID, id,
 				  CA_PROP_EVENT_DESCRIPTION, desc, NULL);
 	if (retval < 0)



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