<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">There are a couple of ways to avoid this type of error.<DIV><BR class="khtml-block-placeholder"></DIV><DIV>First, you could fill in the values array during declaration:</DIV><BR><DIV>CARD32 mask = XCBGCFunction/*0*/      | XCBGCForeground/*2*/   | </DIV><DIV>                 XCBGCBackground/*3*/ | XCBGCLineWidth/*4*/      | </DIV><DIV>                XCBGCLineStyle/*5*/       | XCBGCGraphicsExposures/*16*/;</DIV><DIV>CARD32 values[] = {</DIV><DIV>        XCBGXxor,                      // XCBGCFunction </DIV><DIV>        screen-&gt;white_pixel,     // XCBGCForeground </DIV><DIV>        0x1ecf48,                        // XCBGCBackground (light green) </DIV><DIV>        1,                                     // XCBGCLineWidth </DIV><DIV>        XCBLineStyleOnOffDash,  // XCBGCLineStyle </DIV><DIV>        0                                         // XCBGCGraphicsExposures </DIV><DIV>};</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Second, there are some convenience structures and functions</DIV><DIV>in the XCBaux library that replace the value lists with structures:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>#include &lt;X11/XCB/xcb_aux.h&gt;</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>XCBParamsGC params;</DIV><DIV>params.function = XCBGXxor;</DIV><DIV>params.foreground = screen-&gt;white_pixel;</DIV><DIV>params.background = 0x1ecf48;</DIV><DIV>params.line_width = 1;</DIV><DIV>params.line_style = XCBLineStyleOnOffDash;</DIV><DIV>params.graphics_exposures = 0;</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>XCBAuxCreateGC(c, sel_rect, win, mask, &amp;params);</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>This method also avoids errors due to incorrect ordering</DIV><DIV>of the value list.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Ian</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>PS.  What the heck is up with the mailing list server on freedesktop??</DIV><DIV>This and a few other messages were posted almost a month ago!</DIV><DIV><BR><DIV><DIV>On May 18, 2006, at 6:48 AM, Osmo Maatta wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"> Problem solved.<BR> <BR> The "values[]" variable was too small to store all values.<BR> <STRIKE>  CARD32   values[2];   <BR> <BR> </STRIKE>  CARD32   values[10];   <BR> <BR> Thanks.<BR> <BR> -------------------------------------------------------------<BR> This code is OK.<BR> <BR> <BR> sel_rect = XCBGCONTEXTNew (c); <BR> <BR> mask = XCBGCFunction/*0*/      | XCBGCForeground/*2*/   | <BR>              XCBGCBackground/*3*/ | XCBGCLineWidth/*4*/      | <BR>             XCBGCLineStyle/*5*/       | XCBGCGraphicsExposures/*16*/; <BR> <BR> // In same order as the mask. <BR> values[0] = XCBGXxor;                      // XCBGCFunction <BR> values[1] = screen-&gt;white_pixel;     // XCBGCForeground <BR> values[2] = 0x1ecf48;                        // XCBGCBackground (light green) <BR> values[3] = 1;                                     // XCBGCLineWidth <BR> values[4] = XCBLineStyleOnOffDash;  // XCBGCLineStyle <BR> values[5] = 0;                                         // XCBGCGraphicsExposures <BR> <BR> XCBCreateGC (c, sel_rect, win, mask, values); <BR> ....<BR> <BR> // Draw using the XOR (XCBGXxor) pen. <BR> <BR> case XCBExpose: <BR>   { <BR>     XCBPolyLine (c, CoordModeOrigin, win, sel_rect, 4, polyline); <BR>     XCBPolyRectangle (c, win, sel_rect, 2, rectangles); <BR> <BR>     XCBSync (c, 0); <BR> <BR>     break; <BR>   } <BR> <BR> case XCBButtonPress: <BR>  { <BR>     // Each second click will make the lines visible (XOR'ing pixels).<BR>     XCBPolyLine (c, CoordModeOrigin, win, sel_rect, 4, polyline); <BR>     XCBPolyRectangle (c, win, sel_rect, 2, rectangles); <BR>  } <BR> <BR> ...<BR> <BR> <BR> <BR> <BR> Osmo Maatta wrote: <BLOCKQUOTE cite="mid446C38B3.7010606@gmail.com" type="cite">Hello, <BR>  <BR> I try to create a GC (graphic context) to draw some rubber lines using the XOR pen. <BR>  <BR> I do this: <BR>  <BR>  XCBGCONTEXT    sel_rect; <BR>  .... <BR>  <BR>  sel_rect = XCBGCONTEXTNew (c); <BR>  mask =   XCBGCFunction | XCBGCForeground | XCBGCLineStyle | XCBGCGraphicsExposures; <BR>  values[0] = XCBGXxor;  values[1] = screen-&gt;black_pixel; <BR>  values[2] = XCBLineStyleOnOffDash; <BR>  values[3] = 0; <BR>  XCBCreateGC (c, sel_rect,  win, mask, values); <BR>  <BR>  <BR> and later in <BR>  <BR> case XCBExpose: <BR> { <BR>     printf("Debug expose\n"); <BR>  <BR>     XCBPolyRectangle (c, win, sel_rect, 2, rectangles); <BR>           XCBPolyLine (c, CoordModeOrigin, win, sel_rect, 4, polyline);  <BR>  <BR>     break; <BR> } <BR> --------------------------------- <BR>   But it does not draw anything. Only the debug line appears on the console. <BR> ------------------- <BR>  <BR> I have even tried with  XCBGXcopy  value as XCBGCFunction. <BR>  <BR> values[0] = XCBGXcopy; <BR> Xlib manual says that GXcopy is the default GCFunction. I suppose it's the same in XCB. <BR> But it does not work. <BR>  <BR> It works (draws lines in a window) if I remove XCBGCFunction from the mask and remove the value[0]= line. <BR> How to use the values for XCBGCFunction mask ? <BR> ------------------------------------------------------------------- <BR>  <BR> I follow this tutorial <BR>  <A class="moz-txt-link-freetext" href="http://www.iecn.u-nancy.fr/%7Etorri/files/xcb/doc/">http://www.iecn.u-nancy.fr/~torri/files/xcb/doc/</A>  <BR>  <BR> Many TIA. <BR>  Osmo <BR>  <BR> _______________________________________________ <BR> Xcb mailing list <BR>  <A class="moz-txt-link-abbreviated" href="mailto:Xcb@lists.freedesktop.org">Xcb@lists.freedesktop.org</A> <BR>  <A class="moz-txt-link-freetext" href="http://lists.freedesktop.org/mailman/listinfo/xcb">http://lists.freedesktop.org/mailman/listinfo/xcb</A>  <BR>  <BR> </BLOCKQUOTE> <BR> <BR><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Xcb mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:Xcb@lists.freedesktop.org">Xcb@lists.freedesktop.org</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://lists.freedesktop.org/mailman/listinfo/xcb">http://lists.freedesktop.org/mailman/listinfo/xcb</A></DIV> </BLOCKQUOTE></DIV><BR></DIV></BODY></HTML>