Xlibe: an Xlib/X11 compatibility layer for Haiku

I’ve actually been keeping an eye out for things that use just plain Xlib and not some higher toolkit to use as testcases (Tk was originally good for that), so I might try both of these out and see what they uncover.

Emacs is a great program to use for that: the native port aside, you can build Emacs with “–with-x-toolkit=none --with-x --without-cairo --without-xft” to get a build of Emacs that only uses Xlib.

1 Like

Yes, I know, but to be honest this is really awkward to use :frowning: The X11 compatibility layer might yield better results once it is working.


I’m sure they’ll be some blasphemy called here, but this is a great stepping stone for an initial WINE port. Whilst many a moon ago, POSIX was a big stumbling block, the work done on POSIX in recent years probably largely makes that point moot. X11 is probably the biggest issue to getting an initial WINE port working now.

1 Like

What is the point of guessing?
Last time I checked the biggest issues were still declared to be adress space layout and some signal stuff, aswell as registers.

Wine world just fine in headless mode, so someone should figure that out first.

1 Like

Good day @waddlesplash ,

Great work you are doing with X. Having inkscape, gimp and Firefox on Haiku would reduce the need of using other oses. I personally use inkscape a lot so right now I switch back and forth quite more than what I would like.

Really appreciate your work on this topic.



11 posts were split to a new topic: Porting utility that can map to native APIs?

9 posts were split to a new topic: Native applications and fragmentation

Agree! This would be amazing.

I have fixed the redraw glitches (this was actually partially a problem in Haiku itself; I pushed some patches to Gerrit to resolve it), the hangs on mouse click events (the mouse now mostly works), and crashes on key events (however keyboard input does not work yet.) After a few other compatibility fixes, the “widgets” demo starts and displays largely correctly:



Awesome progress! I wonder if it is possible to change the widget look to be more native?


GTK supports theming, yes. @3dEyes took the time to install a Haiku-like theme for his demos; I haven’t bothered with that for the present.


Another update: a number of patches to GTK itself were required in order to avoid having to implement the full XKB structures (which basically nothing else seems to make use of), in addition to a variety of patches to Xlibe, but now keyboard events largely work; only Ctrl/Cmd-based shortcuts do not seem to activate for some reason (however, they also apparently do not work in Tk, so there is likely some common cause.)


Try using DispatchMessage instead of MessageRecieved to handle keyboard messages.
The same way you should handle B_UNMAPPED_KEY_UP/B_UNMAPPED_KEY_DOWN also.


Yes, I’ve just remembered that, and have over half of it written already. :slight_smile:


Done. Now Cmd-key shortcuts work in GTK windows. Next I should probably implement some or part of pointer grabs so it stops crash-asserting on menus, and figure out why windows seem to have no title most of the time.


Can you provide GTK build instructions to be used with Xlibe?


Would it be possible to use Haiku font rendering in GTK applications? Looks like X11 an Tk applications already use native rendering?

1 Like

At present it requires a number of hacks and some other patches that I only have locally (for example, fixing the build without XSync, though I probably should just add compatibility stubs for this; and now more importantly, calling Xlib to do key-event translation instead of reading the XKB tables directly.) I will post these somewhere before too long, but not just yet.

Indeed they do.

Unfortunately I don’t think it is, at least that I can see. While there is some Xft code in GTK it appears to just be used to get certain settings (e.g. antialiasing on/off) and not to do any actual font rendering that I can see :confused:


As far as I know, starting from GTK 2 all rendering is done offscreen using cairo, including font rendering. The only X11 rendering method GTK uses is XPutImage.

1 Like