InforSense KDE User Training Introduction to InforSense KDE and Building Workflows.
LOOK! IT’S LIBREOFFICE ON KDE PLASMA
Transcript of LOOK! IT’S LIBREOFFICE ON KDE PLASMA
![Page 1: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/1.jpg)
1
LOOK! IT’S LIBREOFFICE ON KDE PLASMA
KATARÍNA BEHRENSLIBREOFFICE CONFERENCE TIRANA
![Page 2: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/2.jpg)
2
LOOK WHO'S TALKING
> LibreOffice squirrel @CIB> GSoC mentor> Qt widget charmer> WITch, feminist
![Page 3: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/3.jpg)
3
„PORTING“ KDE4 VCL PLUGIN TO KF5
1. VCL PLUGIN ARCHITECTURE ON LINUX2. WHY PORT WRITE FROM SCRATCH?3. CHALLENGES4. FILEPICKER5. NEW STUFF
![Page 4: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/4.jpg)
4
1 | 5
VCL PLUGIN ARCHITECTURE ON LINUX
![Page 5: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/5.jpg)
5
VCL ? VCL!
> Visual Component Library
> Visual Class Libraries
> Very Complete Library
> Vastly Clueless Library
> Very Confused Library
![Page 6: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/6.jpg)
6
PLATFORM-DEPENDENT BITS
● Widget look‘n‘feel– Windows and mac OS X– gtk and gtk3– generic X11 („Windows 95“)– kde4, qt5 and kf5
● Menus● File/folder picker dialogs● Printing
![Page 7: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/7.jpg)
7
SALINSTANCE, SALFRAMES
> SalInstance– every platform/vcl plugin implements one– create and destroy: SalFrames, SalPrinters,
SalVirtualDevices
> SalFrame– system window (main window, dialog etc.)– [undocked] floating window – tooltip– non-native [context] menu– listbox | toolbox dropdown
![Page 8: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/8.jpg)
8
Sally Instance
CreateFrame(main window)
CreateFilePicker CreateFrame(dialog, dropdown)
![Page 9: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/9.jpg)
9
SALFRAME, SALGRAPHICS
> SalFrame– every platform/vcl plugin implements one– Acquire/ReleaseGraphics returns SalGraphics
> SalGraphics– enables drawing to SalFrame– APIs such as drawRect, drawLine– drawNativeControl (draws widgets!)
![Page 10: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/10.jpg)
10
IN A NUTSHELL
SalInstance SalGraphicsSalFramecreates Acquires, releases
SalData
initializes
![Page 11: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/11.jpg)
11
2 | 5
WHY PORT WRITE FROM SCRATCH?
![Page 12: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/12.jpg)
12
KDE4 VCL PLUGIN HAS AGED
> KDE4 becoming legacy on most Linux distributions> Thin layer around X11/XLib VCL plugin> Only emulates KDE look'n'feel
– no native widgets, QPainter with QStyle* to render widgets– combined into QPixmap – copied directly into X11 window
(X11SalGraphics::CopyScreenArea)– slow painting, no image caching
![Page 13: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/13.jpg)
13
„NATIVE“ LOOK‘N‘FEEL WITH X11
X11 Window
OK
QPainter +
QStyleOption
QPixmap
OK
X11SalGraphic::CopyScreenArea
“Paste”
QImage
![Page 14: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/14.jpg)
14
KDE4 VCL PLUGIN HAS AGED EVEN MORE
> XLib way of processing the events (QApplication::x11ProcessEvent)
> No modal native dialogs– as LibO Widgets are not wrapped in QWidgets
> No Wayland support
![Page 15: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/15.jpg)
15
DIRECT PORT TO KF5 NOT POSSIBLE
> No way to access internal X11 pixmap anymore
> Similarly, no more X11 event filtering and processing
![Page 16: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/16.jpg)
16
![Page 17: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/17.jpg)
17
![Page 18: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/18.jpg)
18
3 | 5
CHALLENGES
![Page 19: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/19.jpg)
19
CHALLENGE: X11-LESS WINDOWS
> Replace X11 windows with native QWindows, QWidgets
– 1 SalFrame ⟺ 1 QWidget (QMainWindow respectively)
> Side effect: natively modal dialogs now possible – pop-up dialogs centered over its parent, grey background
overlay– Qt API: setModality, setTransientParent
![Page 20: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/20.jpg)
20
CHALLENGE: X11-LESS PAINTING
> Variant 1 (plain Qt5): clean-room implementation of QPainter-based SalGraphics
– 2nd rendering path on Linux (aside headless)
> Variant 2 (KF5): integrate with headless SalGraphic– custom QWidget with cairo canvas inside– QPainter (+QStyle[Option]) to paint widget bitmaps and
yield QImage– Raw bitmap extracted from Qimage and „pasted“ to cairo
canvas (BitBLT of a kind)
![Page 21: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/21.jpg)
21
X11-LESS PAINTING
QWindow with cairo canvas
OK
QPainter +
QStyleOption
Convert to raw bitmap and “paste”(cairo operator)
QImage
OK
![Page 22: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/22.jpg)
22
CHALLENGE: X11-LESS PROCESSING OF EVENTS
> SalFrames are now QWidgets> Side effect: they receive Qt events > So we can map them to SalEvents (in re-
implemented event handlers)> Additional QAbstractEventDispatcher for non-user
driven events
![Page 23: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/23.jpg)
23
4 | 5
FILEPICKER
![Page 24: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/24.jpg)
24
HOW IT WORKS
> „Agnostic“ C++ core code (e.g. print to file) – „Open a file dialog“ (letting user to pick file to print to)
> SalInstance (UI manager)– „Okay, opening a file dialog“– ::CreateFilePicker, ::CreateFolderPicker respectively
> KDE5FilePicker– „I‘m implementing XFilePicker interface and providing the
necessary functions“
![Page 25: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/25.jpg)
25
HOW IT WORKS II
Sally Instance
Joe KF5 Picker
I implement XFilePicker and
XFolderPicker interfaces
Print to file:Open a file picker
![Page 26: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/26.jpg)
26
WHY SO COMPLICATED?
> Why do we need all those interfaces?– get/setDisplayDirectory– get/setCurrentFilter– enableControl– get/setLabel etc.
> Because of custom LibO functionality– encrypt with password/GPG key– edit filter settings– enable/disable custom controls as needed
![Page 27: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/27.jpg)
27
(SMALLER) CHALLENGE: MIGRATE GTK3_KDE5 FPICKER TO PLAIN KF5
> Original work by Milian Wolff (KDAB)> Ships with LibreOffice 6.1> Gtk3 UI + Plasma filepicker as a separate binary> Communicating over stdin/stdout> Most of XFilePicker interface funcs implemented> Kill I/O with fire and open KFileDialog directly
![Page 28: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/28.jpg)
28
5 | 5
NEW STUFF
![Page 29: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/29.jpg)
29
NATIVE FOCUS RECTANGLES FOR[RADIO]BUTTONS AND CHECKBOXES
Before: After:
![Page 30: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/30.jpg)
30
NATIVE MENUS (INCL. GLOBAL MENU SUPPORT)
![Page 31: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/31.jpg)
31
REAL FOLDER PICKER
Before: After:
![Page 32: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/32.jpg)
32
THE CODE
> In LibreOffice master> Build with –enable-qt5 and –enable-kde5> Not yet enabled for daily builds – needs baseline
upgrade> (tentatively) shipped with LibreOffice 6.2
– First beta in November 2018– Released in February 2019
![Page 33: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/33.jpg)
33
ANY QUESTIONS, COMMENTS, PRAISE, CRITICISM, OFFERS (OF BEER)?
![Page 34: LOOK! IT’S LIBREOFFICE ON KDE PLASMA](https://reader035.fdocuments.in/reader035/viewer/2022081614/62c97a4cb6e93c372f202859/html5/thumbnails/34.jpg)
34
THANK YOU!