aboutsummaryrefslogtreecommitdiff
path: root/backend/x11
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-02-23 08:20:00 -0500
committerGitHub <noreply@github.com>2018-02-23 08:20:00 -0500
commitc2df2801a58eea3d545014bc864d5d259b596e58 (patch)
tree745c0440f6ca9ea01c1e524a8e7939bf767aad38 /backend/x11
parent5ad15c90d507b9658f2917588b6e1bcf33c4615f (diff)
parent9716aa9b9247e7af08f4887fec494dcb9a918d9d (diff)
Merge pull request #658 from agx/x11-vendor
x11: parse vendor and model out of xcb setup information
Diffstat (limited to 'backend/x11')
-rw-r--r--backend/x11/backend.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/backend/x11/backend.c b/backend/x11/backend.c
index 65eb0094..8633ece3 100644
--- a/backend/x11/backend.c
+++ b/backend/x11/backend.c
@@ -188,6 +188,17 @@ static void init_atom(struct wlr_x11_backend *x11, struct wlr_x11_atom *atom,
atom->reply = xcb_intern_atom_reply(x11->xcb_conn, atom->cookie, NULL);
}
+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);
+
+ snprintf(output->make, sizeof(output->make), "%.*s",
+ xcb_setup_vendor_length(xcb_setup),
+ xcb_setup_vendor(xcb_setup));
+ snprintf(output->model, sizeof(output->model), "%"PRIu16".%"PRIu16,
+ xcb_setup->protocol_major_version,
+ xcb_setup->protocol_minor_version);
+}
+
static bool wlr_x11_backend_start(struct wlr_backend *backend) {
struct wlr_x11_backend *x11 = (struct wlr_x11_backend *)backend;
struct wlr_x11_output *output = &x11->output;
@@ -207,6 +218,7 @@ static bool wlr_x11_backend_start(struct wlr_backend *backend) {
wlr_output_init(&output->wlr_output, &x11->backend, &output_impl,
x11->wl_display);
snprintf(output->wlr_output.name, sizeof(output->wlr_output.name), "X11-1");
+ parse_xcb_setup(&output->wlr_output, x11->xcb_conn);
output->win = xcb_generate_id(x11->xcb_conn);
xcb_create_window(x11->xcb_conn, XCB_COPY_FROM_PARENT, output->win,