KDE – A Revolution in Programming X
The story of Qt and the Kool Desktop Environment
The Kool Desktop Environment, later known as K Desktop Environment or KDE, was launched after Matthias Ettrich issued a call for programmers on de.comp.os.linix.misc in October 1996, and soon had 40 programmers contributing.
In the mid Nineties, Linux had X and a variety of diverse and ingenious window managers, but no unified toolkit for the development of applications with a common look and feel. A typical Linux desktop would use a window manager – probably FVWM, which looked a little like Windows 95 – and a scatter of applications, some of which ran in the terminal window while the rest used a variety of widget sets, no two of which looked alike or behaved in the same way.
A user might be running Ghostview which used Athena widgets, Lyx which used XForms, Xftp on Motif, and Textedit which ran on the XView toolkit. Each of the widget sets had virtues and inadequacies, but none was good enough.
As Ettrich saw it, XForms was “easy to program, although it is written in C.
And it comes with a neat GUI builder. However, the look and feel is so non-standard and the source code is not freely available. Two killer-arguments not to build something like a desktop on top of it.”
Motif was “extremely hard to use and requires a lot of source code for even simple tasks… you will have to learn at least three APIs and when to use them: Motif, Xt and Xlib,” and the resulting software was “sluggerish and slow.”
Just as importantly, Motif wasn’t free software and the FSF had been trying to replace its functionality since the Eighties. The replacement, Lesstif, finally reached some kind of parity in 1997, by which time the more flexible combination of Qt and KDE was nearing maturity.
Cute and useful
Qt, pronounced ‘cute’, was developed by two Norwegians, Haavard Nord and Eirik Chambe-Eng, to solve the problem of writing cross-platform GUI applications. The Q in Qt was “chosen as the class prefix because the letter looked beautiful in Haavard’s Emacs font. The ‘t’ was added to stand for ‘toolkit’, inspired by Xt, the X Toolkit.”
Qt had a lot going for it. It was the most complete cross- platform GUI toolkit on the market, and though it may not have been available under a recognisable free software licence, Nord and Eng had written Qt in their spare time and intended from the outset that the source code should be available at no cost for use in free software projects.
Qt was developed on Linux. “All X11 development is done first on Linux,” Eng told Linux Journal, “then the source is moved to other platforms for testing and porting.” Qt could emulate the look and feel of Motif or Windows 95, and was implemented directly on top of Xlib.
Qt also offered the same APIs on other platforms, which was important to its long-term viability. Portability was Trolltech’s strategy for selling Qt under a commercial licence. But by the time of its first release, Nord and Eng had only one customer and were living on their wits.
I’m a dreamer
Most Linux users of the time were programmers or sysadmins, who were happy on the command line and were not unduly troubled by the ugliness or diversity of the widget sets on Linux. But when Ettrich installed Linux on his girlfriend’s computer and saw the problems she faced, it became obvious to him that a common look and feel was a necessity if Linux was to attract users who cared nothing for Emacs and Vi or the subtleties of the command line.
Ettrich suggested that Qt would be the perfect solution, and added a disclaimer. “Usually these postings get a lot of answers like: ‘Use a Mac if you want a GUI, CLI rules!’” or “’Why Qt? I prefer schnurz-purz-widgets with xyz-lisp-shell. GPL! Check it out!’”
“Thanks for not sending these as follow-up to this posting. I know I’m a dreamer.”
The lack of a proper free licence for Qt was a real problem, but Ettrich was a programmer, and saw the problem from an engineering perspective. “For the success of KDE, a stable, controlled basis class library was an important factor,” he said in 1998. “It could have been an open source one, of course, if one was available. We in the KDE team wanted to write free software.”
The problem was that the Qt was open source in the sense that the code was visible, but the user had no long- term rights to reuse or modify the code. Since nearly all KDE applications were written under the GPL, this meant that the applications were in violation of their own licences.
A revolution in programming X
From Ettrich’s perspective, Qt was “a revolution in programming X, an almost complete, fully C++ Widget- library that implements a slightly improved Motif look and feel,” and Qt offered the opportunity “to escape the TCL/TK monsters that try to slow down all our processors and eat up our memory.”
KDE was taking off and the KDE developers loved Qt. The Qt developers reciprocated and loved free software and KDE, but there was a disconnect between the good will of the developers and the credibility of Qt as a development library for free software. Trolltech offered Qt on X11 under “a non- commercial licence which grants any developer the right to use Qt to develop software for the free software community,” and that was it.
There was no guarantee of the long-term viability of KDE. A change of ownership or a decision to withdraw the right to use the code would have cast KDE adrift without a widget to stand on.
As Richard Stallman expressed it, “A non-free library that runs on free operating systems acts as a trap for free software developers. The library’s attractive features are the bait; if you use the library, you fall into the trap, because your program cannot usefully be part of a free operating system.”
The first release of KDE was on 12 July 1998. By the end of that month Gaël Duval had ported KDE onto Red Hat Linux 5.1 and created Linux Mandrake, which was to be the most popular Linux distribution of its time.
In the meantime, Trolltech had begun to pay for itself. Its first contract had been with a Norwegian company, Metis, which kept Nord and Eng busy and kept the wolf from the door, but the company’s second and more significant customer was the European Space Agency, which bought ten Qt commercial licences and put Qt on the map.
The revenge of the trolls
In 1998 Ettrich became the first of many KDE developers to become a Troll, as employees of Trolltech came to be known. By this time the fates of Qt and KDE had become inextricably linked. KDE and Qt were joined at the hip. KDE wasn’t just the most complete example of Qt in action but also its test bed and its source of new developers.
GNOME and the Harmony project came about in response to the licensing problems. Harmony was intended to be a drop-in replacement for Qt. GNOME was the free desktop environment that would replace KDE.
In November 1998 Trolltech, which needed KDE as much as KDE needed Qt, tried to resolve the problem by releasing Qt under a dual commercial licence and the QPL, its own interpretation of a free software licence.
Simultaneously, and perhaps as a forward-looking recognition of QPL’s ultimate failure to address the problems, Trolltech worked with KDE to set up the KDE Free Qt Foundation as a guarantee to the KDE community that if Trolltech went away or failed to update free versions of the code, KDE had the right to set up an independent version of the code under a BSD licence.
But the QPL didn’t work either and in September 2000 Trolltech finally decided it was better to address the problem at source. Qt released the X11 version of the code under a dual QPL and GPL licence, and the problem was resolved.
When I write the book
Qt and KDE went from strength to strength to strength, until Trolltech and Qt were purchased by Finnish mobile phone giant Nokia, which invested a great deal in its development. The code was imposed on Maemo, MeeGo and Symbian as part of Nokia’s disorganised search for a challenger to Android and the iPhone.
Just as surprisingly, Nokia relicensed Qt under the LGPL for all platforms, and moved towards an open governance model similar to KDE or the Linux kernel “with a distributed approval system, with public discussions and decision-making on mailing lists”, to encourage the participation of developers.
KDE now describes itself as a distributed free software community and as a ‘software compilation’ rather than a singular ‘desktop environment’. And KDE and Qt are still joined at the hip. Qt is the framework for KDE, and KDE gains a toolkit, a framework and the handiwork of the Trolls. Qt gains the extraordinary range of apps that comprise a KDE distribution, a network of developers and a community to test and run its software.
As Ettrich described it back in 2008. “Everything I have been doing goes into Qt. But since Qt is a part of KDE, or KDE a superset of Qt, I still consider myself a KDE programmer.”
Qt began as a proprietary toolkit, moved to a dual licensing model under the GPL, and is now licensed under the LGPL (without copyright assignment) under an open governance model. Much of Qt’s technical and commercial success and its free software model can be attributed to its close association with KDE.
Ettrich, by now a senior employee of Trolltech, expressed his own feelings about it. “Imagine where the world of computer science would be without free software!” he said in a 2008 interview. “How much secret knowledge would be kept behind closed doors?
“Without us, people would study computer science and programming without ever having seen a real program in its entirety. That’s like becoming writers without ever having read a complete book.”