[Xcb] Xfixes xcb problem?
Michele Comignano
comick at autistici.org
Wed Oct 28 12:22:25 PDT 2009
I'm using some xfixes extension functions noticing a strange (and not correct)
behavior. I was wondering about that so I docided to implement the same with
both xlib and xcb and compare. (the program creates a region with one
rectangle and prints the rectangles resulting after a fetchrectangles
request).
xcb version:
#include <xcb/xcb.h>
#include <xcb/xfixes.h>
#include <stdio.h>
int main(int argc, char **argv) {
int i;
xcb_rectangle_t *refresh_rects = NULL;
xcb_xfixes_fetch_region_reply_t *reply;
xcb_connection_t *c = xcb_connect(NULL, NULL);
xcb_xfixes_query_version_reply(c, xcb_xfixes_query_version(c,
XCB_XFIXES_MAJOR_VERSION, XCB_XFIXES_MINOR_VERSION), NULL);
xcb_rectangle_t r = {10, 10, 500, 500};
xcb_xfixes_region_t region = xcb_generate_id(c);
xcb_xfixes_create_region(c, region, 1, &r);
reply = xcb_xfixes_fetch_region_reply(c, xcb_xfixes_fetch_region(c,
region), NULL);
refresh_rects = xcb_xfixes_fetch_region_rectangles(reply);
for (i = 0; i < xcb_xfixes_fetch_region_rectangles_length(reply); i++) {
printf("%d) x: %d, y: %d, width: %d, height: %d\n", i,
refresh_rects[i].x, refresh_rects[i].y, refresh_rects[i].width,
refresh_rects[i].height);
}
}
output (unexpected second rectangle):
0) x: 10, y: 10, width: 500, height: 500
1) x: 0, y: 0, width: 48081, height: 1 // what is this??
xlib version:
#include <stdlib.h>
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/extensions/Xfixes.h>
int main(int argc, char **argv) {
Display *dpy = XOpenDisplay(NULL);
int xfixes_event, xfixes_error,nrects,i;
XFixesQueryExtension(dpy, &xfixes_event, &xfixes_error);
XRectangle rec = {10, 10, 500, 500};
XserverRegion reg = XFixesCreateRegion(dpy, &rec, 1);
XRectangle *rects = XFixesFetchRegion(dpy,reg,&nrects);
for (i=0; i< nrects; i++){
printf("%d) x: %d, y: %d, width: %d, height: %d\n", i,
rects[i].x,
rects[i].y,
rects[i].width,
rects[i].height);
}
}
outputs (as expected):
0) x: 10, y: 10, width: 500, height: 500
Is my xcb code wrong or what else?
--
Michele Comignano (comick)
Jabber: comick at autistici.org
Web: http://comick.playlinux.net
More information about the Xcb
mailing list