diff options
author | Pranav Kant <pranavk@gnome.org> | 2015-09-24 18:47:01 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-29 11:32:16 +0000 |
commit | c3ce35f0a12af2887b10987f76675174563487d7 (patch) | |
tree | 75d9bb1b144ff0a61d94eeb5786af98c2e8faa4e /libreofficekit | |
parent | f31d7fecb656d280c70b849d50a6642a28cf7225 (diff) |
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 <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'libreofficekit')
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 8d218f4492b7..8b85c451ac32 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)); } |