#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Xatom.h>
int main(int argc, char** argv)
{
sleep(3);
XSetWindowAttributes winattrs;
int swidth;
int sheight;
int winmask;
Display *display;
int screen;
Window window;
display = XOpenDisplay(getenv("DISPLAY"));
screen = DefaultScreen(display);
swidth = DisplayWidth(display, screen) ;
sheight = DisplayHeight(display, screen);
window = XCreateSimpleWindow(display, XDefaultRootWindow(display),
0, 0, swidth, sheight, 0, 0, 0);
winattrs.override_redirect = True;
winmask = CWOverrideRedirect;
XChangeWindowAttributes(display, window, winmask, &winattrs);
//
XSelectInput(display, window, ExposureMask/*|KeyPressMask*/|ButtonPressMask
|StructureNotifyMask);
GC gc;
unsigned long valuemask = 0;
XGCValues values;
gc = XCreateGC(display, window, valuemask, &values);
XMapWindow(display, window);
const char *strdraw = "Hello, World";
while(1)
{
XEvent event;
XNextEvent(display, &event);
switch(event.type)
{
case Expose:
if(event.xexpose.count != 0) break;
XDrawString(display, window, gc, 10, 10, strdraw, strlen(strdraw));
break;
case ButtonPress:
case KeyPress:
XFreeGC(display, gc);
XCloseDisplay(display);
return 0;
default:
break;
}
}
return (EXIT_SUCCESS);
}