test23.c - ltkx - GUI toolkit for X11 (old)
HTML git clone git://lumidify.org/ltkx.git (fast, but not encrypted)
HTML git clone https://lumidify.org/ltkx.git (encrypted, but very slow)
HTML git clone git://4kcetb7mo7hj6grozzybxtotsub5bempzo4lirzc3437amof2c2impyd.onion/ltkx.git (over tor)
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
test23.c (1625B)
---
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stdint.h>
4 #include <X11/Xlib.h>
5 #include <X11/Xutil.h>
6 #include <X11/Xos.h>
7 #include <X11/extensions/Xrender.h>
8
9 int main(int argc, const char * argv[])
10 {
11 Display *display;
12 int screen;
13 Window window;
14 GC gc;
15
16 unsigned long black, white;
17 Colormap colormap;
18 display = XOpenDisplay((char *)0);
19 screen = DefaultScreen(display);
20 colormap = DefaultColormap(display, screen);
21 black = BlackPixel(display, screen);
22 white = WhitePixel(display, screen);
23 window = XCreateSimpleWindow(display, DefaultRootWindow(display), 0, 0, 1366, 512, 0, black, white);
24 XSetStandardProperties(display, window, "Random Window", NULL, None, NULL, 0, NULL);
25 XSelectInput(display, window, ExposureMask|ButtonPressMask|KeyPressMask);
26 gc = XCreateGC(display, window, 0, 0);
27 XSetBackground(display, gc, black);
28 XSetForeground(display, gc, black);
29 XClearWindow(display, window);
30 XMapRaised(display, window);
31
32 Picture pic = XRenderCreatePicture(display, window, XRenderFindStandardFormat(display, PictStandardRGB24), 0, 0);
33
34 XEvent event;
35 KeySym key;
36 char text[255];
37
38 while(1)
39 {
40 XNextEvent(display, &event);
41 if (event.type == KeyPress && XLookupString(&event.xkey, text, 255, &key, 0) == 1)
42 {
43 if (text[0] == 'q')
44 {
45 XFreeGC(display, gc);
46 XFreeColormap(display, colormap);
47 XDestroyWindow(display, window);
48 XCloseDisplay(display);
49 exit(0);
50 }
51 }
52 }
53
54 return 0;
55 }