Sugar Factory

From OLPC
Jump to navigation Jump to search

I wrote a tool to make normal X programs to run under sugar. As a demo, it runs a logo program.

http://dev.laptop.org/~albert/xlogo-1.xo

http://dev.laptop.org/git/users/albert/sugarize

How it works: A launcher program places Sugar's incompatible command arguments into the environment, along with LD_PRELOAD pointing at a shared library. The launcher then starts up the program by calling execlp() with the arguments that the program actually needs. As the program is starting up, the dynamic linker

man ld.so

forces the shared library into the program. The shared library intercepts calls into libX11. From that intercepted function the shared library is able to set various Sugar-specific window properties before the app becomes visible. This lets activity switching work, gets the donut icon right, etc.

A slightly newer version is included in the Tux Paint activity.

Albert Cahalan

12/29/07