Funded project proposal: Cambalache macOS port

The need for a UI editor

LibreOffice’s UI is defined in GtkBuilder XML files that used to be edited with the Glade Interface Designer. Glade’s development was sadly discontinued and it is currently being dropped from Linux distributions. Fortunately there is a spiritual successor for Glade called Cambalache. It has recently reached production-readiness, but it is only available on Linux.

As LibreOffice development is supported on all the major platforms, we should make it possible for contributors to easily edit the UI files without jumping through hoops. A Cambalache macOS port would be a big step in that direction.

We have discussed with a developer who we could contract directly for this project. It seems the cost would be comparable to the other third party tooling improvement projects we’ve run, such as the Bugzilla upgrade work.

The scope of the work

Changes are required in multiple dependencies. We would like all of the changes to be upstreamed.

Wayland libraries

At a minimum, build system patches are required for detecting macOS. The epoll-shim library might be used like in the case of FreeBSD and OpenBSD.

wlroots

The Wayland compositor GTK 4 widget Casilda does not need a fully working copy of wlroots so it should be possible to disable most Linux specific dependencies.

Casilda

Casilda is a Wayland compositor widget created for Cambalache. Once wlroots is working, building Casilda should be easy.

GTK Wayland backend

GTK on macOS should also build the Wayland backend, if it finds the dependencies.

1 Like

Hmm. Let me pose some skeptical questions about this suggestion… :

  1. Do contributors need to be able to edit UI files on our target platforms?
  2. If we are to fund a port to another OS - why MacOS? It’s a commercial OS with few users. If anything, would we not want to port it to MS Windows?
  3. Does this initiative agree with the intent to orient ourselves towards support Qt on all platforms? If that is our orientation, should we not invest, rather, in moving our UI files to a format that’s native to Qt, with a filter which can convert them back?
    … in fact, even without a switch to Qt - would it not be possible to develop conversion filters among different UI description formats, which would allow contributors to use other editors - and thus also possibly edit them on other platforms?
  4. Does Cambaleche (on Linux) rely on GNOME being installed? Does it rely on systemd being installed? If so, we should probably start with a port from GNOME/Linux to GNU+X11/Linux.
  5. Does it make sense to support an app which targets Wayland exclusively? And contribute to Wayland project? Wayland is a misguided initiative; see, e.g. Think twice about Wayland or Wayland is flawed at its core and the community needs to talk about it, etc.); we should not be encouraging Wayland. It is worth mentioning that Wayland yet another thing the IBM/RedHat people are trying to foist on us via GNOME, which recently dropped X11 support, claiming that by doing this they are single-handedly “ending the X era” for everyone. If we support Cambaleche, it should be in the direction of removing its dependence on Wayland and getting it to work on X11. If it were to use an X server as the backend, then (that part of) it would work just fine on MacOS with XQuartz.
1 Like

In this case as it’s a sufficiently low-hanging fruit, yes.

A native Windows app would likely be a much bigger project compared to this “Unix to Unix”. Cambalache works under WSL and WSL is anyway a requirement for a LibreOffice build setup at the moment.

Moving to Qt’s UI format would be a massive effort which should not block this current editor transition.

I have tried it on a Linux system with KDE and no GNOME. I didn’t see it having a systemd dependency. I suppose it would be rather more complicated to get working on macOS, if it depended on systemd.

Wayland is fine and it’s certainly not an IBM/Red Hat project, but has diverse implementations. KDE Plasma 6.8 released recently dropped X11 session support as well.

The need does not depend on whether offering an editor is a low-hanging fruit or not. The question is whether the UI design itself is hampered or degraded if one edits the UI files on a different platform. Say, due to the preview rendering behaving differently on different platforms.

Anyway, IIUC, the argument is convenience for the UI designer. Well, I am doubtful it makes sense for TDF to invest in this kind of convenience on a non-free commercial OS.

That’s not the main point. The main point is - why can’t we just use a converter from the Glade/GtkBuilder format to the Qt Designer format whatever format, then run Qt Designer (or the designer aspect of Qt Creator)? It runs on Linux, BSD, Windows and MacOS.

Also, no, Wayland is not fine. And the fact that KDE is intended to drop X11 support in favor of Wayland is a bad thing.

Does Cambaleche (on Linux) rely on GNOME being installed?

Not Gnome but the Gtk toolkit → AUR (en) - cambalache

Because that would entail rewriting the current UI system in LibreOffice. That can be a long term goal, but right now we need to deal with this abandonware situation.

I’m not suggesting that. I mean, yes, long-term maybe that would make sense, but - to edit on Windows or Mac, one would convert the existing UI file to the Qt Designer format, edit it in Qt Designer, then convert back. Assuming there isn’t an expressive ability issue, and that the conversion filters are written carefully (e.g. for round-trip identity) that should work.

