From 5fb18e1517327a59bdc2ec68133281f0a9c5fcac Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 4 Mar 2015 10:09:53 +0100 Subject: LOK: add LOK_CALLBACK_CURSOR_VISIBLE With this, if a Writer document contains an image, then clicking on the image then back to the text properly shows/hides the blinking cursor. Change-Id: I3313319ded614a2eb86e1c66c926189511a7cca6 --- libreofficekit/source/gtk/lokdocview.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'libreofficekit/source/gtk/lokdocview.c') diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c index 23adab27941c..93ed764b8cf0 100644 --- a/libreofficekit/source/gtk/lokdocview.c +++ b/libreofficekit/source/gtk/lokdocview.c @@ -247,6 +247,7 @@ static void lok_docview_init( LOKDocView* pDocView ) pDocView->m_bEdit = FALSE; memset(&pDocView->m_aVisibleCursor, 0, sizeof(pDocView->m_aVisibleCursor)); pDocView->m_bCursorOverlayVisible = FALSE; + pDocView->m_bCursorVisible = FALSE; pDocView->m_nLastButtonPressTime = 0; pDocView->m_nLastButtonReleaseTime = 0; pDocView->m_pTextSelectionRectangles = NULL; @@ -355,7 +356,7 @@ static gboolean renderOverlay(GtkWidget* pWidget, GdkEventExpose* pEvent, gpoint (void)pEvent; pCairo = gdk_cairo_create(gtk_widget_get_window(pWidget)); - if (pDocView->m_bCursorOverlayVisible && !lcl_isEmptyRectangle(&pDocView->m_aVisibleCursor)) + if (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. @@ -371,7 +372,7 @@ static gboolean renderOverlay(GtkWidget* pWidget, GdkEventExpose* pEvent, gpoint } - if (!lcl_isEmptyRectangle(&pDocView->m_aVisibleCursor) && !pDocView->m_pTextSelectionRectangles) + if (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) @@ -603,6 +604,8 @@ static const gchar* lcl_LibreOfficeKitCallbackTypeToString(int nType) return "LOK_CALLBACK_TEXT_SELECTION_START"; case LOK_CALLBACK_TEXT_SELECTION_END: return "LOK_CALLBACK_TEXT_SELECTION_END"; + case LOK_CALLBACK_CURSOR_VISIBLE: + return "LOK_CALLBACK_CURSOR_VISIBLE"; } return 0; } @@ -664,6 +667,11 @@ static gboolean lok_docview_callback(gpointer pData) pCallback->m_pDocView->m_aTextSelectionEnd = lcl_payloadToRectangle(pCallback->m_pPayload); } break; + case LOK_CALLBACK_CURSOR_VISIBLE: + { + pCallback->m_pDocView->m_bCursorVisible = strcmp(pCallback->m_pPayload, "true") == 0; + } + break; default: break; } -- cgit