LibreOffice / noa-libre

UNO API of LibreOffice easy and understandable - Nice Office Access
GNU Lesser General Public License v2.1
37 stars 21 forks source link

Getting SWT embedding to work under Linux #18

Open fiveop opened 7 years ago

fiveop commented 7 years ago

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?

gitxpy commented 6 years ago

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 ?

rhizoome commented 6 years ago

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.

I haven't verified any of the next steps and it's out of the scope of my task.

lfcnassif commented 5 years ago

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.

opcoach commented 5 years ago

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.