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

KTD-S0057-I
Page 150 Linux® Programming Examples (DebianTM)
KTAM3874/pITX Software Guide
cr = cairo_create (surface);
if (cairo_status (cr) != CAIRO_STATUS_SUCCESS)
{
fprintf (stderr, "Cannot create cairo context\n");
cairo_surface_destroy
(surface);
destroy_X11_window
(xsys);
return
EXIT_FAILURE;
}
while (! quit)
{
XNextEvent (xsys.disp, &e);
if ((e.type == ClientMessage && (Atom) (e.xclient.data.l[0]) == xsys.close) || (e.type == ButtonPress))
quit = TRUE;
else if (e.type == ConfigureNotify)
{
if (e.xconfigure.width != WIDTH || e.xconfigure.height != HEIGHT)
cairo_xlib_surface_set_size
(surface, e.xconfigure.width, e.xconfigure.height);
}
else if (e.type == Expose)
{
draw_x11_object
(&xsys);
cairo_surface_set_device_offset (surface, OBJ1_X, OBJ1_Y);
draw_cairo_object1 (xsys, cr);
cairo_surface_set_device_offset (surface, OBJ2_X, OBJ2_Y);
draw_cairo_object2 (xsys, cr);
cairo_surface_set_device_offset (surface, OBJ3_X, OBJ3_Y);
draw_cairo_object3 (xsys, cr);
cairo_surface_set_device_offset (surface, OBJ4_X, OBJ4_Y);
draw_cairo_object4 (xsys, cr);
cairo_surface_set_device_offset (surface, OBJ5_X, OBJ5_Y);
draw_cairo_object5 (xsys, cr);
cairo_surface_set_device_offset (surface, OBJ6_X, OBJ6_Y);
draw_cairo_object6 (xsys, cr);
draw_x11_status_bar
(xsys);
}
}
cairo_destroy
(cr);
cairo_surface_destroy
(surface);
destroy_X11_window
(xsys);
return
EXIT_SUCCESS;
}