From 48f40df703cecb9d54b9c1d0ce2d141d0c949928 Mon Sep 17 00:00:00 2001 From: Maxim Solovyov Date: Sat, 19 Oct 2024 00:06:33 +0300 Subject: [PATCH] utils/process: initialize the used x extensions --- src/utils/process.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/utils/process.c b/src/utils/process.c index 2f7dd4dd1d..144dc9fa27 100644 --- a/src/utils/process.c +++ b/src/utils/process.c @@ -51,8 +51,30 @@ int spawn_picomling(struct x_connection *c) { setsid(); x_connection_init_xcb(c, new_c, screen); - xcb_prefetch_extension_data(c->c, &xcb_render_id); + xcb_prefetch_extension_data(c->c, &xcb_randr_id); + xcb_prefetch_extension_data(c->c, &xcb_render_id); + + // Initialize the X RandR extension. + auto extension = xcb_get_extension_data(c->c, &xcb_randr_id); + if (!extension || !extension->present) { + log_error("The X server doesn't have the X RandR extension."); + + return -1; + } + + c->e.has_randr = true; + c->e.randr_event = extension->first_event; + + // Initialize the X Render extension. + extension = xcb_get_extension_data(c->c, &xcb_render_id); + if (!extension || !extension->present) { + log_error("The X server doesn't have the X Render extension."); + + return -1; + } + + c->e.render_error = extension->first_error; return 0; }