diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-10 11:24:11 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-16 09:38:04 +0100 |
commit | 997ca80cc9da940adbd59ce83999e4ffaf4f64d0 (patch) | |
tree | 5ac287f6f53ccf58c4ff25747bc4198c95a34df3 | |
parent | e12afadda2e623be73578525c196a93bea73bbe8 (diff) |
lokdocview: register callback early
This is mainly to be in sync with Android, but this also makes blinking
text work in viewer mode.
Change-Id: Ie307cab722bae5030ca9bdfb442555a728aa33cc
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c index 61ab95715899..e12266b5c29b 100644 --- a/libreofficekit/source/gtk/lokdocview.c +++ b/libreofficekit/source/gtk/lokdocview.c @@ -505,7 +505,7 @@ static gboolean renderOverlay(GtkWidget* pWidget, GdkEventExpose* pEvent, gpoint (void)pEvent; pCairo = gdk_cairo_create(gtk_widget_get_window(pWidget)); - if (pDocView->m_bCursorVisible && pDocView->m_bCursorOverlayVisible && !lcl_isEmptyRectangle(&pDocView->m_aVisibleCursor)) + if (pDocView->m_bEdit && pDocView->m_bCursorVisible && pDocView->m_bCursorOverlayVisible && !lcl_isEmptyRectangle(&pDocView->m_aVisibleCursor)) { if (pDocView->m_aVisibleCursor.width == 0) // Set a minimal width if it would be 0. @@ -521,7 +521,7 @@ static gboolean renderOverlay(GtkWidget* pWidget, GdkEventExpose* pEvent, gpoint } - if (pDocView->m_bCursorVisible && !lcl_isEmptyRectangle(&pDocView->m_aVisibleCursor) && !pDocView->m_pTextSelectionRectangles) + if (pDocView->m_bEdit && pDocView->m_bCursorVisible && !lcl_isEmptyRectangle(&pDocView->m_aVisibleCursor) && !pDocView->m_pTextSelectionRectangles) { // Have a cursor, but no selection: we need the middle handle. if (!pDocView->m_pHandleMiddle) @@ -895,6 +895,8 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, c else { pDocView->pDocument->pClass->initializeForRendering(pDocView->pDocument); + pDocView->pDocument->pClass->registerCallback(pDocView->pDocument, &lok_docview_callback_worker, pDocView); + g_timeout_add(600, &lcl_handleTimeout, pDocView); renderDocument(pDocView, NULL); } @@ -949,12 +951,9 @@ SAL_DLLPUBLIC_EXPORT void lok_docview_set_edit( LOKDocView* pDocView, gboolean bEdit ) { if (!pDocView->m_bEdit && bEdit) - { - g_info("lok_docview_set_edit: entering edit mode, registering callback"); - pDocView->pDocument->pClass->registerCallback(pDocView->pDocument, &lok_docview_callback_worker, pDocView); - g_timeout_add(600, &lcl_handleTimeout, pDocView); - } + g_info("lok_docview_set_edit: entering edit mode"); pDocView->m_bEdit = bEdit; + gtk_widget_queue_draw(GTK_WIDGET(pDocView->pEventBox)); } SAL_DLLPUBLIC_EXPORT gboolean lok_docview_get_edit(LOKDocView* pDocView) |