looking for critic/advice

First Last <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Hi guys,
I try to writte a small clock application in C. I have 3 files yet, functions.h, functions.c, main.c. I'm using a structure wich contains a cairo_tand a cairo_surface_tthat I need to update during the running of the application. For having this I'm using a structure defined in function.h, I'm a little suspicious about how I use this structure, I do some cast ( (*_mc)) but I'm not sure that's well written, (I never written something so funky...), could you just take a look and told me if it's correct. gcc doesn't complains, and I don't get any runtime error, so I'm just looking for a critic or an advice.

functions.hhas :

<...>
typedef struct clockStruc{
        cairo_t                 *c;
        cairo_surface_t         *s;

}CLOCKSTRUC;

<...>

functions.c has :

<...>
#include<cairo.h>
#include<cairo-xlib.h>
#include<time.h>

#include"functions.h"
<...>

void cairoClock(CLOCKSTRUC *_mc, <...> , int _x, int _y, int _sizex, int _sizey){
        <...>

        (* _mc).s=cairo_xlib_surface_create(_dpy, wpnl, DefaultVisual(_dpy, 0), _sizex, _sizey);
        (* _mc).c=cairo_create((*_mc).s);

        cairo_rectangle((*_mc).c,0,0,_sizex,_sizey);
        cairo_set_source_rgba((*_mc).c, 0.5, 0., 0., 1.); // nicoo : rouge, temporaire....
        cairo_fill((*_mc).c);
}

<...>

main.c has :

<...>

#include"functions.h"
<...>

int main(int argc, char *argv[]){
        <...>

        CLOCKSTRUC myClock;

        <...>

        cairoClock(&myClock, dpy,scr,panelv,5,5,BAR2X-10,34);
        <...>
}

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.