Switch XComposite initialisation to XCB

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2018-09-28 19:13:53 +02:00
parent 8064eaaa37
commit 2f49f6f03d
2 changed files with 13 additions and 7 deletions

View File

@ -9,7 +9,7 @@ MANDIR ?= $(PREFIX)/share/man/man1
APPDIR ?= $(PREFIX)/share/applications APPDIR ?= $(PREFIX)/share/applications
ICODIR ?= $(PREFIX)/share/icons/hicolor/ ICODIR ?= $(PREFIX)/share/icons/hicolor/
PACKAGES = x11 x11-xcb xcb-renderutil xcb-render xcb-damage xcb-randr xcb-composite xcb-image xcomposite xfixes xext PACKAGES = x11 x11-xcb xcb-renderutil xcb-render xcb-damage xcb-randr xcb-composite xcb-image xfixes xext
LIBS = -lm -lrt LIBS = -lm -lrt
INCS = INCS =

View File

@ -5362,6 +5362,7 @@ session_init(session_t *ps_old, int argc, char **argv) {
ps->root_height = DisplayHeight(ps->dpy, ps->scr); ps->root_height = DisplayHeight(ps->dpy, ps->scr);
xcb_prefetch_extension_data(c, &xcb_render_id); xcb_prefetch_extension_data(c, &xcb_render_id);
xcb_prefetch_extension_data(c, &xcb_composite_id);
xcb_prefetch_extension_data(c, &xcb_damage_id); xcb_prefetch_extension_data(c, &xcb_damage_id);
xcb_prefetch_extension_data(c, &xcb_randr_id); xcb_prefetch_extension_data(c, &xcb_randr_id);
@ -5373,21 +5374,26 @@ session_init(session_t *ps_old, int argc, char **argv) {
ps->render_event = ext_info->first_event; ps->render_event = ext_info->first_event;
ps->render_error = ext_info->first_error; ps->render_error = ext_info->first_error;
if (!XQueryExtension(ps->dpy, COMPOSITE_NAME, &ps->composite_opcode, ext_info = xcb_get_extension_data(c, &xcb_composite_id);
&ps->composite_event, &ps->composite_error)) { if (!ext_info || !ext_info->present) {
fprintf(stderr, "No composite extension\n"); fprintf(stderr, "No composite extension\n");
exit(1); exit(1);
} }
ps->composite_opcode = ext_info->major_opcode;
ps->composite_event = ext_info->first_event;
ps->composite_error = ext_info->first_error;
{ {
int composite_major = 0, composite_minor = 0; xcb_composite_query_version_reply_t *reply =
xcb_composite_query_version_reply(c,
XCompositeQueryVersion(ps->dpy, &composite_major, &composite_minor); xcb_composite_query_version(c, XCB_COMPOSITE_MAJOR_VERSION, XCB_COMPOSITE_MINOR_VERSION),
NULL);
if (!ps->o.no_name_pixmap if (!ps->o.no_name_pixmap
&& (composite_major > 0 || composite_minor >= 2)) { && reply && (reply->major_version > 0 || reply->minor_version >= 2)) {
ps->has_name_pixmap = true; ps->has_name_pixmap = true;
} }
free(reply);
} }
ext_info = xcb_get_extension_data(c, &xcb_damage_id); ext_info = xcb_get_extension_data(c, &xcb_damage_id);