diff options
author | Arnaud Fontaine <arnau@debian.org> | 2009-12-16 19:55:01 +0100 |
---|---|---|
committer | Arnaud Fontaine <arnau@debian.org> | 2010-11-14 20:22:29 +0900 |
commit | 75b2d987ecd43940031c031252c3ac0e3cea15a1 (patch) | |
tree | 55d8ad7c594ea1c9eb0d9233bcc0818d6503a710 /ewmh | |
parent | d590e26e6f9ed6f8b5456b99c2c52322d87c46de (diff) |
xcb_ewmh_init_atoms: use xcb_setup_roots_length()
Diffstat (limited to 'ewmh')
-rw-r--r-- | ewmh/ewmh.c.m4 | 13 |
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 |