summaryrefslogtreecommitdiff
path: root/xlib-tutorial/prog-1.cc
diff options
context:
space:
mode:
authornasr <nsrddyn@gmail.com>2026-01-28 13:13:40 +0100
committernasr <nsrddyn@gmail.com>2026-01-28 13:13:40 +0100
commit3913d1778318cd0c6bfb871148d38abb33ec7fd3 (patch)
tree917728adbf32c877ad591ad9d42f727cc7540b9b /xlib-tutorial/prog-1.cc
parent7dead79e05e03a71a502ca4e75d05d126ff9f25c (diff)
checkpoint
Diffstat (limited to 'xlib-tutorial/prog-1.cc')
-rw-r--r--xlib-tutorial/prog-1.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/xlib-tutorial/prog-1.cc b/xlib-tutorial/prog-1.cc
new file mode 100644
index 0000000..3ba596b
--- /dev/null
+++ b/xlib-tutorial/prog-1.cc
@@ -0,0 +1,29 @@
1// Written by Ch. Tronche (http://tronche.lri.fr:8000/)
2// Copyright by the author. This is unmaintained, no-warranty free software.
3// Please use freely. It is appreciated (but by no means mandatory) to
4// acknowledge the author's contribution. Thank you.
5// Started on Thu Jun 26 23:29:03 1997
6
7//
8// Xlib tutorial: 1st program
9// Make a window appear on the screen.
10//
11
12#include <X11/Xlib.h> // Every Xlib program must include this
13#include <assert.h> // I include this to test return values the lazy way
14#include <unistd.h> // So we got the profile for 10 seconds
15
16#define NIL (0) // A name for the void pointer
17
18main()
19{
20 Display *dpy = XOpenDisplay(NIL);
21 assert(dpy);
22 Window w = XCreateWindow(dpy, DefaultRootWindow(dpy), 0, 0,
23 200, 100, 0,
24 CopyFromParent, CopyFromParent, CopyFromParent,
25 NIL, 0);
26 XMapWindow(dpy, w);
27 XFlush(dpy);
28 sleep(10);
29}