libreofficekit/source/gtk/lokdocview.cxx | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
New commits: commit c84e1e2521fe0794c3bc84a2238df59a8dba93f4 Author: Miklos Vajna <[email protected]> Date: Mon Feb 1 15:04:08 2016 +0100 lokdocview: call lok::Document::setClientZoom() after zoom change This is similar to what is implemented in online.git's leaflet. If the zoom factor changes, then inform LOK about it on the first keyboard hit. Change-Id: I2db4ffed3897db5c852f4b8aea8f4e2d3500a25a diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index afb347f..e6da630 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -123,6 +123,12 @@ struct LOKDocViewPrivateImpl /// View ID, returned by createView() or 0 by default. int m_nViewId; + /** + * Contains a freshly set zoom level: logic size of a tile. + * It gets reset back to 0 when LOK was informed about this zoom change. + */ + int m_nTileSizeTwips; + LOKDocViewPrivateImpl() : m_aLOPath(nullptr), m_aDocPath(nullptr), @@ -159,7 +165,8 @@ struct LOKDocViewPrivateImpl m_aHandleEndRect({0, 0, 0, 0}), m_bInDragEndHandle(false), m_pGraphicHandle(nullptr), - m_nViewId(0) + m_nViewId(0), + m_nTileSizeTwips(0) { memset(&m_aGraphicHandleRects, 0, sizeof(m_aGraphicHandleRects)); memset(&m_bInDragGraphicHandles, 0, sizeof(m_bInDragGraphicHandles)); @@ -541,6 +548,20 @@ postKeyEventInThread(gpointer data) LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task)); priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + + if (priv->m_nTileSizeTwips) + { + std::stringstream ss; + ss << "lok::Document::setClientZoom(" << nTileSizePixels << ", " << nTileSizePixels << ", " << priv->m_nTileSizeTwips << ", " << priv->m_nTileSizeTwips << ")"; + g_info("%s", ss.str().c_str()); + priv->m_pDocument->pClass->setClientZoom(priv->m_pDocument, + nTileSizePixels, + nTileSizePixels, + priv->m_nTileSizeTwips, + priv->m_nTileSizeTwips); + priv->m_nTileSizeTwips = 0; + } + std::stringstream ss; ss << "lok::Document::postKeyEvent(" << pLOEvent->m_nKeyEvent << ", " << pLOEvent->m_nCharCode << ", " << pLOEvent->m_nKeyCode << ")"; g_info("%s", ss.str().c_str()); @@ -2556,6 +2577,8 @@ lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom) g_clear_error(&error); } g_object_unref(task); + + priv->m_nTileSizeTwips = pixelToTwip(nTileSizePixels, priv->m_fZoom); } SAL_DLLPUBLIC_EXPORT gfloat commit dfe5531ec8eaf9665248eb332f33ddfecd04d588 Author: Miklos Vajna <[email protected]> Date: Mon Feb 1 14:49:52 2016 +0100 lokdocview: log lok::Document::postKeyEvent() arguments Change-Id: I16e7c0fee34077d5bbb493d9d9502ff82355c2c6 diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index bf35646..afb347f 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -541,6 +541,9 @@ postKeyEventInThread(gpointer data) LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task)); priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + std::stringstream ss; + ss << "lok::Document::postKeyEvent(" << pLOEvent->m_nKeyEvent << ", " << pLOEvent->m_nCharCode << ", " << pLOEvent->m_nKeyCode << ")"; + g_info("%s", ss.str().c_str()); priv->m_pDocument->pClass->postKeyEvent(priv->m_pDocument, pLOEvent->m_nKeyEvent, pLOEvent->m_nCharCode, _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
