diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-01-09 18:12:52 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-01-12 11:06:45 +0100 |
commit | 9563293912d2d25989c4f869e58000c78487455a (patch) | |
tree | c2591a550e7f295f9d58702dee6f8443ba5c145e /libreofficekit | |
parent | e9c6949435bf4eb961eb2a1cf868b11df1373bb1 (diff) |
gtktiledviewer: invoke paintTile() on the main thread from the callback
Change-Id: Id910c1905d23f16cae5b6b551c74193d46cff256
Diffstat (limited to 'libreofficekit')
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c index 903f7e339638..65fdbfdda862 100644 --- a/libreofficekit/source/gtk/lokdocview.c +++ b/libreofficekit/source/gtk/lokdocview.c @@ -149,7 +149,16 @@ void renderDocument( LOKDocView* pDocView ) gtk_image_set_from_pixbuf( GTK_IMAGE( pDocView->pCanvas ), pDocView->pPixBuf ); } -static void lok_docview_callback(int nType, const char* pPayload, void* pData) +/// Invoked on the main thread if lok_docview_callback_worker() requests so. +static gboolean lok_docview_callback(gpointer pData) +{ + LOKDocView* pDocView = pData; + renderDocument(pDocView); + return G_SOURCE_REMOVE; +} + +/// Our LOK callback, runs on the LO thread. +static void lok_docview_callback_worker(int nType, const char* pPayload, void* pData) { LOKDocView* pDocView = pData; @@ -158,7 +167,7 @@ static void lok_docview_callback(int nType, const char* pPayload, void* pData) case LOK_CALLBACK_INVALIDATE_TILES: // TODO for now just always render the document. (void)pPayload; - renderDocument( pDocView ); + gdk_threads_add_idle(lok_docview_callback, pDocView); break; default: break; @@ -185,7 +194,7 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, c else { renderDocument( pDocView ); - pDocView->pDocument->pClass->registerCallback(pDocView->pDocument, &lok_docview_callback, pDocView); + pDocView->pDocument->pClass->registerCallback(pDocView->pDocument, &lok_docview_callback_worker, pDocView); } return TRUE; |