 So actually, I'm a bit of a fraud here. So this is as you see, this is not my talk. This is boobly's talk Standing in for her. We got enough Expertise we got enough contributors to that particular feature here in the room. So please just shout and interrupt if I am talking nonsense or if you want to amend or just Expand on anything I'm saying So let's start This is about the KDE the newest KDE support in LibreOffice that has been coming For a bit of a longer time work. I think started something like two years ago And an earnest in spring last year It's been quite a bit of work Almost all of that has been funded by City of Munich. So many things for that But there's a pretty long list of luminaries I'd like to read That's my wife boobly. This is Jan Marek formerly City of Munich. This is a million from KDAP This is Samuel Michael Wigghorn from City of Munich Alexei and Vera from Altlinux, I think It's the company This is Cisco from TDF and I suppose quite a bit of spare time there This is Roman and Michael Stahl also from CIB So many things wouldn't have been possible without all of you and I think it's a great success story in terms of Getting community engaged and sharing the work here That's the talk outline. Let's not bore you with that and jump straight into That one here. So Linux as we all know, that's all about choice. So you got to pick your desktop environment. You got to compile your kernel and You can run liberal office and with the back end of your choice, which can be at least for Linux There is there used to be something like Six if I'm not mistaken or five. So that was the the old KDE 3.1. That was KDE 4. There was some old TDE that was I think a re-run of the KDE 3 Back end that we had some stage kicked out as GTK 2 and 3 and then there's a very or there used to be very plain old generic X11 Nothing fancy looks like when those 95 everything rendered with rectangles and VCL Back end as a fallback So there was a bit of cleanup recently There's more cleanup coming up with a great and kicking out GTK 2 So Yeah, the What when this started there was there was no KF 5. There was no cute 5. So with KDE 4 Slowly aging and distros largely only shipping the libraries because of liberal office It was about time to do something there and that was On top of that there was the issue with Wayland. So KDE 4 had no veil Wayland support because it was exposing too much of X11 So the only way to be future proof really with native KDE was to write or extend That back end So for VCL, well, that's um, it's anyone's guess. What's the actual acronyms meaning? So that's five examples pick one that you like. I like the last one very much It's but it's this one But you knew that I guess So that's essentially that the GUI abstraction or most of the GUI abstraction from liberal office with several back-end implementations for the major platforms and With so-called plugs for for linux so that you can at run time more or less or during bootstrapping liberal office choose which of those Desktop environments or plugs you want to run And attending everything from from windows over menus to printing And also file dialogues but more boring details for those of you who are not aware of it there's one Saal instance, which is the the let's say the the one Singleton that you that you get that you create yourself when you want to run a GUI application And that's a factory for for giving you everything else that you need from from Windows on the screen to file pickers And like any sort of graphical thing and then from the window on the screen you get something that you can Call like draw circle or draw rectangle on Which is the cell frame so that's the actual system window So did the actual thing that whatever is on your system is putting pixel on your on your display That includes menus anything that is floating tooltips Popups so anything that is really not Within the the document area so that can go beyond that or or dialogues And also the list books toolbox drop downs So that's just a bit more Graphical how that relates I'm very much like to selly instance For a bit of more diversity in the and the naming compared to Saal instance Yeah So obviously The Saal instance That's what you get from your plug and then from that factory you're getting all this. This is all like virtual classes, so you that's like an abstract class and you're getting an instance of that that's done a GTK frame or acute frame or X11 frame Which then actually knows what to do how to how to display things how to create system-level objects How to react on events and also how to create and return Child objects of that for example the Saal graphics, which is the implement or the the interface to use When you want to draw something visual And also actually also the the abstraction for the native widgets Which I will get to a bit later So that's the graphics for that So how how was that done it was one obvious way would have been to take the KDE for back-end and Just reuse that improve that changed a few things in the API that have that needed Modification and then run with that and retire KDE for and just use the newer stuff What that's what not what happened so what actually happened is the more or lesser writing a plugin from scratch By the way GTK 2 GTK 3 that was mostly reused by Well actually including that reusable code By preprocessor and then adding whatever changes were necessary on top so that that was considered but then deemed not Possible And I will tell you why Yeah, I mentioned that Katie for was on the way out so to stay relevant there There were two options either retire KDE support native KDE support and completely Or to do something more modern But also more effort Katie for was essentially a quick quick hack Just a thin layer around like the most minimal thing you could do a thin layer around the existing x11 plugin just whatever you needed to make KDE Config and theming accessible that was done there everything else was just reused from the x11 plugin With a bit of like some some tricks like for the native look of the widgets that was just calling some theming API with a here's some Here's some pics map or here's some Well in this case actually Yeah, well it was a Q pics maps it was so from that you could get a Actual x11 pics map and that you can just split on screen, but all of that was exposing x11 implementation details and had a lot of drawbacks among them that it wasn't really and it was showing on Any number of places no real KDE application We're on top of that slow painting no no proper caching etc. So that's that's how that went So you you had some just this cute style thing that was rendering Into the button into an image Which was backed by by a pics map so from the pics map You could then just split that on screen and there was the button Also, it was reusing obviously because it didn't have any any own event loop the xlib event loop with another set of drawbacks Coming out of that which for example meant that there were no real KDE or cute style native Model dialogues possible. So if you if you who's using KDE is there desktop One two at least three Four great. So I mean the model dialogue and a KDE application that kind of really Dims the the background window makes it inaccessible and Obviously like very obviously puts that that the dialogue this okay or cancel button or something in in the foreground and It's a very obvious thing that's very visible and very nice and if an application does not do that It's it's a bit like on on Mac. It feels a bit alien Yes, obviously no wayland support because with all this x11 or at least no direct wayland support You can of course use some x wayland Emulation but no native wayland for because of rendering and because of events so Direct port not possible because all that API was no longer available or is no longer available in k5 So that was essentially what we were looking at All the best intentions opening the door and there we go, okay Challenges So we can't use obviously we can't use x11 windows. What else to do? Well, we can go and write some abstraction ourselves like x11 if We run on x11 or wayland compositor if we run there, but it's a bit But what makes things even harder? So why not use qt 5 that has all this nice abstraction already built in And that would mean also using q windows the the the cute events With all this nice in this case Nice side effects of getting native modal dialogues and native menu support With this q-window and q-widget We were prototyping or pondering two options there like to sub Options one would be because if you one obvious way then is to use a cute and and swallow that Line hook and sinker which also means that you need to run the application Which is that the writer impress renders the application content and you also need to somehow bridge that Vcl output device API to whatever Or in this case style graphic API to whatever cute offers Which we discovered is not that hard for with the exception of the font Stuff font selection font layout thing which was at least There was no way to estimate how much effort that would possibly be and with the with the with the Lot very likely outcome that there would be no end of tiny little differences like not getting the same font and the writer would The the the layout team would be slightly off than the document would look slightly like 10 pages longer with all this Knock on effect, so we thought that's a bit too much of a risk forgetting that ready to be to be used in real production, so we went for a variant two which is a Bit of a it took a bit of an inspiration from the earlier KDE for implementation In a sense that there is a backing Score or or a background image That gets the entire window content including the controls like document content and controls and That was still available, so we could get some Cairo surface Handed over to cute and let cute and get a cute image for that and the cute painter and get this This then handed over to the theming API and that could then render the button into that and we could then blip that on to the screen And we already had that because we have this headless tile graphics, which is actually what what's a GTK 3? using as well To render all this stuff, so that was a bit of existing technology existing Machinery we could build on top and we had the The safety in that we could that was exactly the same fund layout in fund selection chain as before so No, no risk of regressions or of different behavior there so That's how it looks not So so that part is exactly a how how cute 3 sorry GTK 3 is doing that and Kind of inspired by but is this earlier hacks with a KD for Yeah, event handling So no more Xlip event handling, so we now needed to implement cute event handling And we also needed to somehow map user events into that framework So we had to essentially write a cute main loop Connector and also use the signal slots stuff whenever we needed to know something about Events like anything from redraw to Dialogue closed or or other Things so with that all in place As mentioned earlier there was suddenly a native menu support available which for KDE means this global menu like You might know that from that's one option that that's optional, but as you know that from from OS X Because it was all kind of I mean that's Once you are able to to put the menu into into cute The rest is handled by the platform for you What's what what of great help there the the earlier work? That I think was that canonical funding that with the yeah for the For the unity desktop with a separate menu, so it was already infrastructure in place to have an abstract menu with pushing the menus and sub menus and items Like the menu structure over some some abstract API and so we were just just implementing that Same story for native theming So that was works for notebook bar and tap dialogue so that Looks almost like the real thing It's it's always like for everything in LibreOffice It's all always only or almost only the look and not to feel except for the For the welded stuff that the quail in a stewing since a while Said I wouldn't see we also be possible for for that here, but let's not get overboard for the moment So that's that's on the on the same level now as it is for for OS X or for Windows Yeah, another interesting challenge was file pickers There as well some some background. So this is also abstracted away And the solid stem so you get you can get native file pickers Created there. It's kind of optional. So you can also kind of change the option and get the old Like built-in LibreOffice controls file picker stuff, but it's well, yeah, that's but ugly So that was certainly also possible and we wanted to do that That's how it works. Give me your file picker then you get this thing It has a bit of API so you can actually modify how that looks you can add and remove Some controls like this those checkboxes now You can like not only put them there you can also disable them or enable them you can select pre-select them deselect them and that's for this password and GPG and a file name extension or something and also for I think for The image thing. There's also some preview option there So then we did that in two steps. So we we wanted Something right so there was there was another intermediate step there, which is using the GTK 3 block But with the KDE theming so GTK 3 detects I'm running on a KDE desktop and then adjust the theming appropriately so that almost looks like The real thing the only thing that was obviously not looking like the real thing with the file pickers So that was this intermediate step that first as the first thing Beyond using GTK 3 also on KDE Was to implement the file pickers and if you don't want to get the cute event loop and all all the other stuff with that Piggy backing That would there was the need to do that out of process So there was a separate binary that was linking to a cute and KDE libraries That was communicating with the main developers process by IPC but essentially pipes and getting some parameters and Giving something back and the when the user That's some activity there Yeah, and it was there was something like 90% of the functionality, but it was an intermediate step So that that was how that look before which is kind of Windows 95 again, and that's the native K5 Set up there. So Well with that that that was the first step that would act that was actually rolled out and was was used or is still used But we didn't stop there because it was We could we could do more. I mean it was it was still showing And for example this native menu and the theming and to the model the native model dialogue sort of fact And it was really I mean file picker was just like bloody obvious like you open Okay, this is just an emulation. So but the other thing like for anybody who's really using that on a daily basis it's just it's just too obvious and So we went further And That's what was I was mentioning and now comes the stuff that we actually Discovered when we did all of that and thought we were ready and done and it would all be wonderful and fine in shipping and 6.2 But there actually that was a bit more That we discovered then That needed doing As always when you go into production So copy and paste Let's quickly go through that this is essentially just describing how it's how it's how it's set up and liberal for so there's this Internal copy paste as this within the same window. There's between liberal for this application But still the same process and then there's the system clipboard And it's all slightly different How that is handled? Then there's this very funny x11 clipboard or Quite I think an infinite number of x11 clipboards that you can use if you want to Yeah, and that's this is all abstracted away behind you know API Which is a theory nice and practice sometimes a bit hard to Follow the the code path now Same story with drag-and-drop Also like internal external inside the same frame and between frames Yes, so all of that needed with the native Queue windows that needed a native a mapping to the native queued Implementation to be able to work either just using it when it supported all the features or Tunneling some handle through that and then taking it out on the other hand and discovering that Aha, I know this and then taking the data straight away from the other side Interesting aspect that also we largely only discovered in production was Extensions, especially Java extensions have this this very nasty habit of calling back into your so you call them with an event And then they call you back but from another threat which is Most of the time that's fine, but it's kind of sucks when you then need to do anything with the UI like open a dialogue open a window create a control because some Widget Libraries and queued as one of them really don't like that when you do anything with widgets outside the main thread So that needed some Some surgery there and you find a number of extra places now with this is main thread run in main thread code that is actually a method on the solid instance Where you can just say okay? I'm getting a call, but I'm not I can't call this function now So I'm just posting a message message to the main thread and then the main thread loop is still kind of spinning and then it takes the message and calls the method and Since either sends a message back if there's a return value or keeps spinning and the other code runs keeps running as well And we use that for example in a slightly different flavor on windows as well because that it's not that you must use it Call it in the main thread, but you must call when you it's called threat affinity So you do something you create a window in one thread and any further action with that window that involves that windows Message loop also have to has to be performed in that thread. Usually it's the main thread. What doesn't have to be Yes, and then all the like the long long tail of things that you discover and Didn't think about that initially Like native tooltips All this update glitches like off by one errors clipping not not precisely said This this funny tools rectangle that always surprises you with a way that it calculates width and height Floating toolbars Like that those I think some five or ten Different issues there to get that to dog and undock also not only on x11, but also on Wayland Getting presets right like UI fonts and getting open GL right for the slight transitions CJK I am e support which no one really from us knew anything about at least I can say that and Learn something in the process Accessibility which turned out to be actually not so bad. That was some there was Moderately good support in in cute if we would have done that a year earlier would have been much worse So there was a bit of a sweet spot that when we started Jewel screen or we found a great bug there that was dual screen that is now fixed and in the latest Cute updates, but not what is on mainstream desktop operation system. So if you really need your KDE desktop and Libra office to do something like this like present your slides Then maybe you should use the GTK 3 Back end at least for that day Because there's a bug that makes dual screen or multi-screen support a bit flaky And yeah crashes polishing rough edges, etc. Etc So that gets me to the end and So the status right now is it's It's in six two most of the fixes and changes is also backported to six two, but not everything so the Really the the full glory is in six three if you're building that yourself Do that with the Neville cute and enable K5. Oh, yeah, we also renamed that because somebody told us that KDE is not the right name Kde five. It's K5 and we should be shamed and embarrassed to Not have it have it named properly in the first place Yeah, and it's enabled for daily builds. So if you got Linux dailies, it should be there the plug-in And it's now so I would say it's on the level of GTK 3 now At least if you count the open bugs So I think everything that you I mean there's always Never nothing is really ever buck-free, but but you can now actually product if you work with it and people do that All right, that is some pretty much the end of the talk and the end of the time Any questions the extensions and the the interesting bit with the threat affinity and they're Messing that up the two things. So first, how did it work in the past and second? What happens if the if the extension expects? Synchronicity in in the order of things as in if you return before the thing that they invoked actually finishes You might mess up their expectation Maybe you can yeah, but I Should probably not just saying here So yeah, that actually works because the The run in main thread blocks usually until the the main thread is done And it used to work in the past because X 11 you can you can do X 11 stuff from from whatever Threat you'd like to just accidentally worked Okay, maybe one last question. Then I think we really are out of time anybody three to Use the microphone. So I repeat the question 10. Can we use that without the cave 5? Yes, yes with the Qt file enabled switch Absolutely, yeah, great for I mean we didn't kill GTK 3 or Well, I think X 11 is also Is it so I think GTK 2 is essentially I mean just somebody needs to push that patch Yeah, right now the GTK 2 one has a patch to remove us in Garrett and the generic one is In that intended to be touched for the moment Microsoft is a very good argument that it's good to have one back end That is guaranteed to work when you're doing bisecting regardless of what kind of versions of stuff you've got installed So JDK 2 would probably go away and I'm not going to do anything about generic one myself Great, thanks a lot then