You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



You are here: Unix project page > Xlib Toolkit

Xlib Toolkit Information

by Christopher Blizzard

Project Goals

The goal of the xlib toolkit project in mozilla is many fold:

Code Reuse and Multiple Toolkits

The fact of the matter is that there will always be more than one toolkit for Unix. Right now the big players include Motif, GTK+ and QT. Each of these toolkits unfortunately has its own look and feel for many things including menus and scrollbars.. None of these toolkits is going away anytime soon and it is inevitable that there will be ports of mozilla to each of these toolkits.

Some of the toolkit will be done inside of Netscape and donated to the mozilla project and some will be done by the mozilla.org community. However, each new toolkit burdens the dedicated individuals who want to maintain the sanity of The Project. Even more troubling is the amount of duplicated code that will be in each of the toolkit ports and will have to maintained.

One of the goals of the Xlib toolkit project is to create a common base, written in Xlib, that will include all of the functionality that is common across the Unix toolkits. The majority of the code will include simple drawing and image handling in the gfx module. It will also include some of the widget side of the toolkit. Some candidates include the nsWindow class which is the simple drawing surface used by the html layout and the XP widgets.

One of the project goals should be to make it very easy to plug in your toolkit of choice. This means that you will be able to use Mozilla in your Motif, GTK+ or QT application. Until the world chooses the One True Toolkit or dies in the process, Mozilla should be able to run on all the toolkits without hardship to people writing applications.

Stand alone Browser

It should also be possible to have a stand alone Mozilla browser that is based entirely in Xlib. While this compromises one of the primary goals of the many Desktop Projects for Unix and Unix-like systems, it allows for a lightweight browser implementation that could be used on a Kiosk system, or on very old hardware. The fact is that Mozilla contains most of the functionality of the modern Unix widget toolkits and it is a very small stretch to turn it into a complete toolkit system.

Internationalization

Not all toolkits are created equal. Right now the only toolkit with good International support is Motif. The next versions of both QT and GTK+ promise to include Unicode support but neither of those are available now and Mozilla should still target the widest audience possible. This includes using current versions of the toolkits instead of bleeding edge versions. In Xlib it is possible to do internationalization without the support of the toolkit and much of the infrastructure for that is already in place.

A Look to The Future

Past the initial 5.0 release, it has been made clear that mozilla will probably be moving to an almost entirely gfx based widget system. The reason for this is that there are many part of XUL and HTML 4.0 and CSS that require widgets are capable of functionality that normal toolkits don't encompass. An example of this would be transparency of text fields which none of the toolkits currently do.

An Xlib based mozilla would allow all of the toolkits in question to take advantage of this without any changes. Also, at what point do you want to keep using a toolkit if you only need it for scrollbars and menus?

Project Status

The Xlib only version of Mozilla is almost done. It will currently build, run and render pages. You can navigate web sites via links, scroll around in windows, just like a real browser! There are still some things that are incomplete as of the last update of this page. You still can't open a new url from the url bar but you should be able to very soon.

There are very few things left to do. Below is a list of the features that are still unimplemented or serious, obvious bugs. There is a bug report open for each of them. If you find a reproducible bug in the front end, please take the time to open a new bug. It will really help getting it all finished up.

ID Sev Pri Plt Owner State Result Summary
9744 norP3PCblizzard@redhat.comNEWscrolling widgets fails to move drop down windows
9908 norP3PCblizzard@redhat.comNEWxlib widgets don't compress expose events
9909 norP3PCblizzard@redhat.comNEWxlib gfx doesn't use shared images and pixmaps
9910 norP3PCblizzard@redhat.comNEWxlib doesn't support the clipboard
9911 norP3PCblizzard@redhat.comNEWxlib code doesn't support drag and drop
9912 norP3PCblizzard@redhat.comASSIxlib widgets don't have menus
9913 norP3PCblizzard@redhat.comNEWgfx text widget in xlib doesn't draw correctly
9918 norP3PCblizzard@redhat.comNEWxlib widget set needs to set window manager hints
9920 norP3PCblizzard@redhat.comNEWgfx url field in xlib browser won't open new pages
9934norP3PCblizzard@redhat.comNEWtext selection doesn't work with xlib widgets
10058norP3PCblizzard@redhat.comASSIxlib widgets don't handle test9 very well - problems with embedded children and scrolling

Want to help out?

Please drop me some email and let me know you're working on something. That way we won't end up with more than one person working on the same thing.

Building the xlib only widget set

When you untar the source, run configure like this:

./configure --enable-toolkit=xlib

It should build from there out of the box. Once it's done building you should have an apprunner and a viewer binary. You should also add the following line in your ~/.mozilla/mozProfile/prefs.js file:

user_pref("nglayout.widget.mode", 2);

This will turn on gfx widgets. The xlib widget set doesn't implement any of its own widgets except for a simple scrollbar. Gfx widgets will be on before the next milestone and all of the old native widgets will be depreciated. This includes a gfx scrollbar so when the gfx scrollbar lands the xlib native scrollbar widget will go away, too.

Embedding mozilla into other toolkits

I've been doing a lot of thinking about this recently and I've come up with some solutions which should allow you to embed the xlib browser into your gtk, qt or motif application. I'll post more here when I've got code.

I'm waiting for the timers to be separated from the individual gfx toolkits. Once that's done I can write sample code for each of the toolkits.