[Xcb] Fwd: how to avoid duplicating codes on xft-xcb porting? thanks

Ian Osgood iano at quirkster.com
Wed Nov 1 07:24:28 PST 2006


I'm forwarding this to the rest of the list for opinions.

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.

   http://gitweb.freedesktop.org/?p=users/jamey/cairo;a=summary

Ian

Begin forwarded message:

> From: "Yang JianJun" <supermaper at gmail.com>
> Date: November 1, 2006 4:25:50 AM PST
> To: iano at quirkster.com
> Subject: how to avoid duplicating codes on xft-xcb porting? thanks
>
> Hi Ian,
>
>  Sorry to interrupt you.
>
> 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?
>
> For example, in Xftextent.c, each function should be renamed, and  
> there is also a little difference in implementation between xlib  
> and xcb.
>
> as for XftGlyphExtents, the original function is:
> XftGlyphExtents (Display  *dpy, ..., XGlyphInfo  *extents)
> {
>     ...
>         x += xftg->metrics.xOff;
>     y += xftg->metrics.yOff;
>     ...
>
>     ...
>     extents->xOff = x;
>     extents->yOff = y;
>     ...
> }
>
> while the xcb one:
> xcb_ft_glyph_extents (xcb_connection_t    
> *dpy, ...,xcb_render_glyphinfo_t   *extents);
> {
>     ...
>     x += xftg->metrics.x_off;
>     y += xftg->metrics.y_off;
>     ...
>
>     ...
>     extents->x_off = x;
>     extents->y_off = y;
>     ...
> }
>
> 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?
>
> There are still some funcs whose prototype are different but  
> implmentation are identical between xlib and xcb, how to deal with  
> them?
>
> In addition, the struct which is defined differently between xlib  
> and xcb should also be renamed? for example:
>
> typedef struct _XftColor {
>     unsigned long   pixel;
>     XRenderColor    color;
> } XftColor;
>
> typedef struct _xcb_ft_color {
>     unsigned long               pixel;
>     xcb_render_color_t       color;
> } xcb_ft_color;
>
>
> By the way, I have report a bug asking for an account, https:// 
> bugs.freedesktop.org/show_bug.cgi?id=8825,
> but the status is still NEW. Is any problem about the bug?
>
> Thanks in advance!
>
> Jianjun
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/xcb/attachments/20061101/fac818a1/attachment.html


More information about the Xcb mailing list