summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2018-08-13 09:51:35 +0200
committerraveit65 <[email protected]>2018-08-13 09:51:35 +0200
commitc569240f040f7b4394336569c803f58bd85f6b01 (patch)
treec4a1309d55bd7357cb2ccab6238d4aa88a89261d /src
parentb074e024ff770da5d381c425210cd3d29e61a584 (diff)
downloadmate-power-manager-c569240f040f7b4394336569c803f58bd85f6b01.tar.bz2
mate-power-manager-c569240f040f7b4394336569c803f58bd85f6b01.tar.xz
gpm-brightness: replace deprecated Gdk functions
Diffstat (limited to 'src')
-rw-r--r--src/gpm-brightness.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/gpm-brightness.c b/src/gpm-brightness.c
index 559934b..e2a1649 100644
--- a/src/gpm-brightness.c
+++ b/src/gpm-brightness.c
@@ -225,17 +225,20 @@ gpm_brightness_output_get_internal (GpmBrightness *brightness, RROutput output,
static gboolean
gpm_brightness_output_set_internal (GpmBrightness *brightness, RROutput output, guint value)
{
+ GdkDisplay *display;
+
gboolean ret = TRUE;
g_return_val_if_fail (GPM_IS_BRIGHTNESS (brightness), FALSE);
/* don't abort on error */
- gdk_error_trap_push ();
+ display = gdk_display_get_default ();
+ gdk_x11_display_error_trap_push (display);
XRRChangeOutputProperty (brightness->priv->dpy, output, brightness->priv->backlight, XA_INTEGER, 32,
PropModeReplace, (unsigned char *) &value, 1);
XFlush (brightness->priv->dpy);
- gdk_flush ();
- if (gdk_error_trap_pop ()) {
+ gdk_display_flush (display);
+ if (gdk_x11_display_error_trap_pop (display)) {
egg_warning ("failed to XRRChangeOutputProperty for brightness %i", value);
ret = FALSE;
}
@@ -846,9 +849,9 @@ gpm_brightness_update_cache (GpmBrightness *brightness)
root = RootWindow (brightness->priv->dpy, 0);
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
resource = XRRGetScreenResourcesCurrent (brightness->priv->dpy, root);
- if (gdk_error_trap_pop () || resource == NULL) {
+ if (gdk_x11_display_error_trap_pop (display) || resource == NULL) {
egg_warning ("failed to XRRGetScreenResourcesCurrent");
}
@@ -952,13 +955,13 @@ gpm_brightness_init (GpmBrightness *brightness)
gpm_brightness_filter_xevents, brightness);
/* don't abort on error */
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
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 ();
- if (gdk_error_trap_pop ())
+ gdk_display_flush (display);
+ if (gdk_x11_display_error_trap_pop (display))
egg_warning ("failed to select XRRSelectInput");
/* create cache of XRRScreenResources as XRRGetScreenResources() is slow */