misc: make use of the xcb-aux library

This commit is contained in:
Daniel Eklöf 2019-01-19 18:46:20 +01:00
parent 9d5bbe0566
commit dff3104c85
5 changed files with 17 additions and 40 deletions

View file

@ -11,6 +11,7 @@
#include <sys/un.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <i3/ipc.h>
#include <json-c/json_tokener.h>
@ -384,8 +385,7 @@ run(struct module *mod)
return 1;
}
const xcb_setup_t *setup = xcb_get_setup(conn);
xcb_screen_t *screen = xcb_setup_roots_iterator(setup).data;
xcb_screen_t *screen = xcb_aux_get_screen(conn, default_screen);
xcb_atom_t atom = get_atom(conn, "I3_SOCKET_PATH");
assert(atom != XCB_ATOM_NONE);

View file

@ -614,8 +614,9 @@ static int
run(struct module *mod)
{
xcb_connection_t *conn = xcb_connect(NULL, NULL);
if (conn == NULL) {
if (xcb_connection_has_error(conn) > 0) {
LOG_ERR("failed to connect to X server");
xcb_disconnect(conn);
return EXIT_FAILURE;
}

View file

@ -10,6 +10,7 @@
#include <poll.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <xcb/xcb_event.h>
#define LOG_MODULE "xwindow"
@ -204,8 +205,7 @@ run(struct module *mod)
return 1;
}
const xcb_setup_t *setup = xcb_get_setup(m->conn);
xcb_screen_t *screen = xcb_setup_roots_iterator(setup).data;
xcb_screen_t *screen = xcb_aux_get_screen(m->conn, default_screen);
m->root_win = screen->root;
/* Need a window(?) to be able to process events */