So I have the following code, notsure if I have added too much/little but its there for conext anyway.
Window root = XCreateWindow(proc->display,
RootWindow(proc->display, screen),
0, 0, width + 500, height + 500, 0,
CopyFromParent, InputOutput,
CopyFromParent, CWEventMask, &attr);
XSetWindowBackground(proc->display, root, WhitePixel(proc->display, screen));
XFlush(proc->display);
XMapWindow(proc->display, root);
Window avaliableDevices = XCreateSimpleWindow(proc->display, root, 10, 50,
220, 650, 5, BlackPixel(proc->display, screen),
WhitePixel(proc->display, screen));
XFlush(proc->display);
XMapWindow(proc->display, avaliableDevices);
sleep(1);
XDrawString(proc->display, root, DefaultGC(proc->display, DefaultScreen(proc->display))
, 20, 20, "hello", strlen("hello"));
Window networkedDevices = XCreateSimpleWindow(proc->display, root, /* display, parent */
900, 50, /* x, y: the window manager will place the window elsewhere */
220, 650, /* width, height */
5, BlackPixel(proc->display, screen), /* border width & colour, unless you have a window manager */
WhitePixel(proc->display, screen)); /* background colour */
XDrawString(proc->display, root, DefaultGC(proc->display, DefaultScreen(proc->display))
, 920, 40, "NETWORKED DEVICES", strlen("NETWORKED DEVICES"));
The problem I am having is that without the sleep(1), the string will not get drawn on the screen, slightly confused as to why any ideas?
The first time i call it, it needs a sleep but the second time it is fine :/