<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">I'm forwarding this to the rest of the list for opinions.<DIV><BR class="khtml-block-placeholder"></DIV><DIV>This removal of duplication is not an easy problem. We are tackling the same problem for cairo's XCB and Xlib backends. Jamey has a repository for this work. Perhaps you could examine it for ideas.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV> <A href="http://gitweb.freedesktop.org/?p=users/jamey/cairo;a=summary">http://gitweb.freedesktop.org/?p=users/jamey/cairo;a=summary</A></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Ian<BR><DIV><BR><DIV>Begin forwarded message:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><B>From: </B></FONT><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">"Yang JianJun" <<A href="mailto:supermaper@gmail.com">supermaper@gmail.com</A>></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><B>Date: </B></FONT><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">November 1, 2006 4:25:50 AM PST</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><B>To: </B></FONT><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><A href="mailto:iano@quirkster.com">iano@quirkster.com</A></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><B>Subject: </B></FONT><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><B>how to avoid duplicating codes on xft-xcb porting? thanks</B></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV> Hi Ian,<BR><BR> Sorry to interrupt you.<BR><BR>I think it is inevitability to duplicate the code of some source files(not all) in Xft, because the XCB functions should have different names than the X functions. Is that?<BR> <BR>For example, in Xftextent.c, each function should be renamed, and there is also a little difference in implementation between xlib and xcb.<BR><BR>as for XftGlyphExtents, the original function is:<BR>XftGlyphExtents (Display *dpy, ..., XGlyphInfo *extents) <BR>{<BR> ...<BR> x += xftg->metrics.xOff;<BR> y += xftg->metrics.yOff;<BR> ...<BR><BR> ...<BR> extents->xOff = x;<BR> extents->yOff = y;<BR> ...<BR>} <BR><BR>while the xcb one: <BR>xcb_ft_glyph_extents (xcb_connection_t *dpy, ...,xcb_render_glyphinfo_t *extents); <BR>{<BR> ...<BR> x += xftg->metrics.x_off;<BR> y += xftg->metrics.y_off;<BR> ...<BR> <BR> ... <BR> extents->x_off = x;<BR> extents->y_off = y;<BR> ... <BR>} <BR><BR>It is not reasonable if all the xlib funcs and xcb funcs are put together in xftextent.c . Then the xcb funcs should be put into a new source file named xftextent-xcb.c? If so, a large amount of codes actually are duplicated. Is there any other way?<BR><BR>There are still some funcs whose prototype are different but implmentation are identical between xlib and xcb, how to deal with them? <BR><BR>In addition, the struct which is defined differently between xlib and xcb should also be renamed? for example:<BR> <BR>typedef struct _XftColor {<BR> unsigned long pixel;<BR> XRenderColor color;<BR>} XftColor; <BR><BR>typedef struct _xcb_ft_color {<BR> unsigned long pixel;<BR> xcb_render_color_t color;<BR>} xcb_ft_color;<BR><BR><BR>By the way, I have report a bug asking for an account,<A href="https://bugs.freedesktop.org/show_bug.cgi?id=8825"> https://bugs.freedesktop.org/show_bug.cgi?id=8825</A>,<BR>but the status is still NEW. Is any problem about the bug?<BR><BR>Thanks in advance!<BR><BR>Jianjun<BR><BR><BR><BR></BLOCKQUOTE></DIV><BR></DIV></BODY></HTML>