You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
151 lines
4.4 KiB
151 lines
4.4 KiB
\chapter{X11} |
|
\label{chap:X11}\index{X11} |
|
|
|
%------------------------------------------------------------------- |
|
\section{Les fontes} |
|
|
|
Comment fait-on pour connaitre la liste des polices installées ? |
|
|
|
\begin{verbatim} |
|
$ fc-list | awk -F ":" '{print $1}' | sort -u |
|
\end{verbatim} |
|
|
|
Comment faire pour visualiser la plénitude des formes de mes fontes ? |
|
|
|
\begin{verbatim} |
|
tth@debian:~/Devel/TetaTricks$ man fontimage |
|
No manual entry for fontimage |
|
See 'man 7 undocumented' for help when manual pages are not available. |
|
tth@debian:~/Devel/TetaTricks$ |
|
\end{verbatim} |
|
|
|
Wtf\index{Wtf} ? |
|
|
|
%------------------------------------------------------------------- |
|
\section{Xephyr}\index{Xephyr} |
|
|
|
|
|
D'après la manpage : |
|
\textsl{Xephyr is a kdrive server that outputs to a window on a pre-existing |
|
"host" X display. Think Xnest but with support for modern |
|
extensions like composite, damage and randr. |
|
Unlike Xnest\index{Xnest} which is an X proxy, i.e. limited to the |
|
capabilities of the host X server, Xephyr is a real X server which |
|
uses the host X server window as "framebuffer" via fast SHM XImages.} |
|
|
|
Ça peut sembler attirant à première vue, mais l'utilisation n'est pas |
|
si simple que ça. |
|
Par exemple, quelle est la méthode à mettre en œuvre pour avoir |
|
le clavier en Azerty\index{azerty} ? |
|
|
|
XXX\index{XXX} |
|
|
|
%------------------------------------------------------------------- |
|
\section{Numlock} |
|
|
|
Vous l'avez voulu, le voici~: |
|
|
|
\begin{verbatim} |
|
#include <X11/XKBlib.h> |
|
#include <X11/extensions/XKB.h> |
|
#include <X11/keysym.h> |
|
int main(){ |
|
Display *disp = XOpenDisplay (NULL); |
|
if(disp == NULL) return 1; |
|
unsigned int nl_mask = XkbKeysymToModifiers \ |
|
(disp, XK_Num_Lock); |
|
XkbLockModifiers (disp, XkbUseCoreKbd, nl_mask, nl_mask); |
|
XCloseDisplay (disp); |
|
return 0;} |
|
\end{verbatim} |
|
|
|
Mais c'est du très vieux code, ça ! |
|
|
|
%------------------------------------------------------------------- |
|
% new 20 décembre 2012 à Mixart-Myrys |
|
\section{xdotool} |
|
\index{xdotool} |
|
|
|
D'après la manpage : |
|
\textit{ |
|
xdotool lets you programatically (or manually) simulate keyboard input |
|
and mouse activity, move and resize windows, etc. It does this using |
|
X11's XTEST extension and other Xlib functions. |
|
} |
|
|
|
En gros, et pour faire simple, avec ce logiciel, |
|
vous pouvez piloter des |
|
applications X11, à la manière d'un wm, et ce, à partir de |
|
la ligne de commande. |
|
|
|
Vous pourrez les déplacer, les redimensionner, leur envoyer des |
|
évènements clavier, tout ce genre de choses. Il est donc possible |
|
de coder «~des sortes d'animations~» uniquement basées sur le |
|
protocole de X11. \textsl{Big win, bro !} |
|
|
|
La démarche d'utilisation n'étant pas immédiate, nous allons |
|
commencer par un petit exemple : déplacer un Xlogo sur l'écran. |
|
Et comme un petit script vaut mieux qu'un long discours~: |
|
|
|
\lstinputlisting[language=sh]{code/move-xlogo.sh} |
|
|
|
La première étape est le lancement de la cible en arrière-plan. |
|
La seconde est la récupération de l'indentifiant |
|
(interne à X11) de la fenêtre concernée. |
|
|
|
|
|
\begin{verbatim} |
|
$ xlogo & |
|
[3] 2674 |
|
$ WIN=$(xdotool search -name xlogo) |
|
$ echo $WIN |
|
69206019 |
|
\end{verbatim} |
|
|
|
Voilà\footnote{En français dans le texte.}, nous savons maintenant |
|
à quelle fenêtre causer : par son numéro d'identification. |
|
Le problême des multiples fenêtres du même nom sera abordé |
|
ultérieurement. Nous pouvons maintenant déplacer notre widget |
|
avec vigueur\dots |
|
|
|
\begin{verbatim} |
|
$ xdotool windowmove $WIN 10 10 |
|
\end{verbatim} |
|
|
|
C'est simple, non ? |
|
|
|
%------------------------------------------------------------------- |
|
|
|
\section{XCB}\index{XCB} |
|
|
|
Vous avez pratiqué la \textsl{Xlib} ? Avez-vous aimé ? |
|
\textsc{[oui]} et \textsc{[non]} sont deux réponses valables. |
|
Et si vous ne savez pas quoi répondre, c'est que vous n'avez |
|
pas compris la question. |
|
|
|
|
|
\begin{quote} |
|
The X protocol C-language Binding (XCB) is a replacement for Xlib |
|
featuring a small footprint, latency hiding, direct access to the |
|
protocol, improved threading support, and extensibility. |
|
\end{quote} |
|
|
|
% |
|
% https://xcb.freedesktop.org/tutorial/basicwindowsanddrawing/ |
|
% |
|
|
|
%------------------------------------------------------------------- |
|
|
|
\section{Xforms}\index{Xforms} |
|
|
|
À première vue\footnote{Avril 2021}, un toolkit sympa, très abordable |
|
en C, mais le premier exemple du tutorial d'initiation ne fonctionne |
|
pas vraiment comme il devrait. Mais quand même une affaire à suivre. |
|
|
|
|
|
%------------------------------------------------------------------- |
|
|
|
|
|
|
|
|
|
|
|
|