<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>jd:/dev/blog</title>
    <link>http://julien.danjou.info/blog/index.html</link>
    <description>Julien Danjou's blog</description>
    <language>en-us</language>
    <generator>Emacs Muse</generator>

<div id="quote">
</div>


    <item>
      <title>Emacs, Google Maps and BBDB</title>
      <link>http://julien.danjou.info/blog/index.html#Emacs%2C%20Google%20Maps%20and%20BBDB</link>
      <description><![CDATA[

<p class="first">Today's fun idea was to put all my contacts stored into <a href="http://bbdb.sourceforge.net/">BBDB</a> on a Google
Maps' map, using my <a href="http://julien.danjou.info/google-maps-el.html">Google Maps extension for Emacs</a>.</p>

<p>With the help of a few lines of Lisp glue:</p>

<pre class="src">
(google-maps-static-show
 <span style="color: #729fcf;">:markers</span>
 (mapcar
  (<span style="color: #729fcf; font-weight: bold;">lambda</span> (address-entry)
    `((,(concat
         (mapconcat
          'identity
          (elt address-entry 1) <span style="color: #ad7fa8; font-style: italic;">", "</span>) <span style="color: #ad7fa8; font-style: italic;">", "</span>
          (elt address-entry 2) <span style="color: #ad7fa8; font-style: italic;">", "</span>
          (elt address-entry 3) <span style="color: #ad7fa8; font-style: italic;">", "</span>
          (elt address-entry 4) <span style="color: #ad7fa8; font-style: italic;">", "</span>
          (elt address-entry 5)))))
  (mapcan
   (<span style="color: #729fcf; font-weight: bold;">lambda</span> (record)
     <span style="color: #888a85;">;; </span><span style="color: #888a85;">We need to copy the returned list, because mapcan will modify it later
</span>     (copy-list (bbdb-record-addresses record)))
   (bbdb-records))))
</pre>

<p>we can make that:</p>

<p class="image"><img src="/images/emacs-google-maps-bbdb.png" alt=""></p>

<p>It's really simplistic, but I did not need more to have fun. :-)
This could be extended to set a specific marker and/or color for each
contact, with a legend. I'll let that as an exercise for my readers.</p>



<a href="http://flattr.com/thing/47923/Julien-Danjous-blog" target="_blank">
<img src="http://api.flattr.com/button/button-compact-static-100x17.png" alt="Flattr this" title="Flattr this" border="0" /></a>
]]></description>
      <author>Julien Danjou</author>
      <pubDate>Wed, 18 Aug 2010</pubDate>
      <guid isPermaLink="true">http://julien.danjou.info/blog/index.html#Emacs%2C%20Google%20Maps%20and%20BBDB</guid>
    </item>

    <item>
      <title>Updating muse-el in Debian</title>
      <link>http://julien.danjou.info/blog/index.html#Updating%20muse%2Del%20in%20Debian</link>
      <description><![CDATA[

<p class="first">The Debian package of <a href="http://mwolson.org/projects/EmacsMuse.html">Emacs Muse</a> was maintained by <a href="http://mwolson.org/web/WelcomePage.html">Michael W. Wolson</a>, who is
also the upstream author of that software.</p>

<p><a href="http://blog.mwolson.org/tech/projects/emacs_muse_3.20_released.html">He announced months ago that Muse needed a new upstream maintainer.</a> That's
not something I'm willing to do, since I really think Muse has been
superseded by <a href="http://www.orgmode.org">Org mode</a> nowadays.</p>

<p>However, I'm still using Muse to maintain this blog with my <a href="http://julien.danjou.info/muse-blog.html">muse-blog</a>
extension, since Org still lacks some infrastructure to maintain and publish
a blog.</p>

<p>Therefore, I adopted the <a href="http://packages.qa.debian.org/m/muse-el.html">Emacs Muse Debien package</a> and updated it to the
latest version!</p>



<a href="http://flattr.com/thing/47923/Julien-Danjous-blog" target="_blank">
<img src="http://api.flattr.com/button/button-compact-static-100x17.png" alt="Flattr this" title="Flattr this" border="0" /></a>
]]></description>
      <author>Julien Danjou</author>
      <pubDate>Sun, 15 Aug 2010 20:43:00 CEST</pubDate>
      <guid isPermaLink="true">http://julien.danjou.info/blog/index.html#Updating%20muse%2Del%20in%20Debian</guid>
    </item>

    <item>
      <title>Update on rainbow-mode</title>
      <link>http://julien.danjou.info/blog/index.html#Update%20on%20rainbow%2Dmode</link>
      <description><![CDATA[

<p><a href="http://julien.danjou.info/rainbow-mode.html">rainbow-mode</a> had a big success and good feedbacks when I released it for the
first time a couple of months ago.</p>

<p>Several users asked to me request its inclusion into <a href="http://www.gnu.org/software/emacs/">Emacs</a>. Therefore, some
days ago, <a href="http://lists.gnu.org/archive/html/emacs-devel/2010-07/msg01290.html">I proposed to merge it inside Emacs trunk</a>. My request has been
denied, but the mode has been added to the <a href="http://elpa.gnu.org">Emacs 24 package repository</a>.</p>

<p>In the mean time, I've added support for <a href="http://www.w3.org/TR/css3-color/#hsl-color">hsl() and hsla()</a> support, and added
<a href="http://www.w3.org/TR/css3-color/#svg-color">CSS 3/SVG color names</a>.</p>



<a href="http://flattr.com/thing/47923/Julien-Danjous-blog" target="_blank">
<img src="http://api.flattr.com/button/button-compact-static-100x17.png" alt="Flattr this" title="Flattr this" border="0" /></a>
]]></description>
      <author>Julien Danjou</author>
      <pubDate>Tue, 10 Aug 2010</pubDate>
      <guid isPermaLink="true">http://julien.danjou.info/blog/index.html#Update%20on%20rainbow%2Dmode</guid>
    </item>

    <item>
      <title>Porting D-Bus to XCB: story of a failure</title>
      <link>http://julien.danjou.info/blog/index.html#Porting%20D%2DBus%20to%20XCB%3A%20story%20of%20a%20failure</link>
      <description><![CDATA[

<p class="first">Even if <a href="http://julien.danjou.info/blog/2010.html#Thoughts%20and%20rambling%20on%20the%20X%20protocol">I recently stated I lost some of my faith</a> in <a href="http://xcb.freedesktop.org">XCB</a>, I still sometimes
hack things to add support for it.</p>

<p>These last days, I've worked on a <a href="http://dbus.freedesktop.org">D-Bus</a> port from Xlib to XCB. The port was
quite straight forward, since there's only a little piece of D-Bus using X,
which is <em>dbus-launch</em>.</p>

<p>I though D-Bus was a good candidate, since it's part of the <a href="http://www.freedesktop.org">Freedesktop</a>
initiative. Therefore, I was expecting a warm welcome and some enthusiasm
from a fellow project.</p>

<p>My contribution got one useful review, and a <a href="http://lists.freedesktop.org/archives/dbus/2010-July/013185.html">cold reply from Thiago Macieira</a>
(a <a href="http://www.kde.org">KDE</a>/<a href="http://qt.nokia.com">Qt</a>/<a href="http://www.nokia.com">Nokia</a> developer):</p>

<blockquote>
<p class="quoted">
No, sorry, I don't agree..
I've just checked and my Solaris machine doesn't have XCB.
Please do not remove the X11 code. You may <em>add</em> the XCB code, but you cannot 
remove the X11 code.</p>

</blockquote>

<p>This is not really the kind of answer I expected, actually. I then reworked
the code to <a href="http://lists.freedesktop.org/archives/dbus/2010-July/013192.html">please Thiago</a>, and added some <em>#ifdef</em> to add XCB support to
D-Bus, with a fallback to libx11 where XCB would not be available.</p>

<p><a href="http://lists.freedesktop.org/archives/dbus/2010-July/013196.html">Havoc Pennington replied</a>:</p>

<blockquote>
<p class="quoted">
Given that libX11 now uses xcb as backend, I don't understand the
value of porting to use libxcb directly when there isn't an issue of
round trips or other stuff. It will just make #ifdef hell, while the
X11 API is an API that works on both xcb and non-xcb platforms.
Maybe people should be thinking about porting xcb to non-Linux
platforms? The X protocol should be the same on other UNiX, so xcb in
theory ought to work fine if you just compiled it on Solaris/BSD, same
as GTK or dbus or Qt would work fine.</p>

</blockquote>

<p>The last part "Maybe people should be thinking about porting xcb to
non-Linux platforms?" is still unclear to me, even though
<a href="http://lists.freedesktop.org/archives/dbus/2010-July/013197.html">I asked Havoc to explain what he meant</a>.</p>

<p>Finally, <a href="http://lists.freedesktop.org/archives/dbus/2010-July/013198.html">Thiago refused to merge the patch</a>:</p>

<blockquote>
<p class="quoted">
[…] thanks for the patch, but like Havoc I am unsure of the value. We can't
drop the X11 codepaths now because too many systems exist without
XCB. Adding the XCB codepaths only made it more complex, even though you did
a good job.</p>

</blockquote>

<p>I can't disagree with that conclusion: using both XCB and X11 make the code
unreadable for little gain. That's why I did replace libx11 by XCB directly
in the first version of the patch. On the other hand, D-Bus people does not
seems to really care about making their software evolve in the right
direction, even if that requires users to upgrade their systems.</p>

<p>I think D-Bus using and depending on XCB would have been a good point to
push adoption of XCB. Unfortunately, it seems you can't even rely of
projects of the same initiative (i.e. Freedesktop) to work together to make
things a little bit better.</p>

<p>After 5 years of existence, XCB is still not so obvious to people, and
making it adopt is going to be a challenge for the next years. The upside is
that <a href="http://www.x.org/wiki/Releases/7.6">new X.org 7.6 will bring XCB with it</a>, as part of the katamari.</p>



<a href="http://flattr.com/thing/47923/Julien-Danjous-blog" target="_blank">
<img src="http://api.flattr.com/button/button-compact-static-100x17.png" alt="Flattr this" title="Flattr this" border="0" /></a>
]]></description>
      <author>Julien Danjou</author>
      <pubDate>Thu, 29 Jul 2010</pubDate>
      <guid isPermaLink="true">http://julien.danjou.info/blog/index.html#Porting%20D%2DBus%20to%20XCB%3A%20story%20of%20a%20failure</guid>
    </item>

    <item>
      <title>M-x google-maps</title>
      <link>http://julien.danjou.info/blog/index.html#M%2Dx%20google%2Dmaps</link>
      <description><![CDATA[

<p class="first">Since I have started to use <a href="http://www.orgmode.org">Org-mode</a>, I though it was missing something to
have appointment locations on a map. Of course, it's easy to get a <em>LOCATION</em>
property from an entry, and then <em>browse-url</em> on <a href="http://maps.google.com">Google Maps</a>.</p>

<p>But it is <strong>too</strong> easy for me, so once again I said: challenge accepted! I will
bring Google Maps into Emacs!</p>

<p>After several hours of work, the <a href="http://julien.danjou.info/google-maps-el.html">google-maps-el project</a> shows a map!</p>

<center>
<p><img src="http://julien.danjou.info/images/emacs-google-maps.png" alt=""></p>
</center>

<p>It fully implements the <a href="http://code.google.com/apis/maps/documentation/staticmaps/">Google Static Maps API</a> and the
<a href="http://code.google.com/apis/maps/documentation/geocoding/">Google Maps Geocoding API</a>.</p>

<p>You can type <strong>M-x google-maps</strong> and type some place to see it marked on map. Of
course you can do much more, as seen in the screen shot above.</p>

<p>I've also completed all of this with a small <a href="http://git.naquadah.org/?p=~jd/jd-el.git;a=blob;f=org-location-google-maps.el;hb=HEAD">org-location-google-maps</a> which
simply show a Google Maps' map for the location of an event in <em>Org mode</em> by
pressing C-c M-l in an Org buffer or in the Org agenda.</p>



<a href="http://flattr.com/thing/47923/Julien-Danjous-blog" target="_blank">
<img src="http://api.flattr.com/button/button-compact-static-100x17.png" alt="Flattr this" title="Flattr this" border="0" /></a>
]]></description>
      <author>Julien Danjou</author>
      <pubDate>Mon, 28 Jun 2010</pubDate>
      <guid isPermaLink="true">http://julien.danjou.info/blog/index.html#M%2Dx%20google%2Dmaps</guid>
    </item>

    <item>
      <title>Announcing rainbow-mode</title>
      <link>http://julien.danjou.info/blog/index.html#Announcing%20rainbow%2Dmode</link>
      <description><![CDATA[

<p class="first">While customizing <a href="http://www.gnu.org/software/emacs/">Emacs</a> this last weeks, I had the need to customize also
the color theme.</p>

<p>Color themes are always a pain in the ass to edit, because you're supposed
to read color strings like <em>#aabbcc</em> and guess what colors they represent.</p>

<p>This is why I wrote <em><a href="http://julien.danjou.info/rainbow-mode.html">rainbow-mode</a></em>, a minor mode for Emacs that will highlight
strings that represents color, using the color they represent.</p>

<p>This support hexadecimal syntax, HTML color name, X color names and rgb()
CSS syntax.</p>

<center>
<p><img src="http://julien.danjou.info/images/rainbow-mode.png" alt=""></p>
</center>



<a href="http://flattr.com/thing/47923/Julien-Danjous-blog" target="_blank">
<img src="http://api.flattr.com/button/button-compact-static-100x17.png" alt="Flattr this" title="Flattr this" border="0" /></a>
]]></description>
      <author>Julien Danjou</author>
      <pubDate>Wed, 16 Jun 2010</pubDate>
      <guid isPermaLink="true">http://julien.danjou.info/blog/index.html#Announcing%20rainbow%2Dmode</guid>
    </item>

    <item>
      <title>Desktop notification support for Emacs</title>
      <link>http://julien.danjou.info/blog/index.html#Desktop%20notification%20support%20for%20Emacs</link>
      <description><![CDATA[

<p class="first">This last weeks, I've worked on implementing the
<a href="http://www.galago-project.org/specs/notification/">Desktop Notification Specification</a> into <a href="http://www.gnu.org/software/emacs/">Emacs</a>.</p>

<p>It allows sending desktop notification in a very simple way.</p>

<pre class="src">
(notifications-notify
    <span style="color: #729fcf;">:title</span> <span style="color: #ad7fa8; font-style: italic;">"You've got mail!"</span>
    <span style="color: #729fcf;">:body</span> <span style="color: #ad7fa8; font-style: italic;">"There's 34 mails unread"</span>
    <span style="color: #729fcf;">:app-icon</span> <span style="color: #ad7fa8; font-style: italic;">"~/.emacs.d/icons/mail.png"</span>
    <span style="color: #729fcf;">:urgency</span> 'low)
</pre>

<p>It supports the protocol signals (<em>NotificationClosed</em> and <em>ActionInvoked</em>) and
the two main methods (<em>Notify</em> and <em>CloseNotification</em>).</p>

<p>The methods specification are implemented entirely (hints, replaces,
actions, icon, etc).</p>

<p>The signals are supported via callbacks function provided on the
notification creation.</p>

<p>It have been merged into Emacs trunk today.</p>

<pre class="src">
<span style="color: #ad7fa8; font-style: italic;">2010-06-09  </span><span style="color: #8ae234;">Julien Danjou</span>  &lt;<span style="color: #ff6347;">julien@danjou.info</span>&gt;

        * <span style="color: #edd400; font-weight: bold;">net/notifications.el</span>: New file.

</pre>

<p>This also allowed me to discover, raise and fix a <a href="http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00228.html">bug</a> in the D-Bus binding of
Emacs, which will be probably fixed in trunk soon.</p>



<a href="http://flattr.com/thing/47923/Julien-Danjous-blog" target="_blank">
<img src="http://api.flattr.com/button/button-compact-static-100x17.png" alt="Flattr this" title="Flattr this" border="0" /></a>
]]></description>
      <author>Julien Danjou</author>
      <pubDate>Wed,  9 Jun 2010</pubDate>
      <guid isPermaLink="true">http://julien.danjou.info/blog/index.html#Desktop%20notification%20support%20for%20Emacs</guid>
    </item>

    <item>
      <title>Announcing erc-track-score</title>
      <link>http://julien.danjou.info/blog/index.html#Announcing%20erc%2Dtrack%2Dscore</link>
      <description><![CDATA[

<p class="first">A couple of months ago, I've started using <a href="http://www.emacswiki.org/emacs/ERC">ERC</a> to hang out on <a href="http://en.wikipedia.org/wiki/Internet_Relay_Chat">IRC</a>.
I've read all the pages on <a href="http://www.emacswiki.org/">EmacsWiki</a> about it, just to see how far I
could customize it.</p>

<p>I must admit that I was not disappointed, even if I expected to be. It's
quite a nice software, and once well configured it's more convenient that my
old <a href="http://www.irssi.org">irssi</a> setup.</p>

<p>While browsing EmacsWiki, I read an interesting idea about channel
scoring/temperature on the <a href="http://www.emacswiki.org/emacs/ErcChannelTracking#toc9">erc-track</a> page. The idea is to see if it's worth
jumping to an IRC channel to see what people are talking about.</p>

<p>Challenge accepted!</p>

<p>I sat up and started to dig though ERC source code to find the information I
needed about variables and functions.</p>

<p>I finally did write something nice, which I called <a href="http://julien.danjou.info/erc-track-score.html">erc-track-score</a>.
And yet another piece of software I wrote for my lovely <a href="http://www.gnu.org/software/emacs/">Emacs</a>!</p>

<p>How does it work? Ha-ha, I was sure you would ask. You're so predictable,
dude! Read the following, and you'll know everything you ever wanted to know
about it since the moment you read the title of that blog entry.</p>

<p>Which probably turned you on.</p>

<p>Nasty you.</p>

<p>First of all, the score of a channel starts at zero. Zero means "seriously,
don't bother, nothing is happening here".</p>

<p>Upon each new message arrival, the score is incremented by 1. If a new
message contains a keyword, your nickname or is sent by a pal, the score is
increased by configurable values, by default between 2 and 20 points,
depending on the match type. On the other hand, when a message is send by
some fool, the score is decreased by 1 by default.</p>

<p>Obviously, if the score is going negative, you really should not jump to the
channel.</p>

<p>Finally, the score is permanently and slowly brought back to 0. By default,
the score is decreased by 1 point every 10 seconds.</p>

<p>Overall, reading the score should gives you a good idea of the channel
temperature.</p>

<p>I'm still not sure what is the best formula to compute the score, but so far
the default values seem quite good. We'll see.</p>



<a href="http://flattr.com/thing/47923/Julien-Danjous-blog" target="_blank">
<img src="http://api.flattr.com/button/button-compact-static-100x17.png" alt="Flattr this" title="Flattr this" border="0" /></a>
]]></description>
      <author>Julien Danjou</author>
      <pubDate>Mon,  7 Jun 2010</pubDate>
      <guid isPermaLink="true">http://julien.danjou.info/blog/index.html#Announcing%20erc%2Dtrack%2Dscore</guid>
    </item>

    <item>
      <title>Thoughts and rambling on the X protocol</title>
      <link>http://julien.danjou.info/blog/index.html#Thoughts%20and%20rambling%20on%20the%20X%20protocol</link>
      <description><![CDATA[

<p class="first">Two years ago, while working on <a href="http://awesome.naquadah.org">awesome</a>, I joined the <a href="http://www.freedesktop.org">Freedesktop</a> initiative
to work on <a href="http://xcb.freedesktop.org">XCB</a>. I had to learn the arcane of the X11 protocol and all the
mysterious and old world that goes with it.</p>

<p>Now that I've swum all this months in this mud, I just feel like I need to
share my thoughts about what become a mess over the decades.</p>

<h3>When I was unborn…</h3>

<p class="first">…the <a href="http://en.wikipedia.org/wiki/Toto_(band)">Toto</a> band were releasing their <a href="http://en.wikipedia.org/wiki/Africa_(Toto_song)">song &quot;Africa&quot;</a> and some smart guys were
working on a windowing system: the X Window System (this is its full name)
which therefore has a (too) long history. The latest version of its
protocol, the 11th one, has been designed in the 80's. You can learn more
about the history in the <a href="http://en.wikipedia.org/wiki/X_Window_System">Wikipedia article about X</a>.</p>

<p>In 2010, we still listen disco music and we still use various protocols
designed in the 80's and even before X. Music have evolved, protocols have
evolved, and so did X11.</p>

<p>The problem is that X11 did not evolve that well. The guys at MIT-and-some
other-places-with-very-smart-people-in-it created X version 1 in 1984, and
updated it until X version 11 (the one we're still using) in 1987. Eleven
version in 3 years, that was following the "release early, release often"
model.  But I don't know why, it just stopped to happen for the last 23
years<sup><a class="footref" name="fnr.1" href="#fn.1">1</a></sup>.</p>

<p>I don't know what changes have been made in the first 11 major versions of
the X protocol, but I'm rather sure we should have deserve a couple of major
version updates this last 2 decades.</p>

<p>In my humble opinion, X11 was not designed to live 23 years. But hey, I'm
not blaming anyone here: I was 4 years old and playing Lego ® when they
released this latest version of the X protocol, so there is little chance
I'd have done something better.</p>

<p class="footnote"><a class="footnum" name="fn.1" href="#fnr.1">1.</a> That's not totally true: they added (and then deprecated) many
extensions.</p>


<h3>We won't fix. We'll work-around.</h3>

<p class="first">That is probably one of the guideline of the X protocol for the last
years. And don't misread me: I'm not bashing anyone thereafter.</p>

<p>Since the X11 protocol was aging, the X guys started to add <a href="http://en.wikipedia.org/wiki/X_Window_System_protocols_and_architecture#Extensions">extensions</a>. They
added tons of them over the years. This, in application of one of
<a href="http://en.wikipedia.org/wiki/X_Window_System_protocols_and_architecture#Design_principles">the early principles of X</a>:</p>

<blockquote>
<p class="quoted">It is as important to decide what a system is not as to decide what it
is. Do not serve all the world's needs; rather, make the system extensible
so that additional needs can be met in an upwardly compatible fashion.</p>
</blockquote>

<p>All of them with no exception were added because, bad luck, the X11 protocol
did not anticipated the things that happened in the last 23 years, like
video, OpenGL, multiple monitors, or the pleasure to draw oval windows. Some
of this extensions are still in use, while some of them have been dropped.</p>

<p>While this is not a bad thing to extends the protocol, it seems like a bad
thing to try to fix the protocol with for example the <a href="http://en.wikipedia.org/wiki/XFixes">XFixes extension</a>, even
with all the good intentions Keith Packard might have in his greatness.</p>


<h3>Actually it's even worst than you think</h3>

<p class="first">The X11 protocol (without extensions) defines about 120 types of requests:
create a window, move a window, etc.</p>

<p>Nowadays, there's at least 25 % of them which are useless: usage of
server-side font, or the drawing of squares and polygon, are unused by any
modern application or toolkit. All of this is superseded by requests from
extensions, like the <a href="http://en.wikipedia.org/wiki/XRender">XRender</a> one.</p>

<p>The handling of multiple monitors displays has totally been screwed up. X11
has been designed to work in <a href="http://en.wikipedia.org/wiki/Zaphod_Beeblebrox#Cultural_references">Zaphod</a> mode (independent monitors). But
<a href="http://en.wikipedia.org/wiki/Xinerama">Xinerama</a>, and nowadays <a href="http://en.wikipedia.org/wiki/XRandR">XRandR</a> have replaced it up: recent X servers
(released after ~2007) does not support Zaphod mode anymore, even if it's a
core piece of the X11 protocol.</p>

<p>Worst: on many requests, there's limitation or design flaws, like described
in this document: <a href="http://www.std.org/~msm/common/protocol.pdf">Why X Is Not Our Ideal Window System</a> by DEC researchers.</p>


<h3>We'll add more broken standard on top of that</h3>

<p class="first">Following <a href="http://en.wikipedia.org/wiki/X_Window_System_protocols_and_architecture#Design_principles">its early principle</a>, X does not define policies but only
mechanisms, which seems like a good thing,</p>

<p>Consequently, people started writing specifications to determine a number of
stuff and dogmas: <a href="http://en.wikipedia.org/wiki/ICCCM">ICCCM</a>. That was 22 years ago in 1988. It's useless to add
that many things in this specification are now obsolete, useless, or that it
misses many modern stuff.</p>

<p>I was not the only one to think that. The people from what will be the major
desktop environments, <a href="http://www.kde.org">KDE</a> and <a href="http://www.gnome.org">GNOME</a>, saw that too in the 90's while I was
learning to count. So they wrote <a href="http://en.wikipedia.org/wiki/Extended_Window_Manager_Hints">EWMH</a>, another standard that comes on top of
ICCCM and extends it with nifty features like maximization, full screen
mode, etc.</p>

<p>The problem is that this standard has also been written by narrow-minded
people who at that time, were working on GNOME or KDE (and maybe
others). This desktop environments were having and still have some strong
concepts of how should work a desktop: "it should have work-spaces", "a
window is only on one workspace", "we only see a workspace at a time", "you
do not have multiple screens", etc.</p>


<h3>Dude, we don't care: we have toolkits!</h3>

<p class="first">This vision of how the desktop should work have now been written in marble
in all applications and libraries implementing EWMH, like <a href="http://www.gtk.org">GTK+</a> or <a href="http://qt.nokia.com">Qt</a>.</p>

<p>Nowadays, everybody forgot about all of this standards. Toolkits have
implemented this, circumvented the X11 protocol limitation and flaws, and
nobody wants to look back.</p>

<p>Like all standards, obviously some people implemented them badly. This had
some side effects, like <a href="http://julien.danjou.info/blog/2009.html#OpenOffice%20is%20better%20as%20a%20pager%20than%20as%20a%20text%20processor">OpenOffice acting like a pager</a>.</p>


<h3>We don't look back? Worst, we forgot where we came from!</h3>

<p class="first">With all these layers of bad designed standards, the desktop continued to
evolve for more than a decade. They continued to add more standard, the more
recent ones being based on D-Bus like the <a href="http://www.galago-project.org/specs/notification/">Desktop Notification Specification</a>
or the latest <a href="http://www.notmart.org/misc/statusnotifieritem/index.html">Status Notifier Specification</a> developed by KDE.</p>

<p>The Status Notifier is a new implementation of the good old system tray
based on <a href="http://en.wikipedia.org/wiki/XEmbed">XEmbed</a>, using <a href="http://en.wikipedia.org/wiki/D-Bus">D-Bus</a> instead of the X11 mechanisms, and adding the
possibility to show the system tray with something else than icons.</p>

<p>This specification draft saw an important issue and design flaw raised by
Wolfgang Draxinger in <a href="http://lists.freedesktop.org/archives/xdg/2010-May/011516.html">this thread on the XDG mailing-list</a>. What Wolfgang
points out, is that X is network-oriented, and D-Bus is not. Therefore,
making the Status Notifier specification to use D-Bus to pass system tray
messages around is a bad idea, since running a X application from host A on
host B will draw the system tray on the wrong host!</p>

<p>Apparently, reading the thread, this <a href="http://lists.freedesktop.org/archives/xdg/2010-May/011531.html">does not fear some of the KDE people</a>:</p>

<blockquote>
<p class="quoted">of course this is a bizarre corner case not worth much thought. at least
that's what you'll think until you actually run into it yourself (be it
because you are testing something or because you are setting up some
weird kiosk environment).</p>
</blockquote>

<p>What Oswald describes as a corner case is an actual common use case for many
of us. Of course, YMMV.</p>

<p>From my point of view, this is a step back in the wrong direction. But we
can conclude that the network part of X is now worthless, to at least KDE.</p>


<h3>I used to believe in XCB</h3>

<p class="first">When I joined Freedesktop, it was to work on XCB, the X C Binding. XCB is a
nice, clean, 21st century technology based API to play with the X11
protocol. Its code is auto generated based on XML file describing the
protocol.</p>

<p>In comparison, Xlib is 80's obfuscated code with almost no comments and
hard-coded things. Only a few people can understand some of its corner like
its i18n or XKB implementations. And all its code is <em>synchronous</em>.</p>

<p>For people not knowing it yet, X is a network protocol where you send
request (like a GET in HTTP) and then get a response. Xlib forces the
application to wait for the reply to its request, so the application is
blocked until the X server sends the reply to the request. XCB on the other
hand does not block and allows the application to send a batch of requests,
do some other stuff in the mean time, and then gets the replies.</p>

<p>It's like your Web browser would send one request at a time to a Web server,
and would wait until you downloaded all the images one by one to display the
page.</p>

<p>In cases where X and all its clients are on the same host, the latency is
small and not really visible, therefore the gain for XCB to be asynchronous
is small. On slow network however, the gain can be huge, as proved in the
<a href="http://bugs.freedesktop.org/show_bug.cgi?id=4232">rewrite of xlsclients with XCB by Peter Harris</a>.</p>

<p>One of the long standing goal of the XCB folks is to kick-out Xlib, to
increase speed and hides latency in X11 applications. That requires to port
many libraries, because almost none of them (<a href="http://www.cairographics.org">Cairo</a> being an exception)
supports XCB.</p>

<p>From where I stand, I don't really see if the work is worth it now. The
desktop world is trusted by GNOME and KDE, meaning GTK+ and Qt. It seems
none of this toolkits are interested to work on XCB, neither on the X
protocol. They probably put hard effort in bypassing X limitation and flaws,
and they now sit on top of crap of workarounds and broken-by-design-standard
implementation. It seems to me they don't want to go back in the layers and
improves things.</p>

<p>They're too high to go back down and they don't see what the gain would be.</p>

<p><a href="http://www.enlightenment.org/">Enlightenment</a> with its <a href="http://www.enlightenment.org/p.php?p=about&amp;l=en">EFL</a> was the first toolkit to have an XCB back-end
with the work of Vincent Torri. Unfortunately, the back-end is not
maintained and nobody cares about it. Last time I tried it, it did not
compile at all.</p>


<h3>X12 ?</h3>

<p class="first">There's a page called <a href="http://www.x.org/wiki/Development/X12">X12</a> on the Freedesktop wiki, listing all the things
that should be fixed some days. Unfortunately, the list continues to grow up
an no one talks about working on X12.</p>

<p>On the other hand, there's a handset of people trying to work when they will
have time on <a href="http://www.freedesktop.org/wiki/Software/XKeyboardConfig/XKB2Dreams">XKB2</a>, the second version of the "let's-try-to-fix-up-the
keyboard-part-of-the-protocol-we-wrote-23-years-ago-a-second-time"
extension.</p>

<p>To me, it does not seem X12 will happen in the next decade neither.</p>


<h3>Alternative ?</h3>

<p class="first">Do we got alternative to X ? There's <a href="http://en.wikipedia.org/wiki/Wayland_(display_server)">Wayland</a>, but it's far from being
usable. There's <a href="http://www.directfb.org/">DirectFB</a>, but that's not very portable. None seems candidate
to replace X some days to me.</p>

<p>Anyhow, none of the main toolkits around support this alternative. GTK+
once supported DirectFB, but as far as I know, it is not supported nor works
nowadays, as stated by <a href="http://np237.livejournal.com/27459.html">Josselin Mouette</a>. This is why recent versions of the
Debian installer have migrated to X for the graphic part, thanks to Cyril
Brulebois work.</p>


<h3>Conclusion</h3>

<p class="first">XCB has been around for more than half-a-decade, and very few people showed
interested in it. As far as I can see, nobody is interested to use the X
protocol and everybody tries to encapsulate it in some higher-level API as
soon as possible to stop seeing it. This leads to poorly written application
and toolkits, with a lot of ugly hack.</p>

<p>All of that also means that starting to write applications and graphical
toolkits based on XCB would be a very interesting project, but that would
lead to spend too much time learning to circumvent the X protocol flaws,
things that have been done in years by predecessors like Qt and GTK+.</p>

<p>Major toolkits implementations have almost nothing to win in going back in
the dark water of X. I guess most of their folks prefer to work on shiny 3D
effects based on your GPS location, rather than redefining better basis for
everyone.</p>

<p>The manpower available in the X world is very small. Debian lacking of X
maintainers is just the summit of that. There is very smart and very
competent and skilled guys in the X world, as you can see by simply reading
blog posts on <a href="http://planet.freedesktop.org">Planet Freedesktop</a> for example (me excluded). Unfortunately,
there's not enough of them to cover all the things involved in X: input
devices, graphics devices, new protocol extension specification and so
on. The X server is really late, and it seems most of the developers prefers
to work on the server itself than on the protocol behalf. Which is
understandable.</p>

<p>I'm curious to see where all of that will lead in the upcoming years. I've
been walking in the X world hallways for about 3 years now, and I feel
desktop alternatives to KDE and GNOME will all die sooner or later. The time
were you could choose between a dozen "modern" window managers has passed
away.</p>

<p>After all, maybe that is simply Darwinism applied to computer software.</p>




<a href="http://flattr.com/thing/47923/Julien-Danjous-blog" target="_blank">
<img src="http://api.flattr.com/button/button-compact-static-100x17.png" alt="Flattr this" title="Flattr this" border="0" /></a>
]]></description>
      <author>Julien Danjou</author>
      <pubDate>Tue,  1 Jun 2010</pubDate>
      <guid isPermaLink="true">http://julien.danjou.info/blog/index.html#Thoughts%20and%20rambling%20on%20the%20X%20protocol</guid>
    </item>


  </channel>
</rss>
