
XPlain – Explaining X11 for the rest of us - emillon
http://magcius.github.io/xplain/article/index.html
======
lucian1900
Actually embedding an X server in the article is one of the coolest things
I've seen in a while.

~~~
pjc50
That's a seriously awesome piece of work. I'm sure it could be used for more
things than demos.

X11's client-server model is seriously underappreciated, and the continuing
efforts to make X behave exactly like Microsoft Windows frequently forget
about network transparency.

Conversely, trying to make X behave like Microsoft Remote Desktop is often
unreasonably painful. I've not yet seen a nice solution for detaching and
reattaching X applications like screen(1)

~~~
lucian1900
I don't think X11's network transparency is useful at all nowadays. RDP and
VNC give much better results.

Wayland's model is much more likely to end up with useful network support.

Modern graphics simply does not scale across networks naively.

~~~
npsimons
_I don 't think X11's network transparency is useful at all nowadays. RDP and
VNC give much better results._

And yet every single time someone brings this up, plenty of people chime it
that it _is_ useful, because _they 're using it_. Unless RDP and VNC have
fixed their performance problems and don't break UI flow by putting the whole
remote desktop in a separate window (instead of making windows for remote apps
seamless), then many would contend that RDP and VNC _don 't_ give better
results.

And yet Wayland keeps steamrolling over these objections. Oh well, at least
they finally admitted that network support isn't just some useless toy that
can be added on later, "if anybody even uses it".

~~~
lucian1900
> Unless RDP and VNC have fixed their performance problems

They are both much, much faster than X11. X11 has higher latency and uses
significantly more bandwidth.

> by putting the whole remote desktop in a separate window (instead of making
> windows for remote apps seamless)

Many of the things that make modern desktops nice (like client-side
decorations) make it hard to merge remote and local windows. It's not
impossible (witness VirtualBox's attempt), but there are peculiar corner cases
if you want to make it generic across platforms.

If you want a modern desktop that's fast on modern hardware (arguably its
primary purpose), remote desktop will have to work RDP/VNC style.

~~~
morsch
I do 99% of my development in the office in an eclipse instance running on a
remote server connected via LAN. It's completely seamless, you would have
absolutely no way of knowing that it's not running locally. Having never use
RDP, I can't rule out it's as good; I don't see how it could be better. VNC is
laughably bad in comparison.

For working from home, we've got NX. Again, it mostly just works; I can't
really tell that it's a non-local window. Again, I can't rule out though
cannot imagine RDP does it better; some amount of latency is unavoidable via
WAN; VNC would be excruciating.

This setup has been working fine for about 6 years now, btw.

~~~
Torgo
I am also using NX (specifically, Nomachine's NX, an older version before they
replaced everything with proprietary crap.) Right now for Linux, I think it is
still the best thing going. I use it in full desktop mode, as if it were a VNC
or RDP session. Offsite, there's very little latency or artifacting. Onsite,
as you say, it's nearly indistinguishable.

------
ccozan
Ah, the magic of X. I've done my first steps into X by programming a graphical
FTP client on a SGI Indy 2 under IRIX. It was 1994 and I spent about 3 weeks
and I had luck to get the O'Reilly X books [0] ( and other two, can't remember
).

