noa-libre icon indicating copy to clipboard operation
noa-libre copied to clipboard

Getting SWT embedding to work under Linux

Open fiveop opened this issue 8 years ago • 4 comments

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?

fiveop avatar Oct 12 '17 12:10 fiveop

for reference, the attached code fixes and extends this original example FrameWithSWT.java

FrameWithSWT_fix.zip

it works ok with gtk2 (rh6) ex_gtk2

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

it seems there's no more proper support for container.embeddedHandle ?

gitxpy avatar Jan 26 '18 12:01 gitxpy

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.

not embedded

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.

rhizoome avatar Sep 17 '18 13:09 rhizoome

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.

lfcnassif avatar Feb 22 '19 12:02 lfcnassif

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.

opcoach avatar Aug 28 '19 18:08 opcoach