x: remove x_screen_of_display and use xcb_aux_get_screen instead

This commit is contained in:
Maxim Solovyov 2024-02-14 20:22:25 +03:00
parent f28905b62d
commit b0dfcf4a32
No known key found for this signature in database
2 changed files with 2 additions and 16 deletions

16
src/x.c
View File

@ -16,6 +16,7 @@
#include <xcb/render.h>
#include <xcb/sync.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <xcb/xcb_renderutil.h>
#include <xcb/xfixes.h>
@ -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);

View File

@ -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`.