2009-03-11 23:37:05 -04:00
|
|
|
%
|
|
|
|
% © 2009 Michael Stapelberg
|
|
|
|
%
|
|
|
|
% 2009-03-12
|
|
|
|
%
|
|
|
|
\documentclass[mode=print,paper=screen,style=jefka]{powerdot}
|
|
|
|
\usepackage[utf8]{inputenc}
|
|
|
|
\usepackage{graphicx}
|
|
|
|
\usepackage{ngerman}
|
|
|
|
\usepackage{url}
|
|
|
|
\usepackage{listings}
|
|
|
|
\newcommand{\bs}{\textbackslash}
|
|
|
|
\pdsetup{palette=white}
|
2009-03-12 12:19:19 -04:00
|
|
|
\definecolor{darkblue}{rgb}{0,0,.6}
|
|
|
|
\definecolor{darkred}{rgb}{.6,0,0}
|
|
|
|
\definecolor{darkgreen}{rgb}{0,.6,0}
|
|
|
|
\definecolor{darkgray}{gray}{.3}
|
|
|
|
\definecolor{lightblue}{rgb}{0.97,0.99,1}
|
|
|
|
|
|
|
|
\lstloadlanguages{C}
|
|
|
|
\lstdefinestyle{colors}{keywordstyle={\bf\color{darkblue}}, commentstyle={\em\color{magenta}}, stringstyle={\color{darkred}},%
|
|
|
|
emphstyle={\color{darkgray}}}
|
2009-03-11 23:37:05 -04:00
|
|
|
\lstnewenvironment{code}{%
|
2009-03-12 12:19:19 -04:00
|
|
|
\lstset{frame=single, basicstyle=\footnotesize\ttfamily, language=C, showstringspaces=false,%
|
|
|
|
style=colors, numbers=left, morekeywords={xcb_get_window_attributes_cookie_t, xcb_map_request_event_t,%
|
2009-03-12 12:56:03 -04:00
|
|
|
xcb_connection_t, xcb_get_window_attributes_reply_t, window_attributes_t, xcb_intern_atom_cookie_t,%
|
|
|
|
xcb_intern_atom_reply_t, xcb_atom_t},%
|
2009-03-12 12:19:19 -04:00
|
|
|
moreemph={xcb_get_window_attributes_reply, xcb_get_window_attributes_unchecked, manage_window,%
|
2009-03-12 12:56:03 -04:00
|
|
|
add_ignore_event, xcb_intern_atom, xcb_intern_atom_reply, fprintf, printf, free, load_configuration,%
|
|
|
|
XInternAtom, exit, strlen}}
|
2009-03-11 23:37:05 -04:00
|
|
|
}{}
|
|
|
|
\title{i3 - an improved dynamic tiling window manager}
|
|
|
|
\author{sECuRE beim NoName e.V.\\
|
|
|
|
~\\
|
|
|
|
powered by \LaTeX, of course}
|
|
|
|
\begin{document}
|
|
|
|
\maketitle
|
|
|
|
|
|
|
|
\begin{slide}{Geschichte}
|
|
|
|
\begin{list}{$\bullet$}{\itemsep=1em}
|
|
|
|
\item<1-> „All window managers suck, this one just sucks less”?
|
|
|
|
\item<2-> Desktop environment vs. window manager (GNOME, KDE, Xfce, …)
|
|
|
|
\item<3-> Stacking (e17, fluxbox, IceWM, fvwm, …) vs Tiling (dwm, wmii, xmonad, …)
|
|
|
|
\item<4-> dwm, awesome, xmonad, …: statisches Layout
|
|
|
|
\item<5-> wmii, ion: dynamisches layout
|
|
|
|
\item<6-> Problem an ion: tuomov (Lizenz, Kommunikation), Config, Look and feel
|
|
|
|
\item<7-> Probleme an wmii: Xinerama-support, Xlib, undokumentierter code, nur Spalten, keine Reihen, Kleinigkeiten (titellose Fenster)
|
|
|
|
\end{list}
|
|
|
|
\end{slide}
|
|
|
|
|
|
|
|
\begin{slide}{Screenshots!}
|
|
|
|
\centering
|
|
|
|
Drücken Sie Mod1+2 um diese Demo zu starten.
|
|
|
|
\end{slide}
|
|
|
|
|
|
|
|
\begin{slide}{Merkmale}
|
|
|
|
\begin{list}{$\bullet$}{\itemsep=1em}
|
|
|
|
\item<1-> gut lesbarer, dokumentierter Code. Dokumentation.
|
|
|
|
\item<2-> XCB anstelle von Xlib
|
|
|
|
\item<3-> Xinerama done right™
|
|
|
|
\item<4-> Spalten und Zeilen
|
|
|
|
\item<5-> command-mode, wie in vim
|
|
|
|
\item<6-> UTF-8 clean
|
|
|
|
\item<7-> kein Antialiasing, schlank und schnell bleiben
|
|
|
|
\end{list}
|
|
|
|
\end{slide}
|
|
|
|
|
2009-03-12 12:19:19 -04:00
|
|
|
\begin{slide}{Typische Kommunikation mit X}
|
|
|
|
\begin{list}{$\bullet$}{\itemsep=1em}
|
|
|
|
\item<1-> Verbindung aufbauen
|
|
|
|
\item<2-> Requests über die Leitung schicken (Fenster erzeugen)
|
|
|
|
\item<3-> Eventloop starten, reagieren (Fenster zeichnen, Eingaben, …)
|
|
|
|
\end{list}
|
|
|
|
\end{slide}
|
|
|
|
|
2009-03-11 23:37:05 -04:00
|
|
|
\begin{slide}{Was genau macht ein WM?}
|
|
|
|
\begin{list}{$\bullet$}{\itemsep=1em}
|
2009-03-12 12:19:19 -04:00
|
|
|
\item<1-> Events umlenken
|
|
|
|
\item<2-> Neue Fenster anzeigen/positionieren (MapRequest)
|
|
|
|
\item<3-> Titelleisten malen (reparenting)
|
|
|
|
\item<4-> Den Fokus verwalten
|
|
|
|
\item<5-> Mit Hints umgehen (Fenstertitel, Fullscreen, Dock, …)
|
|
|
|
\item<6-> Auf Benutzereingaben reagieren
|
2009-03-11 23:37:05 -04:00
|
|
|
\end{list}
|
|
|
|
\end{slide}
|
|
|
|
|
|
|
|
\begin{slide}{Was an X toll ist}
|
|
|
|
\begin{list}{$\bullet$}{\itemsep=1em}
|
|
|
|
\item<1-> Man hat an Window Manager gedacht (Mac OS X *hust*)
|
|
|
|
\item<2-> Netzwerk-transparent (debugging, xtrace)
|
|
|
|
\item<3-> Das Protokoll ist gut designed (Extensions möglich, simpel)
|
|
|
|
\end{list}
|
|
|
|
\end{slide}
|
|
|
|
|
2009-03-12 12:19:19 -04:00
|
|
|
\begin{slide}[method=direct]{Protokoll, Beispielcode}
|
|
|
|
\begin{code}
|
|
|
|
int handle_map_request(void *prophs, xcb_connection_t *conn,
|
|
|
|
xcb_map_request_event_t *event) {
|
|
|
|
xcb_get_window_attributes_cookie_t cookie;
|
|
|
|
xcb_get_window_attributes_reply_t *reply;
|
|
|
|
|
|
|
|
cookie = xcb_get_window_attributes_unchecked(conn, event->window);
|
|
|
|
|
|
|
|
if ((reply = xcb_get_window_attributes_reply(conn, cookie, NULL))
|
|
|
|
== NULL) {
|
|
|
|
LOG("Could not get window attributes\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
window_attributes_t wa = { TAG_VALUE };
|
|
|
|
wa.u.override_redirect = reply->override_redirect;
|
|
|
|
|
|
|
|
add_ignore_event(event->sequence);
|
|
|
|
|
|
|
|
manage_window(prophs, conn, event->window, wa);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
\end{code}
|
|
|
|
\end{slide}
|
|
|
|
|
2009-03-11 23:37:05 -04:00
|
|
|
\begin{slide}{Was an X nicht so toll ist}
|
|
|
|
\begin{list}{$\bullet$}{\itemsep=1em}
|
|
|
|
\item<1-> Einige race conditions vorhanden
|
|
|
|
\item<2-> Man kann nicht fein genug angeben, welche Events man gerne hätte
|
|
|
|
\item<3-> Xlib ist ziemlich eklig, aber es gibt ja xcb
|
|
|
|
\item<4-> Bugs: Keyboard state wird nicht richtig übermittelt
|
|
|
|
\item<5-> Ich empfehle auch: „Why X is not our ideal window system” \url{http://www.std.org/~msm/common/WhyX.pdf}
|
|
|
|
\end{list}
|
|
|
|
\end{slide}
|
|
|
|
|
|
|
|
\begin{slide}{XCB}
|
|
|
|
\begin{list}{$\bullet$}{\itemsep=1em}
|
|
|
|
\item \url{http://xcb.freedesktop.org/}
|
|
|
|
\item<1-> „X-protocol C-language Binding”
|
|
|
|
\item<2-> Klein, wartbar (aus einer Protokollbeschreibung auto-generiert)
|
|
|
|
\item<3-> Sinnvoll benannte Funktionsnamen und Datentypen
|
|
|
|
\item<4-> Threadsafe (nicht dass wir das bräuchten, aber…)
|
|
|
|
\item<5-> Nutzt die Asynchronität von X aus
|
|
|
|
\item<6-> Dokumentation? Ne, das ist was für Anfänger.
|
|
|
|
\item<7-> xcb-util: XCB noch mal ein bisschen gekapselt, nützliche Funktionen abstrahiert
|
|
|
|
\end{list}
|
|
|
|
\end{slide}
|
|
|
|
|
2009-03-12 12:56:03 -04:00
|
|
|
\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}
|
|
|
|
|
2009-03-11 23:37:05 -04:00
|
|
|
\begin{slide}{Xft}
|
|
|
|
\begin{list}{$\bullet$}{\itemsep=1em}
|
|
|
|
\item<1-> „X FreeType”, library um antialiased fonts zu benutzen
|
|
|
|
\item<2-> Benutzt man am besten mit Pango (rendert fonts) und Cairo
|
|
|
|
\item<3-> Keine Möglichkeit, pixel fonts zu benutzen („x core fonts”)
|
|
|
|
\item<4-> Was macht man (urxvt) also? Beide APIs benutzen, fallback fonts
|
|
|
|
\item<5-> Was machen wir (i3)? misc-fixed-*-iso10646!\\
|
|
|
|
ISO 10646 = Universal Character Set, selbe Zeichen wie Unicode
|
|
|
|
\item<6-> Fontconfig/xft soll wohl x core fonts ablösen :-(
|
|
|
|
\end{list}
|
|
|
|
\end{slide}
|
|
|
|
|
|
|
|
\begin{slide}{Ein paar Zahlen}
|
|
|
|
\begin{list}{$\bullet$}{\itemsep=1em}
|
|
|
|
\item<1-> 6118 Zeilen Code, Dokumentation, Website, READMEs
|
|
|
|
\item<2-> \~{} 2800 Zeilen Sourcecode
|
|
|
|
\item<3-> 73 KB groß (ohne debug symbols)
|
|
|
|
\end{list}
|
|
|
|
\end{slide}
|
|
|
|
|
|
|
|
\begin{slide}{Benutzen}
|
|
|
|
\begin{list}{$\bullet$}{\itemsep=1em}
|
|
|
|
\item git clone \url{git://code.stapelberg.de/i3}
|
|
|
|
\item Debian: cd i3; dpkg-buildpackage; sudo dpkg -i ../i3-wm*deb
|
|
|
|
\item non-Debian: cd i3; cat DEPENDS; make; sudo make install
|
|
|
|
\item in \~{}/.xsession: exec /usr/bin/i3
|
|
|
|
\item Siehe manpage i3(1)
|
|
|
|
\end{list}
|
|
|
|
\end{slide}
|
|
|
|
|
|
|
|
\begin{slide}{Mehr infos}
|
|
|
|
\begin{list}{$\bullet$}{\itemsep=1em}
|
|
|
|
\item git-webinterface: \url{http://code.stapelberg.de/git/i3}
|
|
|
|
\item Website: \url{http://i3.zekjur.net}
|
|
|
|
\item IRC: \#i3 auf irc.twice-irc.de
|
|
|
|
\end{list}
|
|
|
|
\end{slide}
|
|
|
|
|
|
|
|
\end{document}
|