TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Xlibe – A serverless Xlib (X11) compatibility layer for Haiku

116 pointsby waddlesplashabout 3 years ago
Hello HN,<p>While there are some projects that implement partial versions of Xlib APIs on non-X11 platforms for compatibility (most notably, Tk), I don&#x27;t know of any others sophisticated enough to run Cairo and GTK applications (albeit with a few hacks). So I figured this might be technically interesting.<p>As of now it just implements the base Xlib APIs, it doesn&#x27;t implement XRender, GLX, XInput2, etc. (though it&#x27;s more than possible, I just didn&#x27;t see a need yet.) Cross-program interaction is also very limited, and there are plenty of X11 features that likely can&#x27;t be implemented; but this works sufficiently well that GTK3 is now in Haiku&#x27;s default package repositories, with GIMP and Inkscape atop it to boot, using this.<p>And for the fun of it, I did try to compile Xnest (the X.org server variant running on top of Xlib) on top of this; it crashed on startup in the keyboard handlers. However, that could potentially be because I didn&#x27;t have the necessary data files and not because of anything missing in Xlibe; I didn&#x27;t investigate too far (or it could be an actual incompatibility; Xlibe&#x27;s keyboard subsystem is rather primitive and is most of the reason I had to patch GTK for full functionality.)<p>(A few more screenshots, including GTK and WINE running atop Xlibe: <a href="https:&#x2F;&#x2F;www.haiku-os.org&#x2F;blog&#x2F;waddlesplash&#x2F;2022-01-10_haiku_contract_report_december_2021&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.haiku-os.org&#x2F;blog&#x2F;waddlesplash&#x2F;2022-01-10_haiku_...</a>)

13 comments

waddlesplashabout 3 years ago
A few more technical details, for the interested:<p>* Every X11 &quot;Window&quot; gets its own BView (which is itself vaguely analogous to a QWidget in Qt, etc.) and of course top-level &quot;Window&quot;s attached to the root get their own &quot;BWindow&quot; as well.<p>* All drawing goes through the Haiku drawing APIs. (This does create some artifacts in applications that expect X11 drawing isn&#x27;t antialiased, like most Xt&#x2F;Xaw applications, but it works tolerably well.)<p>* Since Haiku has no &quot;display server&quot; &#x2F; &quot;windowing system&quot; divide, all operations related to both are directly handled in Xlibe. This creates some trickiness when applications request &quot;window manager bypasses&quot; in tandem with modality management, and also in decorations&#x2F;borders handling, but it works well enough.
评论 #31192312 未加载
mappuabout 3 years ago
X11 API without an X server is a super cool concept. I followed the forum thread after OSnews reported on it late last year <a href="https:&#x2F;&#x2F;www.osnews.com&#x2F;story&#x2F;134362&#x2F;xlibe-an-xlib-x11-compatibility-layer-for-haiku&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.osnews.com&#x2F;story&#x2F;134362&#x2F;xlibe-an-xlib-x11-compat...</a> and your progress has been really exciting to watch. It&#x27;s a great project. When Haiku got a Qt port it made a massive difference in software availability and this will too.<p>GTK will always owner-draw its buttons, so you don&#x27;t get a real native Be widget. And it&#x27;s clearly possible to do a good-enough X server integration as demonstrated by WSL, Quartz etc with minor complaints about clipboard syncing, decorations, having to run another daemon etc. After all that, what would you say is the main benefit to this approach?
评论 #31187982 未加载
rayinerabout 3 years ago
I haven’t followed BeOS stuff since the early oughts, but I’m floored at how mature Haiku has gotten. A modern GCC? Xlib mature enough to run GTK? A native QT backend? I also noticed what appears to be a well along Emacs backend as well. Amazing progress for an independent OS project.
评论 #31188296 未加载
throwaway82652about 3 years ago
I hate to be the one who has to say this, but this is a bad idea. If this is being done for practical reasons then don&#x27;t waste your time with this. It might work for some clients but you&#x27;ll get stuck in the same place that every other re-implementation of X11 over the last 30 years got stuck at, which is supporting any kind of weird quirky behavior in Xlib and its large collection of client libraries, and the rest of the quirky behavior in the X server. Eventually you&#x27;ll end up copying large sections of code out until it slowly transforms back into Xlib and Xorg and effectively it becomes another approximation of an X server. If that&#x27;s fine with you then by all means keep going, but please don&#x27;t continue along with the idea that you can avoid this. It has been tried many, many times before.
评论 #31188321 未加载
评论 #31191733 未加载
marwisabout 3 years ago
Similar thing but for Win32 - <a href="http:&#x2F;&#x2F;libw11.sourceforge.net&#x2F;" rel="nofollow">http:&#x2F;&#x2F;libw11.sourceforge.net&#x2F;</a>
yjftsjthsd-habout 3 years ago
&gt; serverless<p>So this is a compatibility library? Not just a server that runs without a root window?<p>&gt; but this works sufficiently well that GTK3 is now in Haiku&#x27;s default package repositories, with GIMP and Inkscape atop it to boot, using this<p>That is absolutely fantastic:)<p>&gt; And for the fun of it, I did try to compile Xnest (the X.org server variant running on top of Xlib) on top of this; it crashed on startup in the keyboard handlers<p>I don&#x27;t have a Haiku box handy to test - is Xephyr any easier&#x2F;better? It seems to be the &quot;modern&quot; option.
评论 #31188054 未加载
badsectoraculaabout 3 years ago
How hard would be to abstract the Hauku-specific bits into their own part? It&#x27;d be neat if it was possible to use this not only to target Haiku but also other window systems like Win32 and Cocoa.<p>Does something like Gtk1.2[0] (which AFAIK does more heavy use of xlib than modern GTK) work? How about Motif?<p>[0] <a href="http:&#x2F;&#x2F;runtimeterror.com&#x2F;pages&#x2F;badsector&#x2F;gtk12&#x2F;" rel="nofollow">http:&#x2F;&#x2F;runtimeterror.com&#x2F;pages&#x2F;badsector&#x2F;gtk12&#x2F;</a>
评论 #31191938 未加载
marcodiegoabout 3 years ago
Something that maybe interesting: running it under DOS. That would allow porting some apps to FreeDOS.
AshamedCaptainabout 3 years ago
Very cool. I guess the drawing functions are mapped to Be drawing routines, which means probably using this on say Android would be a big effort.
评论 #31188027 未加载
bitwizeabout 3 years ago
This is neat.<p>I thought one time of bringing X apps to Windows in a source-compatible way by embedding an X server similar to Kdrive in a library that communicated with the application via a ring buffer or similar. It&#x27;s cool to see similar work actually being done.
loxiasabout 3 years ago
Interesting! I love stuff like this (compatibility layers like wine, darwin).<p>I think a better title might include mentioning what Haiku <i>is</i>, though 15 seconds of googling worked just as well. :)
sitkackabout 3 years ago
Could this awesome work be used to getting X11 running in the browser?
评论 #31188040 未加载
评论 #31188395 未加载
评论 #31188048 未加载
DeathArrowabout 3 years ago
Ideally apps should be ported using Haiku&#x27;s native GUI.