[Xcb] A simple question on XCBGCFunction (when value[0] = XCBGXxor)

Osmo Maatta osmoma at gmail.com
Thu May 18 02:04:51 PDT 2006


I try to create a GC (graphic context) to draw some rubber lines using 
the XOR pen.

I do this:

  XCBGCONTEXT    sel_rect;

  sel_rect = XCBGCONTEXTNew (c);
  mask =   XCBGCFunction | XCBGCForeground | XCBGCLineStyle | 
  values[0] = XCBGXxor; 
  values[1] = screen->black_pixel;
  values[2] = XCBLineStyleOnOffDash;
  values[3] = 0;
  XCBCreateGC (c, sel_rect,  win, mask, values);

and later in

case XCBExpose:
     printf("Debug expose\n");

     XCBPolyRectangle (c, win, sel_rect, 2, rectangles);
     XCBPolyLine (c, CoordModeOrigin, win, sel_rect, 4, polyline);

But it does not draw anything. Only the debug line appears on the console.

I have even tried with  XCBGXcopy  value as XCBGCFunction.

 values[0] = XCBGXcopy; 

Xlib manual says that GXcopy is the default GCFunction. I suppose it's 
the same in XCB.
But it does not work.

It works (draws lines in a window) if I remove XCBGCFunction from the 
mask and remove the value[0]= line. 

How to use the values for XCBGCFunction mask ?

I follow this tutorial

Many TIA.

More information about the Xcb mailing list