summaryrefslogtreecommitdiff
path: root/src/gpm-brightness.c
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2017-07-28 21:00:38 +0200
committerZenWalker <[email protected]>2017-07-28 21:38:10 +0200
commit0aebbd9548603e170a45e5ce7dac271a393c8b0a (patch)
tree2ff5d03eeb2475325ed8639f9c46e3855dbed7cd /src/gpm-brightness.c
parentd6d74e272e72691626961eddc5dc2b9f8ec622f1 (diff)
downloadmate-power-manager-0aebbd9548603e170a45e5ce7dac271a393c8b0a.tar.bz2
mate-power-manager-0aebbd9548603e170a45e5ce7dac271a393c8b0a.tar.xz
avoid deprecated gdk_display_get_screen
Diffstat (limited to 'src/gpm-brightness.c')
-rw-r--r--src/gpm-brightness.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/src/gpm-brightness.c b/src/gpm-brightness.c
index 8987c7f..559934b 100644
--- a/src/gpm-brightness.c
+++ b/src/gpm-brightness.c
@@ -821,7 +821,6 @@ static void
gpm_brightness_update_cache (GpmBrightness *brightness)
{
guint length;
- gint screen;
Window root;
GdkScreen *gscreen;
GdkDisplay *display;
@@ -834,33 +833,28 @@ gpm_brightness_update_cache (GpmBrightness *brightness)
if (length > 0)
g_ptr_array_set_size (brightness->priv->resources, 0);
- /* do for each screen */
display = gdk_display_get_default ();
- length = ScreenCount (brightness->priv->dpy);
- for (screen = 0; screen < (gint) length; screen++) {
- egg_debug ("screen %i of %i", screen+1, length);
- gscreen = gdk_display_get_screen (display, screen);
-
- /* if we have not setup the changed on the monitor, set it here */
- if (g_object_get_data (G_OBJECT (gscreen), "gpk-set-monitors-changed") == NULL) {
- egg_debug ("watching ::monitors_changed on %p", gscreen);
- g_object_set_data (G_OBJECT (gscreen), "gpk-set-monitors-changed", (gpointer) "true");
- g_signal_connect (G_OBJECT (gscreen), "monitors_changed",
- G_CALLBACK (gpm_brightness_monitors_changed), brightness);
- }
+ gscreen = gdk_display_get_default_screen (display);
- root = RootWindow (brightness->priv->dpy, screen);
+ /* if we have not setup the changed on the monitor, set it here */
+ if (g_object_get_data (G_OBJECT (gscreen), "gpk-set-monitors-changed") == NULL) {
+ egg_debug ("watching ::monitors_changed on %p", gscreen);
+ g_object_set_data (G_OBJECT (gscreen), "gpk-set-monitors-changed", (gpointer) "true");
+ g_signal_connect (G_OBJECT (gscreen), "monitors_changed",
+ G_CALLBACK (gpm_brightness_monitors_changed), brightness);
+ }
- gdk_error_trap_push ();
- resource = XRRGetScreenResourcesCurrent (brightness->priv->dpy, root);
- if (gdk_error_trap_pop () || resource == NULL) {
- egg_warning ("failed to XRRGetScreenResourcesCurrent");
- }
+ root = RootWindow (brightness->priv->dpy, 0);
- if (resource != NULL) {
- egg_debug ("adding resource %p", resource);
- g_ptr_array_add (brightness->priv->resources, resource);
- }
+ gdk_error_trap_push ();
+ resource = XRRGetScreenResourcesCurrent (brightness->priv->dpy, root);
+ if (gdk_error_trap_pop () || resource == NULL) {
+ egg_warning ("failed to XRRGetScreenResourcesCurrent");
+ }
+
+ if (resource != NULL) {
+ egg_debug ("adding resource %p", resource);
+ g_ptr_array_add (brightness->priv->resources, resource);
}
}