I got some clarifications on the technical details. Cambalache runs on any windowing system where GTK does, Wayland is used internally to embed the windows being edited. It works just fine in a X11 host.

For Windows it might be easier to just use the native Windows API to embed the windows directly.

That’s an interesting idea.

One challenge would be that there isn’t a direct mapping between everything in the GtkBuilder file format (that we currently use) and the Qt Designer UI files. For example, for GTK, the model for GtkIconView or GtkTreeView is defined in the .ui file, while I don’t think there is anything comparable in Qt Designer, so that would bring up interesting questions on how to achieve a round-trip that doesn’t lose relevant information and allows editing everything relevant in Qt Designer (or another editor of choice).

In general, I expect figuring out a proper mapping between the two UI file formats to be non-trivial when conversion needs to be supported both ways.

I’m not sure I understand that sentence, specifically the use of the word “model” in it. Do you mean that in GtkBuilder you can say “the UI will include a GtkIconView at this position”, and in Qt Designer you can’t? Because that should not be an issue, seeing how UI elements are not supposed to be VCL-specific. But you probably meant something else.

Indeed, I was talking about something else than widget positioning.

In GTK, the data to be displayed in GtkIconView and GtkTreeView widgets comes from models, in our case typically GtkTreeStore and GtkListStore. The models (and what columns they have, which model column to use for the data to display in the widgets and in which treeview column, which model column to use for the tooltip, etc.) are currently defined in the .ui files. I’m not aware of any equivalent in the UI format used by Qt. (But I’m also not very experienced with that one, mostly have been working with Qt widgets etc. directly via C++.)

(You’ll have to excuse my ignorance, as while I am a developer, I’ve not written desktop apps and don’t know about the UI file format.)

So, GtkTreeStore, GtkListStore - these too are, well, GTK-specific, and thus VCL-specific, are they not? When we load a UI file in LO using the QT VCLs, what do we do with all of these GtkWhatever entities? Do we not ‘translate’ them on-the-fly to some combination of Qt widgets?

Also - perhaps the relevant path, in addition to conversion filters, could be expanding the expressivity of Qt Designer to better cover our needs? That too is development effort, but the benefit would be that the we would get support for all platforms at once (including Windows and *BSD).

Yes, in a way they (as pretty much everything in the .ui files) is GTK-specific since we’re using GTK 3’s .ui file format. For the GTK-based vcl plugins (gtk3, gtk4), the .ui file is directly processed by the GTK library to produce GTK widgets etc.
For the vcl and Qt-based implementation, there is indeed custom logic to parse the .ui files (which are XML files) and create vcl or Qt widgets based on that. (That C++ logic lives in the WidgetBuilder class and the VclBuilder and QtBuilder subclasses, if you want to take a look.) They ignore certain properties (that are relevant for the GTK implementation) or do various tweaks from what is originally defined in the .ui file.
So there is some way for a GTK .ui file format → Qt widget conversion, but not using a UI file for the Qt part and one that’s not easily revertable (i.e. the conversion the other way around back to a GTK UI file isn’t clear/straight-forward, also because some of the original properties are not used for Qt or due to tweaks to the widget hierarchy etc. to take into account that there isn’t a 1:1 mapping between everything that GTK and Qt do and how they approach things.)

I am not sure yet what extensions to Qt Designer you’re thinking of. Adding properties that are irrelevant for Qt itself but needed only for GTK or vcl widgets (after converting from the Qt UI file format to the GTK one) to me sound like something that’s not really in the scope of an application whose purpose is to edit Qt .ui files. (It should be technically possible to add, but probably not something upstream is interested in.) If extra logic is needed, having either the “conversion filter” (from Qt .ui to GTK .ui) or C++ code creating the widgets from the .ui file (building a dialog) do that sound like the more straight-forward way to me, but would likely require reworking how the UI is handled in LO in a more general way.

If we want to rework the approach more fundamentally and the idea is to use Qt Designer, I suspect that instead of having to maintain a two-way conversion possibility (GTK <-> Qt UI files), switching to Qt’s UI file format as the primary source and having a way to create GTK and vcl widgets from that might be more promising. That should be technically possible, but I expect it would be a lot of work.

@ilmari If you let me know the sum we should provision, then I can start a vote.

I would provision 10k euros, thanks.

here again, “a developer” …
doesn’t look good :face_with_thermometer:

on what effort, what deliverable, what deadline ?

(for the sake of politeness to interested readers, the context seems to be : https://bugs.documentfoundation.org/show_bug.cgi?id=163947 )

The context is not that report, but explained in my starting post, including the deliverables. The details will be worked out in the contract negotiation.