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

KTD-S0057-I
Page 147 Linux® Programming Examples (DebianTM)
KTAM3874/pITX Software Guide
static void draw_x11_object (XSystem *sys)
{
XColor
col;
Pixmap
pict;
XAllocNamedColor (sys->disp, sys->cmap, PICT_FG, &col, &col);
XSetForeground (sys->disp, sys->gc, col.pixel);
XAllocNamedColor
(sys->disp,
sys->cmap, PICT_BG, &col, &col);
XSetBackground (sys->disp, sys->gc, col.pixel);
pict = XCreateBitmapFromData (sys->disp, sys->win, xbm_bits, xbm_width, xbm_height);
XCopyPlane (sys->disp, pict, sys->win, sys->gc, 0, 0, xbm_width, xbm_height, OBJ3_X, OBJ3_Y, 1);
sys->pict = pict;
}
static void draw_x11_status_bar (XSystem sys)
{
XColor
col;
XWindowAttributes
attr;
char *txt = STAT_TXT;
XGetWindowAttributes (sys.disp, sys.win, &attr);
XAllocNamedColor (sys.disp, sys.cmap, STAT_BG, &col, &col);
XSetForeground (sys.disp, sys.gc, col.pixel);
XFillRectangle (sys.disp, sys.win, sys.gc, 0, attr.height - STAT_HEIGHT, attr.width, attr.height);
XSetForeground (sys.disp, sys.gc, BlackPixel (sys.disp, sys.screen));
XDrawRectangle (sys.disp, sys.win, sys.gc, 0, attr.height - STAT_HEIGHT, attr.width, attr.height);
XSetFont
(sys.disp,
sys.gc, sys.font->fid);
XSetForeground (sys.disp, sys.gc, BlackPixel (sys.disp, sys.screen));
XSetBackground
(sys.disp, sys.gc, col.pixel);
XDrawImageString (sys.disp, sys.win, sys.gc, HALF(attr.width), attr.height - STAT_BORDER, txt, strlen (txt));
}
static int create_X11_window (XSystem *sys)
{
Display
*disp;
XVisualInfo
vinfo;
Visual
*visual;
int depth, screen;
Colormap
cmap;
XSetWindowAttributes
wa;
Window
win;
GC
gc;
XFontStruct
*font;
XSizeHints
sh;
XTextProperty
name;
Atom
close;
char *txt = HEADER;