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

Page 123

Advertising
background image

KTD-S0057-I

Page 119 Linux® Programming Examples (DebianTM)


KTAM3874/pITX Software Guide


static int check_button (XSystem sys, XButton btn, int x, int y, int suppr)
{

if (x >= btn.rc.x && x <= btn.rc.x + btn.rc.width && y >= btn.rc.y && y <= btn.rc.y + btn.rc.height)

{

if (! suppr)

reverse_button (sys, btn);

return

EXIT_SUCCESS;

}
return

EXIT_FAILURE;

}


static void free_resources (XSystem sys)
{
if

(sys.pict)

XFreePixmap (sys.disp, sys.pict);

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

XFreeFont (sys.disp, sys.font1);

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

XFreeFont (sys.disp, sys.font2);

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)
{
Display

*disp;

XVisualInfo

vinfo;

Visual

*visual;

int depth, screen,

quit = 0,

curbtn = 0,

suppress = 0;

Colormap

cmap;

XSetWindowAttributes

wa;

Window

win;

GC

gc;

XColor col, backgnd;

XColor backcol, linecol;

XFontStruct *font1, *font2;

XCharStruct

tsize;

XSizeHints

sh;

XTextProperty

name;

Atom

closeatom;

Advertising
This manual is related to the following products: