diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2018-04-05 22:23:28 +0200 |
---|---|---|
committer | Aron Budea <aron.budea@collabora.com> | 2018-04-20 11:25:01 +0200 |
commit | 19a2c9ca42bab45f1e4e258d1023b62557f8f1fe (patch) | |
tree | d99bfff7d826479dd3f6220601f2717c7cd9720e /libreofficekit | |
parent | 2e396d37d96e1bc535da75cfc5f2afeac6b68d25 (diff) |
sw lok: View jumps to cursor position even if it is moved by an other view.
Scrolling is done twice. Once in SwCursorShell::UpdateCursor() by
SCROLLWIN flag. Here we can check the actual viewid and avoid scrolling
if the cursor is move by an other user.
The second instance in the LO online code, for it we need to pass the
viewid identifying the view which moved the cursor.
Change-Id: I033274f88ce41acbb632e2aeb0d986ab11cd2d52
Reviewed-on: https://gerrit.libreoffice.org/52220
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit 83b7bfc0efefb3c77e5c59553320e98539250c62)
sw lok: followup commit for change about scrolling to visible cursor
Revert small part of this commit:
83b7bfc0efefb3c77e5c59553320e98539250c62
Thanks Jan Holesovsky to catching it.
Change-Id: I885c9f3da622052685d1e46f6358783fc7f8cb9a
Reviewed-on: https://gerrit.libreoffice.org/52684
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit 508013d799358bb1c92b5cfea5257fe53c695cee)
Reviewed-on: https://gerrit.libreoffice.org/53178
Reviewed-by: Aron Budea <aron.budea@collabora.com>
Tested-by: Aron Budea <aron.budea@collabora.com>
Diffstat (limited to 'libreofficekit')
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 8fa945ae2db7..a48026a7b796 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -1162,13 +1162,25 @@ callback (gpointer pData) break; case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR: { - priv->m_aVisibleCursor = payloadToRectangle(pDocView, pCallback->m_aPayload.c_str()); + + std::stringstream aStream(pCallback->m_aPayload); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + const std::string& rRectangle = aTree.get<std::string>("rectangle"); + int nViewId = aTree.get<int>("viewId"); + + priv->m_aVisibleCursor = payloadToRectangle(pDocView, rRectangle.c_str()); priv->m_bCursorOverlayVisible = true; - g_signal_emit(pDocView, doc_view_signals[CURSOR_CHANGED], 0, + std::cerr << nViewId; + std::cerr << priv->m_nViewId; + if(nViewId == priv->m_nViewId) + { + g_signal_emit(pDocView, doc_view_signals[CURSOR_CHANGED], 0, priv->m_aVisibleCursor.x, priv->m_aVisibleCursor.y, priv->m_aVisibleCursor.width, priv->m_aVisibleCursor.height); + } gtk_widget_queue_draw(GTK_WIDGET(pDocView)); } break; @@ -2700,6 +2712,7 @@ static gboolean lok_doc_view_initable_init (GInitable *initable, GCancellable* / return FALSE; } priv->m_nLOKFeatures |= LOK_FEATURE_PART_IN_INVALIDATION_CALLBACK; + priv->m_nLOKFeatures |= LOK_FEATURE_VIEWID_IN_VISCURSOR_INVALIDATION_CALLBACK; priv->m_pOffice->pClass->setOptionalFeatures(priv->m_pOffice, priv->m_nLOKFeatures); return TRUE; |