Ktam3874/pitx software guide – Kontron KTAM3874-pITX User Manual

Page 153

Advertising
background image

KTD-S0057-I

Page 149 Linux® Programming Examples (DebianTM)


KTAM3874/pITX Software Guide


sys->disp

=

disp;

sys->win

=

win;

sys->cmap

=

cmap;

sys->visual

=

visual;

sys->screen =

screen;

sys->gc

=

gc;

sys->font

=

font;

sys->close

=

close;

return

EXIT_SUCCESS;

}


static void destroy_X11_window (XSystem sys)
{
if

(sys.pict)

XFreePixmap (sys.disp, sys.pict);

if (sys.font != (XFontStruct *) NULL)

XFreeFont (sys.disp, sys.font);

if

(sys.gc)

XFreeGC (sys.disp, sys.gc);

if

(sys.win)

XDestroyWindow (sys.disp, sys.win);

if

(sys.cmap)

XFreeColormap (sys.disp, sys.cmap);

XCloseDisplay

(sys.disp);

}


int main (void)
{

int quit = 0;

XSystem

xsys;

XEvent

e;

cairo_t

*cr;

cairo_surface_t

*surface;

memset ((void *) &xsys, 0, sizeof (xsys));

if (create_X11_window (&xsys))

return

EXIT_FAILURE;

surface = (cairo_surface_t *) cairo_xlib_surface_create (xsys.disp, xsys.win, xsys.visual, WIDTH, HEIGHT);

if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS)

{

fprintf (stderr, "Cannot create cairo surface\n");

destroy_X11_window

(xsys);

return

EXIT_FAILURE;

}

Advertising
This manual is related to the following products: