diff --git a/src/x.c b/src/x.c index 0d00342a..3b782c0a 100644 --- a/src/x.c +++ b/src/x.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -94,7 +95,7 @@ void x_connection_init(struct x_connection *c, Display *dpy) { c->previous_xerror_handler = XSetErrorHandler(xerror); c->screen = DefaultScreen(dpy); - c->screen_info = x_screen_of_display(c, c->screen); + c->screen_info = xcb_aux_get_screen(c->c, c->screen); } /** @@ -904,19 +905,6 @@ struct xvisual_info x_get_visual_info(struct x_connection *c, xcb_visualid_t vis }; } -xcb_screen_t *x_screen_of_display(struct x_connection *c, int screen) { - xcb_screen_iterator_t iter; - - iter = xcb_setup_roots_iterator(xcb_get_setup(c->c)); - for (; iter.rem; --screen, xcb_screen_next(&iter)) { - if (screen == 0) { - return iter.data; - } - } - - return NULL; -} - void x_update_monitors(struct x_connection *c, struct x_monitors *m) { x_free_monitor_info(m); diff --git a/src/x.h b/src/x.h index 127ff510..898c5f52 100644 --- a/src/x.h +++ b/src/x.h @@ -414,8 +414,6 @@ xcb_visualid_t x_get_visual_for_depth(struct x_connection *c, uint8_t depth); xcb_render_pictformat_t x_get_pictfmt_for_standard(struct x_connection *c, xcb_pict_standard_t std); -xcb_screen_t *x_screen_of_display(struct x_connection *c, int screen); - /// Populates a `struct x_monitors` with the current monitor configuration. void x_update_monitors(struct x_connection *, struct x_monitors *); /// Free memory allocated for a `struct x_monitors`.