[0]
[http://shop.oreilly.com/product/9781565920156.do](http://shop.oreilly.com/product/9781565920156.do)

------
jesuslop
I hope Wayland innards gets similar efforts to be explained and publicised
with this same level of quality as this piece on venerable x11.

~~~
Jasper_
I'm trying: [http://blog.mecheye.net/2014/06/xdg-
shell/](http://blog.mecheye.net/2014/06/xdg-shell/)

Really, a big part of Wayland is that there isn't much there. It's not a
ridiculously complicated system to explain with lots of extensions, you're
just having clients pass image files around and get streams of messages for
input. The easiest way to get a feel for the system is to use the built-in
protocol dumper:

    
    
      $ WAYLAND_DEBUG=client weston-terminal
    

... or so... and that's it, that's the entire system.

If anybody has any more questions on Wayland internals, I'll certainly
consider writing a series of articles on it.

~~~
pjc50
Interesting, that's the most positive thing I've heard about Wayland so far
(much simpler system).

~~~
Jasper_
What else have you heard about Wayland?

~~~
Sammi
Guaranteed perfect frames. Compositor built in. Both awesome.

It's simple and slim, and therefore hopefully more performant.

And then there was some drama about client side windows decorations, that I
didn't quite get.

~~~
zanny
The protocol doesn't specify decorations. It is up to the compositor. The
reference one, Weston, was using client side (I think Mutter is doing that
too) while Kwin is using server side.

It is a personal choice. And Wayland the windowing system doesn't care what
you do - its decoration agnostic.

~~~
Jasper_
That's not necessarily true. If your toolkit and compositor don't agree on
whether you're using client-side or server-side decorations, then you're going
to see either double decorations or no decorations.

Most of the core Wayland team believes that client-side decorations is the
technically superior approach for efficiency and accuracy reasons, and we're
disappointed KDE is still pushing for server-side decorations.

There is currently no protocol to negotiate between the toolkit and compositor
whether to use client-side or server-side decorations. And I can't see one
being added in the near future, either.

------
Flimm
This article was last updated in May 2014:

[https://github.com/magcius/xplain/commits/gh-
pages](https://github.com/magcius/xplain/commits/gh-pages)

~~~
Jasper_
I have plans and some code for the next article, but I've been busy with
actual real work. I promise you'll see it before the end of the year.

~~~
Flimm
Sorry, I should have been more clear. I was pleasantly surprised by how recent
the updates are and many commits there were. Keep up the good work!

------
rdvrk
Beautifully done; the writing style, the server running inside my browser -
wow!

I haven't been so excited about a piece of software for ages. Reading this and
looking at demos gives me the same feeling of amazement I got reading paper
magazines when I was younger. Exploring floppies included with books, hearing
the modem connecting for the first time, short pause, stream of characters
before the login prompt. Magical.

Thank you Jasper_ for doing this and emillion for the link.

------
peaton
Slightly unrelated, but does all of this recent github hacking for
blogs/books/etc remind anyone else of myspace?

~~~
Jasper_
I chose GitHub because it's an easy way to publish a static website that I
don't have to rsync: contributors can fix a typo and I press a button on the
website and things are automatically deployed.

It's a super convenient workflow for me, and there's nothing else like it in
my opinion. If there is, please let me know! I hate rsync / scp for deploying
static sites, but that's the best thing we have right now.

~~~
peaton
I'm not saying it's a bad thing. I really just meant it as a comment. Hacking
the layout just reminded me of those good old myspace profile days. No I'm not
"hating". Everybody does this these days. I just think it's interesting.

------
omnibrain
The article about the linux graphics stack that he links right at the
beginning is also very interesting.

------
angersock
What are some other good resources for learning X? It seems like quite the
dark art.

~~~
jesuslop
You can look here, they have a tutorial and a web version of the XLib Manual:

[http://tronche.com/gui/x](http://tronche.com/gui/x)

~~~
Jasper_
I would recommend against the Tronche site for references. It was
automatically converted, but there are sometimes fields missing in places.
I've tried emailing him, but the email address is disconnected. You can find
reference documentation officially here:

[http://www.x.org/releases/current/doc/libX11/libX11/libX11.h...](http://www.x.org/releases/current/doc/libX11/libX11/libX11.html)
[http://www.x.org/releases/current/doc/xorg-
docs/icccm/icccm....](http://www.x.org/releases/current/doc/xorg-
docs/icccm/icccm.html)

I haven't read the tutorial, so maybe that's perfectly OK.

------
Shish2k
> you might remember that Xorg was forked from XFree86 a decade ago

Today's xkcd is relevant :( ( [http://xkcd.com/1393/](http://xkcd.com/1393/) )

------
ivanche
Ah, by the title I thought it's about crypto currencies and X11 algorithm...

~~~
jimktrains2
X11 is a protocol, not an algorithm.

~~~
ivanche
Thanks for the correction! And I wondered why I got all those downvotes...

~~~
jimktrains2
Well, the downvotes might also be from the perceived snark.

