noa-libre
noa-libre copied to clipboard
Getting SWT embedding to work under Linux
I managed to switch from AWT to SWT embedding on Windows. This however broke the Linux Version. With the arguments for XSystemChildFactory#createSystemChild(...) in LocalOfficeConnection#getOfficeFrame(Composite) set correctly - container.embeddedHandle instead of container.handle and SystemDependent.SYSTEM_XWINDOW instead of SystemDependent.SYSTEM_WIN32 - I can open a document. Loading another document after closing the previous yields an exception however (https://github.com/LibreOffice/core/blob/539c75b910f518a1fe51e9a21f6368a91c69ed88/framework/source/fwi/threadhelp/transactionmanager.cxx#L183).
Did anyone manage to embed LO successfully using SWT under Linux?
for reference, the attached code fixes and extends this original example FrameWithSWT.java
it works ok with gtk2 (rh6)

but have same issue as in #6 with gtk3 (rh7) :(

it seems there's no more proper support for container.embeddedHandle ?
We have reproduced this issue @adfinis-sygroup, while I haven't solved the issue with gtk3, I was able to provide a workaround. Run the noa-app with gtk2 by setting the environment variable: SAL_USE_VCLPLUGIN=gtk. We have decided that this is a feasible medium-term workaround.
With gtk3 I noticed that LibreOffice isn't embedded at all. It creates a small window, the window-manager recognizes it as a full window.

My wild guess: the embedded window is 'XReparentWindow()ed' out of the noa-app after noa has embedded the window. My next step would be.
-
Use one of X11 tracing programs: Xmon, Xtrace, xtruss and try to see what is going on
-
Find out if noa uses XEmbed, XReparentWindow or a method I don't know yet to embed LibreOffice
-
Write a C Xlib program that tries to embed LibreOffice with gtk2 and gtk3 and compare the results
I haven't verified any of the next steps and it's out of the scope of my task.
SAL_USE_VCLPLUGIN=gen worked, but with focus problems. SAL_USE_VCLPLUGIN=gtk workerd fine, but I had to install libreoffice-gtk2. Hope this helps.
Hi, If you have a bug regarding SWT and its implementation with GTK you should consider to open a bug directly on bugs.eclipse.org in the platform product and the swt component. There are already a lot of bugs declared as returned by this request :
I opened one (550517) this morning about the focus.