summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Fontaine <arnau@debian.org>2009-12-16 19:55:01 +0100
committerArnaud Fontaine <arnau@debian.org>2010-08-09 16:06:30 -0500
commitf8b7aaa3a20b7ea8a8e65a24d125a62e1ce1cf2e (patch)
treed0bfff379284788328e46f3ce6a282d18ae4e9a2
parent623f5dc342fea62b8ffdfe74efeb3c3e06a9883e (diff)
xcb_ewmh_init_atoms: use xcb_setup_roots_length()
-rw-r--r--ewmh/ewmh.c.m413
1 files changed, 6 insertions, 7 deletions
diff --git a/ewmh/ewmh.c.m4 b/ewmh/ewmh.c.m4
index 50e49a0..520d3a5 100644
--- a/ewmh/ewmh.c.m4
+++ b/ewmh/ewmh.c.m4
@@ -515,12 +515,9 @@ xcb_ewmh_init_atoms(xcb_connection_t *c,
ewmh->connection = c;
- xcb_screen_iterator_t screen_iter = xcb_setup_roots_iterator(xcb_get_setup(c));
- xcb_screen_iterator_t iter;
-
- for(iter = screen_iter; iter.rem; xcb_screen_next(&iter))
- ewmh->nb_screens++;
+ const xcb_setup_t *setup = xcb_get_setup(c);
+ ewmh->nb_screens = xcb_setup_roots_length(setup);
if(!ewmh->nb_screens)
return NULL;
@@ -528,8 +525,10 @@ xcb_ewmh_init_atoms(xcb_connection_t *c,
ewmh->screens = malloc(sizeof(xcb_screen_t *) * ewmh->nb_screens);
ewmh->_NET_WM_CM_Sn = malloc(sizeof(xcb_atom_t) * ewmh->nb_screens);
- for(iter = screen_iter, screen_nbr = 0; iter.rem; xcb_screen_next(&iter))
- ewmh->screens[screen_nbr++] = iter.data;
+ xcb_screen_iterator_t screen_iter = xcb_setup_roots_iterator(setup);
+ for(screen_iter = xcb_setup_roots_iterator(setup), screen_nbr = 0; screen_iter.rem;
+ xcb_screen_next(&screen_iter))
+ ewmh->screens[screen_nbr++] = screen_iter.data;
/* _NET_WM_CM_Sn atoms will be treated differently, by adding them
at the end of this array, than other atoms as it depends on the