+\begin{slide}[method=direct]{Xlib-Beispielcode}
+\begin{code}
+ char *names[10] = {"_NET_SUPPORTED", "_NET_WM_STATE",
+ "_NET_WM_STATE_FULLSCREEN", "_NET_WM_NAME" /* ... */};
+ Atom atoms[10];
+
+ /* Get atoms */
+ for (int i = 0; i < 10; i++) {
+ atoms[i] = XInternAtom(display, names[i], 0);
+ }
+\end{code}
+\end{slide}
+
+\begin{slide}[method=direct]{XCB-Beispielcode}
+\begin{code}
+char *names[10] = {"_NET_SUPPORTED", "_NET_WM_STATE",
+ "_NET_WM_STATE_FULLSCREEN", "_NET_WM_NAME" /* ... */};
+xcb_intern_atom_cookie_t cookies[10];
+
+/* Place requests for atoms as soon as possible */
+for (int c = 0; c < 10; c++)
+ xcb_intern_atom(connection, 0, strlen(names[c]), names[c]);
+
+/* Do other stuff here */
+load_configuration();
+
+/* Get atoms */
+for (int c = 0; c < 10; c++) {
+ xcb_intern_atom_reply_t *reply =
+ xcb_intern_atom_reply(connection, cookies[c], NULL);
+ if (!reply) {
+ fprintf(stderr, "Could not get atom\n");
+ exit(-1);
+ }
+ printf("atom has ID %d\n", reply->atom);
+ free(reply);
+}
+\end{code}
+\end{slide}
+