libreofficekit/source/gtk/lokdocview.cxx | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
New commits: commit c3ce35f0a12af2887b10987f76675174563487d7 Author: Pranav Kant <pran...@gnome.org> Date: Thu Sep 24 18:47:01 2015 +0200 lokdocview: Reset view completely Resetting tiles only is not enough. We need to empty stale selection rectangles, handle bars, cursor positions etc., so that they do not interfere with next view to be opened using same widget instance. We are not destroying the document here, so the widget would still point to the same document unless it is made to point to another document by subsequent lok_doc_view_open_document calls. Change-Id: I3c7cc789c8c7393b3793b4edf6aa96d54bc0b1a3 Reviewed-on: https://gerrit.libreoffice.org/18866 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 8d218f4..8b85c45 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -1986,6 +1986,43 @@ lok_doc_view_reset_view(LOKDocView* pDocView) { LOKDocViewPrivate *priv = static_cast<LOKDocViewPrivate*>(lok_doc_view_get_instance_private (pDocView)); priv->m_aTileBuffer.resetAllTiles(); + priv->m_nLoadProgress = 0.0; + + memset(&priv->m_aVisibleCursor, 0, sizeof(priv->m_aVisibleCursor)); + priv->m_bCursorOverlayVisible = false; + priv->m_bCursorVisible = false; + + priv->m_nLastButtonPressTime = 0; + priv->m_nLastButtonReleaseTime = 0; + priv->m_aTextSelectionRectangles.clear(); + + memset(&priv->m_aTextSelectionStart, 0, sizeof(priv->m_aTextSelectionStart)); + memset(&priv->m_aTextSelectionEnd, 0, sizeof(priv->m_aTextSelectionEnd)); + memset(&priv->m_aGraphicSelection, 0, sizeof(priv->m_aGraphicSelection)); + priv->m_bInDragGraphicSelection = false; + + cairo_surface_destroy(priv->m_pHandleStart); + priv->m_pHandleStart = 0; + memset(&priv->m_aHandleStartRect, 0, sizeof(priv->m_aHandleStartRect)); + priv->m_bInDragStartHandle = false; + + cairo_surface_destroy(priv->m_pHandleMiddle); + priv->m_pHandleMiddle = 0; + memset(&priv->m_aHandleMiddleRect, 0, sizeof(priv->m_aHandleMiddleRect)); + priv->m_bInDragMiddleHandle = false; + + cairo_surface_destroy(priv->m_pHandleEnd); + priv->m_pHandleEnd = 0; + memset(&priv->m_aHandleEndRect, 0, sizeof(priv->m_aHandleEndRect)); + priv->m_bInDragEndHandle = false; + + cairo_surface_destroy(priv->m_pGraphicHandle); + priv->m_pGraphicHandle = 0; + memset(&priv->m_aGraphicHandleRects, 0, sizeof(priv->m_aGraphicHandleRects)); + memset(&priv->m_bInDragGraphicHandles, 0, sizeof(priv->m_bInDragGraphicHandles)); + + priv->m_nViewId = 0; + gtk_widget_queue_draw(GTK_WIDGET(pDocView)); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits