diff options
author | Scott Anderson <scott@anderso.nz> | 2018-11-11 11:48:45 +1300 |
---|---|---|
committer | Scott Anderson <scott@anderso.nz> | 2018-11-13 10:39:24 +1300 |
commit | 51a283cbe4a77d11853f7779eb1aa452557846d3 (patch) | |
tree | 534bab245c9a781d1a9b12633ac7e9e570af9171 | |
parent | 4aff85cc8e6f90e60522a7a830424e41a6f06b77 (diff) |
backend/x11: Rename xcb_conn to xcb
When the Xlib connection is removed, this _conn suffix is going to be
pointless. I'm removing this preemtively for that.
-rw-r--r-- | backend/x11/backend.c | 34 | ||||
-rw-r--r-- | backend/x11/input_device.c | 4 | ||||
-rw-r--r-- | backend/x11/output.c | 28 | ||||
-rw-r--r-- | include/backend/x11.h | 2 |
4 files changed, 34 insertions, 34 deletions
diff --git a/backend/x11/backend.c b/backend/x11/backend.c index cd7986a0..a9914879 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -81,7 +81,7 @@ static int x11_event(int fd, uint32_t mask, void *data) { } xcb_generic_event_t *e; - while ((e = xcb_poll_for_event(x11->xcb_conn))) { + while ((e = xcb_poll_for_event(x11->xcb))) { handle_x11_event(x11, e); free(e); } @@ -123,13 +123,13 @@ static bool backend_start(struct wlr_backend *backend) { }; for (size_t i = 0; i < sizeof(atom) / sizeof(atom[0]); ++i) { - atom[i].cookie = xcb_intern_atom(x11->xcb_conn, + atom[i].cookie = xcb_intern_atom(x11->xcb, true, strlen(atom[i].name), atom[i].name); } for (size_t i = 0; i < sizeof(atom) / sizeof(atom[0]); ++i) { xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply( - x11->xcb_conn, atom[i].cookie, NULL); + x11->xcb, atom[i].cookie, NULL); if (reply) { *atom[i].atom = reply->atom; @@ -140,29 +140,29 @@ static bool backend_start(struct wlr_backend *backend) { } // create a blank cursor - xcb_pixmap_t pix = xcb_generate_id(x11->xcb_conn); - xcb_create_pixmap(x11->xcb_conn, 1, pix, x11->screen->root, 1, 1); + xcb_pixmap_t pix = xcb_generate_id(x11->xcb); + xcb_create_pixmap(x11->xcb, 1, pix, x11->screen->root, 1, 1); - x11->cursor = xcb_generate_id(x11->xcb_conn); - xcb_create_cursor(x11->xcb_conn, x11->cursor, pix, pix, 0, 0, 0, 0, 0, 0, + x11->cursor = xcb_generate_id(x11->xcb); + xcb_create_cursor(x11->xcb, x11->cursor, pix, pix, 0, 0, 0, 0, 0, 0, 0, 0); - xcb_free_pixmap(x11->xcb_conn, pix); + xcb_free_pixmap(x11->xcb, pix); #if WLR_HAS_XCB_XKB const xcb_query_extension_reply_t *reply = - xcb_get_extension_data(x11->xcb_conn, &xcb_xkb_id); + xcb_get_extension_data(x11->xcb, &xcb_xkb_id); if (reply != NULL && reply->present) { x11->xkb_base_event = reply->first_event; x11->xkb_base_error = reply->first_error; xcb_xkb_use_extension_cookie_t cookie = xcb_xkb_use_extension( - x11->xcb_conn, XCB_XKB_MAJOR_VERSION, XCB_XKB_MINOR_VERSION); + x11->xcb, XCB_XKB_MAJOR_VERSION, XCB_XKB_MINOR_VERSION); xcb_xkb_use_extension_reply_t *reply = - xcb_xkb_use_extension_reply(x11->xcb_conn, cookie, NULL); + xcb_xkb_use_extension_reply(x11->xcb, cookie, NULL); if (reply != NULL && reply->supported) { x11->xkb_supported = true; - xcb_xkb_select_events(x11->xcb_conn, + xcb_xkb_select_events(x11->xcb, XCB_XKB_ID_USE_CORE_KBD, XCB_XKB_EVENT_TYPE_STATE_NOTIFY, 0, @@ -210,7 +210,7 @@ static void backend_destroy(struct wlr_backend *backend) { wlr_egl_finish(&x11->egl); if (x11->cursor) { - xcb_free_cursor(x11->xcb_conn, x11->cursor); + xcb_free_cursor(x11->xcb, x11->cursor); } if (x11->xlib_conn) { XCloseDisplay(x11->xlib_conn); @@ -258,15 +258,15 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display, goto error_x11; } - x11->xcb_conn = XGetXCBConnection(x11->xlib_conn); - if (!x11->xcb_conn || xcb_connection_has_error(x11->xcb_conn)) { + x11->xcb = XGetXCBConnection(x11->xlib_conn); + if (!x11->xcb || xcb_connection_has_error(x11->xcb)) { wlr_log(WLR_ERROR, "Failed to open xcb connection"); goto error_display; } XSetEventQueueOwner(x11->xlib_conn, XCBOwnsEventQueue); - int fd = xcb_get_file_descriptor(x11->xcb_conn); + int fd = xcb_get_file_descriptor(x11->xcb); struct wl_event_loop *ev = wl_display_get_event_loop(display); uint32_t events = WL_EVENT_READABLE | WL_EVENT_ERROR | WL_EVENT_HANGUP; x11->event_source = wl_event_loop_add_fd(ev, fd, events, x11_event, x11); @@ -276,7 +276,7 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display, } wl_event_source_check(x11->event_source); - x11->screen = xcb_setup_roots_iterator(xcb_get_setup(x11->xcb_conn)).data; + x11->screen = xcb_setup_roots_iterator(xcb_get_setup(x11->xcb)).data; if (!create_renderer_func) { create_renderer_func = wlr_renderer_autocreate; diff --git a/backend/x11/input_device.c b/backend/x11/input_device.c index 5b108ffb..b64151e0 100644 --- a/backend/x11/input_device.c +++ b/backend/x11/input_device.c @@ -166,9 +166,9 @@ void update_x11_pointer_position(struct wlr_x11_output *output, struct wlr_x11_backend *x11 = output->x11; xcb_query_pointer_cookie_t cookie = - xcb_query_pointer(x11->xcb_conn, output->win); + xcb_query_pointer(x11->xcb, output->win); xcb_query_pointer_reply_t *reply = - xcb_query_pointer_reply(x11->xcb_conn, cookie, NULL); + xcb_query_pointer_reply(x11->xcb, cookie, NULL); if (!reply) { return; } diff --git a/backend/x11/output.c b/backend/x11/output.c index 1ac12a8d..92eeca66 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -16,8 +16,8 @@ static int signal_frame(void *data) { } static void parse_xcb_setup(struct wlr_output *output, - xcb_connection_t *xcb_conn) { - const xcb_setup_t *xcb_setup = xcb_get_setup(xcb_conn); + xcb_connection_t *xcb) { + const xcb_setup_t *xcb_setup = xcb_get_setup(xcb); snprintf(output->make, sizeof(output->make), "%.*s", xcb_setup_vendor_length(xcb_setup), @@ -55,11 +55,11 @@ static bool output_set_custom_mode(struct wlr_output *wlr_output, const uint32_t values[] = { width, height }; xcb_void_cookie_t cookie = xcb_configure_window_checked( - x11->xcb_conn, output->win, + x11->xcb, output->win, XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, values); xcb_generic_error_t *error; - if ((error = xcb_request_check(x11->xcb_conn, cookie))) { + if ((error = xcb_request_check(x11->xcb, cookie))) { wlr_log(WLR_ERROR, "Could not set window size to %dx%d\n", width, height); free(error); @@ -84,8 +84,8 @@ static void output_destroy(struct wlr_output *wlr_output) { wl_list_remove(&output->link); wl_event_source_remove(output->frame_timer); wlr_egl_destroy_surface(&x11->egl, output->surf); - xcb_destroy_window(x11->xcb_conn, output->win); - xcb_flush(x11->xcb_conn); + xcb_destroy_window(x11->xcb, output->win); + xcb_flush(x11->xcb); free(output); } @@ -142,7 +142,7 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) { snprintf(wlr_output->name, sizeof(wlr_output->name), "X11-%d", wl_list_length(&x11->outputs) + 1); - parse_xcb_setup(wlr_output, x11->xcb_conn); + parse_xcb_setup(wlr_output, x11->xcb); uint32_t mask = XCB_CW_EVENT_MASK; uint32_t values[] = { @@ -152,8 +152,8 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) { XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_STRUCTURE_NOTIFY }; - output->win = xcb_generate_id(x11->xcb_conn); - xcb_create_window(x11->xcb_conn, XCB_COPY_FROM_PARENT, output->win, + output->win = xcb_generate_id(x11->xcb); + xcb_create_window(x11->xcb, XCB_COPY_FROM_PARENT, output->win, x11->screen->root, 0, 0, wlr_output->width, wlr_output->height, 1, XCB_WINDOW_CLASS_INPUT_OUTPUT, x11->screen->root_visual, mask, values); @@ -164,23 +164,23 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) { return NULL; } - xcb_change_property(x11->xcb_conn, XCB_PROP_MODE_REPLACE, output->win, + xcb_change_property(x11->xcb, XCB_PROP_MODE_REPLACE, output->win, x11->atoms.wm_protocols, XCB_ATOM_ATOM, 32, 1, &x11->atoms.wm_delete_window); char title[32]; if (snprintf(title, sizeof(title), "wlroots - %s", wlr_output->name)) { - xcb_change_property(x11->xcb_conn, XCB_PROP_MODE_REPLACE, output->win, + xcb_change_property(x11->xcb, XCB_PROP_MODE_REPLACE, output->win, x11->atoms.net_wm_name, x11->atoms.utf8_string, 8, strlen(title), title); } uint32_t cursor_values[] = { x11->cursor }; - xcb_change_window_attributes(x11->xcb_conn, output->win, XCB_CW_CURSOR, + xcb_change_window_attributes(x11->xcb, output->win, XCB_CW_CURSOR, cursor_values); - xcb_map_window(x11->xcb_conn, output->win); - xcb_flush(x11->xcb_conn); + xcb_map_window(x11->xcb, output->win); + xcb_flush(x11->xcb); struct wl_event_loop *ev = wl_display_get_event_loop(x11->wl_display); output->frame_timer = wl_event_loop_add_timer(ev, signal_frame, output); diff --git a/include/backend/x11.h b/include/backend/x11.h index 06803768..cc7850b1 100644 --- a/include/backend/x11.h +++ b/include/backend/x11.h @@ -38,7 +38,7 @@ struct wlr_x11_backend { bool started; Display *xlib_conn; - xcb_connection_t *xcb_conn; + xcb_connection_t *xcb; xcb_screen_t *screen; size_t requested_outputs; |