xcb_damage_create requires application to call xcb_damage_query_version() first
Code
#include <cstdio>
#include <X11/Xlib-xcb.h>
#include <X11/extensions/Xdamage.h>
#include <xcb/xcb.h>
#include <xcb/damage.h>
#define XCB 1
int main (int argc, char **argv) {
Display* dpy = XOpenDisplay(nullptr);
#if !XCB
XDamageCreate(dpy, RootWindow(dpy, 0), XDamageReportRawRectangles);
#else
xcb_connection_t* conn = XGetXCBConnection(dpy);
xcb_request_check(conn, xcb_damage_create_checked(conn, xcb_generate_id(conn),
xcb_setup_roots_iterator(xcb_get_setup(conn)).data->root, XCB_DAMAGE_REPORT_LEVEL_RAW_RECTANGLES));
#endif
while(true) {
#if XCB
xcb_wait_for_event(conn);
#else
XEvent e;
XNextEvent(dpy, &e);
#endif
printf("damage\n");
}
return 1;
}
I realize that my code is ugly. But when I switch XCB definition to 0 everything works as expected.
I am not the only one who noticed that: 1, 2.
Thank you.
Edited by Twaik Yont