Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm a windows developer(Win32api) moving from Windows to Linux. While installing linux there are lot of things to know about X11, X Window System, X Server, Xorg, Xfree86 and what not.

How come we aren't aware of such things in windows? Wiki article on these scares me. Can any one explain these things? How they work? Why is it so complicated in linux & not in windows?

Any good references are also appreciated.

PS: I love to know internals, don't hesitate to go into depth.

share|improve this question
    
After reading the answers read this article "Thoughts and rambling on the X protocol" julien.danjou.info/blog/… –  claws Jun 1 '10 at 21:49
    
Links as changed julien.danjou.info/blog/2010/… –  Sharpie Oct 23 '13 at 19:30

2 Answers 2

up vote 6 down vote accepted

Windows gives you a single implementation of a single desktop on top of a single implementation of a single API / framework, all done by Microsoft.

On Unix systems, you get an API / framework (X11 / X Window System) for which exist multiple implementations (Xorg, Xfree86), on top of which you get various "higher level" API / frameworks (GTK+, Qt, ...) because raw X11 is so primitive, on top of which you get various desktops (Gnome, KDE, ...), all done by different people.

Moreover, the X11 system has been designed from the ground up with remote GUIs in mind - i.e., a lokal machine displaying the GUI of a remotely running application - which introduces the concepts of a "X Server" and "X Client".

Then there is a nomenclature that "feels" the wrong way around for newcomers: Your local machine is running the "X Server" providing the "display a GUI" service, while the remote machine is the "X Client" making use of the services on your machine to display the GUI.

Well, that's the quick overview; once you got that sorted out, understanding any articles / forum posts on the subject should become much easier.

Edit: To answer the two first comments of the OP.

Yes, "X11" is merely a protocol, and Xorg / XFree86 are two implementations. At its basic level, X11 is only about drawing lines and dots, which is not terribly useful if you want to do a GUI.

On top of the X11 protocol, people implemented many things, and it is pretty difficult to do a 1:1 comparison with Windows because Microsoft never bothered to really keep things separate. Also I am not a GUI-type developer, i.e. my actual experience with either system is minimal.

At the bottom, a "window manager" provides a window (handling borders, close / minimize / maximize buttons, resizing etc.), and offers the "real estate" within the window to the widget toolset. There are many window managers, some mimicking other systems (Windows, MacOS, AmigaOS, whatever), and they are mostly interchangeable transparent to the remaining system.

The "widget toolset" offers you buttons, sliders, text fields etc. on which to build your GUI. This is what you (as an application developer) actually get to "see", API wise, and what decides most of the "look & feel" of your application.

A "desktop" builds a number of applications on top of a certain widget toolset / window manager combination, in order to provide a consistent look & feel. You don't have to bother with these unless you actually want to develop the desktop itself.

The desktop "Gnome" uses the widget toolset "GTK+" on top of the window manager "Metacity".

The desktop "KDE" uses the widget toolset "Qt" on top of the window manager "KWin".

Note that especially those two, GTK+ and Qt, have evolved far beyond simple "widget toolsets" into "application development frameworks". If you want to develop GUI apps for Linux, effectively you have to pick which one of those two you want to use. There are more choices, if you want a more "lightweight" app (not needing the big library dependencies), but today most systems have GTK+ and Qt libs already installed anyway.

It's perfectly possible to use Qt apps on a Gnome desktop or GTK+ apps on a KDE desktop (it wasn't always like that), so you have to worry little about compatibility. Given a choice between two apps of comparable functionality, people will usually prefer the app using the "native" widgets of their desktop of choice, but I wouldn't worry about that.

Other, more important bullet points in the choice of "widget toolset": Licensing terms, support for your language of choice, cross-platform compatibility.

share|improve this answer
    
+1 and note that if you manage to choose a framework (for example Qt) you will not need to care that much about all the X stuff (some though). –  Peter Jaric May 25 '10 at 11:15
    
+1 & So GUI portion of Windows API is equivalent to Qt & GTK+. Then whats equivalent of X Window System in windows? why & how there exist KDE & Gnome? –  claws May 25 '10 at 14:01
    
@DevSolar: you are in the right track. please be little more descriptive. X11 is just specifications like POSIX? and xorg & xfree86 are its two implementations? If there is GTK+ & Qt what was the need of Gnome & KDE? Please compare each step/level to windows. Thats easy to understand for me. –  claws May 25 '10 at 14:32
    
At the bottom, a "window manager" Window manager builds up on X Window System? if so, windows system would be at the bottom right? You are making me confuse with window manager & window system. –  claws May 25 '10 at 16:03
    
"X11" / "X Window (System)", implemented by "Xorg" / "XFree86", are at the very bottom and offer dots and lines. A "window manager" ("Metacity" / "Kwin") offers windows (frame, dragging, resizing, closing etc.). –  DevSolar May 26 '10 at 5:47

I do not understand why you find it so difficult to understand the explanation provided by http://en.wikipedia.org/wiki/X_Window_System but anyhow:

The X Window System normally consists of 2 parts:

  • A server (called XServer)
  • Clients (called .. XClients :))

The server connects to the hardware (grafic card, input devices) and allows the clients to use these resources. The clients connect to the xserver and use the provided resources.

There exists servers for Unix (Xorg, the mac folks have their own etc) and for Windows (Hummingbird, Cygwin's port of Xorg etc).

You can connect clients on one OS to servers running on another OS.

The communication between the server and the clients is done via either the Xlib-API or (more modern) the xcb-API.

To create a simple application you normally just do this:

  • connect to the xserver
  • request the xserver to create a window (which will give you a "handle")
  • tell the xserver to bring up the window
  • process events (mouse, keyboard, exposure, motion etc)
  • draw stuff to the window (text, grafics etc)
  • quit the app by telling the xserver to release all resources

and .. done.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.