// Caller should free native pointer to rects after using it
private static final X11.XRectangle createXRects(int[] vertices) {
int rectsSize = (vertices[0]-1) << 1; // sizeof(XRectangle) = 8
Int8Pointer rects = NativeBridge.getInstance().createInt8Pointer(rectsSize, true);
int idx = 0;
for (int i = 1; i < vertices[0]; i+=4) {
X11.XRectangle r = x11.createXRectangle(rects.getElementPointer(idx));
r.set_x((short) vertices[i]);
r.set_y((short) vertices[i+1]);
r.set_width((short) (vertices[i+2]-vertices[i]+1));
r.set_height((short) (vertices[i+3]-vertices[i+1]+1));
idx += r.size();