Development: Exchange Libreoffice "Main Frame" with a GTK4 one?

Hi,

so I just wanted to start on playing around with the code of libreoffice from a design perspective (for my own purpose). Setup ist correct, can compile for gtk4 and also debug the builds. Also read introductory slides on the code structure et cetera. However I am a bit lost :wink:

What I basically want to do is exchanging the “main frame” of e.g. swriter to use a GTK4 Frame (with .ui file). I do not know whether this is easily possible; I saw the “menubar.xml” file and .ui files of other more “leafy” elements in the structure (e.g. About dialog); but I was not really able to figure out, how the “main frame” is instantiated and therefore, do not know whether such a frame would be easily exchangable with a GTK4 variant. I did however recognice /desktop/source/app/app.cxx.

Could you please give me a hint on that start or point me into the right direction?

Kind regards,
Christian

2 Likes

The goal of mine would be whether I could get GTK4s libadwaita (GNOME / libadwaita ¡ GitLab) to work with libreoffice.

You should email the developer list about it (and subscribe) and I guess Caolån can discuss it with you. However, there is currently a very rare issue with the list and you should wait until this ticket gets resolved: Missing emails from libreoffice@lists.freedesktop.org (#400) ¡ Issues ¡ freedesktop.org / freedesktop ¡ GitLab

1 Like

Just for documentation: @caolan answered this to me via #libreoffice-dev (06.12.2021, 10:57):

it is a gtk4 GtkWindow in --enable-gtk4, it doesn’t have client side decorations, except in RTL mode where it does actually use a GtkHeaderBar, but makes it looks like it doesn’t
so vcl/unx/gtk3/gtkframe.cxx has a gtk_header_bar_new new in it, but guarded with some conditions, remove the conditions and play around with that area

and there is no .ui file yet.

Will investigate from there on and see how far I can get :wink:

Sorry, this will be the first thing to be disabled. Flat design with widgets from mobile phones is an ergonomic no go.

So, investigated further and came up with a POC :slight_smile: (see attached image).

Does not use libadwaita but rather “default” set of gtk ui elements; nothing fancy, but as I pointed out, first “baby steps” (also for me figuring out the code).

I will go on play around more; in the meantime: What do you think?

1 Like

Can you add some form controls? In the “Form” menu you find a design mode button and form controls checkbox, radio button, numeric field (with spin button, please), a scroll bar, drop-down listbox, combo box etc. These are the weak points why I use to disable gtk in favour of the clear and functional generic set (win 95 style).

@Villeroy I will try my best :slight_smile: However please keep in mind that I just had the first look at the (vast) LO code just yesterday. But I will keep you posted. Maybe I / we can find a solution that works for both worlds. I am with you on the fact when there is a vast amount of subcategories for menus, a certain set of the old-school menubars would be better.

However, maybe the younger generation prefers the exact opposite (I am 32 myself :wink: so not in that category anymore). There are several interesting papers on how younger generations perceive work with the “regular” computer, e.g. this one: Kids who grew up with search engines could change STEM education forever - The Verge
Therefore, I currently try to think of ways on how to make at least certain actions “easier” and at the same time fancier looking, while making use of the new possibilities of the toolkits (e.g. GTK4). IMO it would be a great win for an open source office suite like libre office :slight_smile:

1 Like

For later reference, some of the talks @caolan @quikee and me had in the last couple of hours on #libreoffice-dev (citation):

@caolan

we have a uxdesign list The Libreoffice-ux-advise Archives and/or the ordinary bug tracker and follow QA/Bugzilla/Fields/Keywords - The Document Foundation Wiki to summon ux to have a look at an idea

@quikee

there is also #libreoffice-design:libera.chat where you can show to the ux people the idea

As was pointed out in #libreoffice-design channel, I created a bug ticket for that very matter. You can find it here: https://bugs.documentfoundation.org/show_bug.cgi?id=146085

Alright guys, I did it! Got libadwaita (Adw – 1) to work in LibreOffice GTK4 build :partying_face: Thx @caolan for hinting me at how to add new libraries to LO.

I tried to get interface done analogous to the mockup presented in https://bugs.documentfoundation.org/show_bug.cgi?id=115512.

Afterwards, you can see the pictures of the interface. Please let me know what you think so far :slight_smile: In general I am very pleased with this toolkit; especially that it is “just” in the beta state and already delivering so much nice functionality to use. E.g. as you will see in the pictures, I used light and dark themes and also made advantage of a TitleViewer that adjusts to the horizontal space that is left in the titlebar.

P.S.: @Villeroy do not fear that libadwaita is just for mobile devices; I have configured the interface in a way, that it will not take advantage of the small views.

2 Likes

2 Likes

2 Likes

2 Likes

2 Likes

2 Likes

2 Likes

And here is another version using the “old” style (in this case the Ubuntu 21.10 system theme).

2 Likes

So I was investigating a request from https://bugs.documentfoundation.org/show_bug.cgi?id=115512 about having the MenuBar in the HeaderBar integrated as e.g. VS Code does. To my surprise: I got this to work :smiley: I don’t know whether the GTK Designers had this in mind (using a GtkPopupMenuBar in a HeaderBar), but due to the fact that this is a GtkWidget, it works actually flawlessly.

I put some examples in the following screenshot. Additinally I put together a bunch of themes for better comparability (there is of course room of improvement, just POC).

Have fun :slight_smile:

2 Likes

These photos look amazing! I also saw your tweet with more photos. How do I try it out?

2 Likes