[Libreoffice] Suggestion needed for External Edit functionality.

Thorsten Behrens thb at documentfoundation.org
Wed Nov 10 09:02:20 PST 2010


surenspost at gmail.com wrote:
> I current way I am implementing is that I save the Graphic a temporary
> file,then to create a new thread ( using osl_createThread from
> osl/thread.h ) and from within the new thread execute the external
> application to open the temp ( using osl_executeProcess from
> osl/process.h). Then on I poll for the exit of the process and after
> exit, exit the new thread and main thread updates the graphic with the
> new temporary image. But the current way blocks the main loop and I
> end up getting an unresponsive libreoffice window which is not
> desirable at all.
> 
Hi Suren,

since you already create a separate thread for the editing - just
fire it off, and send the main app a msg - like here:

desktop/source/app/officeipcthread.cxx:289

(you'll probably replace STATIC_LINK with LINK,
DECL_STATIC_LINK with DECL_LINK, and IMPL_STATIC_LINK_NOINSTANCE
with IMPL_LINK)

PostUserEvent adds an event into the main app msg queue, which then
gets processed like any other input (mouse, keyboard) in the LibO
mainloop.

Also: just using osl_executeProcess() avoids idly spinning until the
external app is finished. Your thread just blocks then.

HTH,

-- Thorsten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101110/d7269a52/attachment-0001.pgp>


More information about the LibreOffice mailing list