summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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);
}
}