Haiku backend in GTK/GDK?

I read some discussions in the forum about GTK. But I could not get the feeling if there is some fundamental reason there is not yet an Haiku backend for GDK. I have skimmed over the source files for other backends (Wayland, Quartz, Broadway) which are already implemented and does not seems an impossible project. Did somebody already tried?. (Personally, the main motivation would be to have Inkscape available in Haiku).

3 Likes

It’s possible and there isn’t any technical limitation for this other than the language used and its likely to be an out-of-tree implementation due to the Haiku API being only accessible via C++ whereas GTK/GDK appears to accept C-based implementations. (Parts of the Quartz implementation are in Objective-C).

It’s unlikely that it will be ever upstreamed if someone does this anyway, but then again that could change.

I see no problem that it will be not upstream.

One of problems in porting GTK3 it that it display window border themselves, but Haiku display window border in app_server. Default GTK3 theme also use window semi-transparency that is not supported by app_server.

1 Like

GTK3 uses the system window borders on Windows and macOS though, so there’s some way to get that behavior.

Yes, seems that on Mac the borders look ok. Maybe I will give a look.

One thing to be aware of when doing these things is that in Haiku a window is always a separate thread running its own event loop. If GTK expects all callbacks to happen in the main thread instead, you need to somehow forward events between the two threads.

Drawing strategy can also be a concern, normally in Haiku there is no buffering, apps draw directly to the framebuffer and need to be able to redraw any part at any time on request from the app_server. If that doesn’t work for GTK, you will need to have it draw offscreen to a BBitmap and have code to copy data from that BBitmap to the display. It has been done (for example in WebKit and in the LibreOffice native backend, and I guess probably in the Qt backend as well).

So, nothing impossible, it’s just quite some work and there are these caveats to know about.

2 Likes

Little progress in my experiments:
screenshot49

28 Likes

Why little progress, its big progress! It looks already usable. Are sources and build instructions available?

It is possible to support native window borders?

1 Like

wow… great :blush::heart_eyes: …

It looks already usable.

No. Is not a usable. Only window creation, set geometry and redrawing hooks are implemented.

It is possible to support native window borders?

I don’t know, how disable gtk3 default decorator. And what should I do with the buttons on the window title if I turn it off?

3 Likes
9 Likes

Move to tool bar?

1 Like
1 Like

3dEyes, this is unbelievably epic! VERY nice work! I’d glanced at GTK before, myself, but the C OOP was just too much for my tastes… and it already even looks native, wow!

How long before we have GIMP? Maybe in time for beta2? :wink:

4 Likes

GIMP use GTK2 that is not ported.

GIMP 2.10 can run against GTK3 already. I think it is slightly less stable and not “officially supported”, but it is handled out of the box so far as I know. Same for Inkscape.

and it already even looks native, wow!

Installed this gtk+ theme:

4 Likes

It is still very early to port GIMP.
There is no mouse, keyboard, window styles and everything else)
Right now there are only windows and surface rendering.

And gtk crash in open dialogs.

I would hope for something as simple as the Contacts app (if not the possibility sync contacts makes the app difficult to “port”).

Some progress:

28 Likes