Last night was the third one spent on playing around with X in a d-i environment.

Making sure X actually works

So far, running X was nice already, but is it really possible to run some applications inside? Bad news is that many trivial applications (xeyes, xclock, …) pull more dependencies than previously packaged.

Finally, xev was chosen, and it indeed works fine (provided one makes sure it gets the focus).

X was crashing when the (only|last) client was exiting, and that wasn’t normal. Thankfully the bug was reproducible outside d-i and Julien sent a patch a few minutes later.

In the meanwhile, using -noreset did the trick to keep X running.

Another way to run X applications there, is to point the host environment to the guest environment using DISPLAY=$GUEST:0 xterm. With VirtualBox, I followed those steps:

  • Forward the host’s 6000/tcp to the guest’s 6000/tcp.
  • Answer the language-related questions in debconf so that network configuration happens, which is needed for the next steps to work (just getting localhost set up is probably sufficient, but let’s be lazy and let the installer take care of it for now).
  • Run X in the guest, disabling access control, with:

     X -retro -noreset -ac
    
  • Start xterm from the host with:

     DISPLAY=localhost:0 xterm
    

Moving forward: cairo, pango, gtk

The next step was to rework some udebs. Legend:

  • Red box: udeb we no longer want to depend on.
  • Blue boxes: udebs to be tweaked first.
  • Green boxes: udebs to be tweaked afterwards.
  • Ellipse: udeb provided by the one pointed to (magenta edge).

Current situation, keeping only the relationships between udebs of interest:

udebs needing work

I took care of gtk+2.0 while Julien hacked pango1.0 and cairo. Some more libraries were needed, but being X libraries, tweaking the packaging was as trivial as for the first X libraries, and it only took a couple of minutes: libxcomposite, libxdamage, and libxinerama.

Once those added to localudebs/ and to pkg-lists/local, and once the image rebuilt, I prepared a tiny “Hello world”-style application:

  • Grab the source code from the GTK+ 2.0 Tutorial.
  • Built it against the x11 flavour:

     gcc -o hello $(pkg-config --cflags gtk+-2.0) hello.c -lgtk-x11-2.0
    
  • Grab it from within d-i, and make it executable.

  • Start X as previously explained, then:

     DISPLAY=:0 ./hello
    

Pango wasn’t quite happy at first (message wrapped):

(hello:1991): Pango-WARNING **: failed to choose a font, expect
              ugly output. engine-type='PangoRenderFc', script='latin'

Indeed, since no fonts were included, there was a tiny issue. No big deal, adding ttf-dejavu-udeb did the trick. I wanted to play around with a non-Latin language, so I asked for an example (thanks, Theppitak!), and once ttf-thai-tlwg-udeb added as well, one gets:

Gtk+ running within X within d-i

Of course, there are many more features to test, but that sounds like we’re going in the right direction (and this is not a joke about RTL).

Next step

Have a look at the green boxes, which may require to have a closer look at g-i’s integration within d-i (it might be needed to see how it’s supposed to be started, that might help testing the tweaked packages).