diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-29 17:27:04 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-30 06:16:28 +0000 |
commit | 615c37503cffa92a663245d7cb140f316ace0506 (patch) | |
tree | 9d1adcf7385f705e38fbbb925c1488962954a39c /libreofficekit | |
parent | Add MS binary format validator support for wine (diff) | |
download | core-615c37503cffa92a663245d7cb140f316ace0506.tar.gz core-615c37503cffa92a663245d7cb140f316ace0506.zip |
LOK: change back type of view ids to int
Commit 45c2410041c48c22bd860efb42d4daadad7869b0 (LOK: change type of
view ids to uintptr_t, 2016-06-17) fixed the problem of view IDs being
reused for the price of random IDs, which makes debugging harder.
Implement a simple shellToView() function that makes sure view IDs are
not reused, and stop exposing view shell pointer addresses, which allows
reverting the LOK API change.
Change-Id: I63089e6de08ee7e1c7706757d43a11f6cf4d6e06
Reviewed-on: https://gerrit.libreoffice.org/26773
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'libreofficekit')
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 5510cde2b710..c27a1f997626 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -78,7 +78,7 @@ struct LOKDocViewPrivateImpl GdkRectangle m_aVisibleCursor; /// Position and size of the view cursors. The current view can only see /// them, can't modify them. Key is the view id. - std::map<std::uintptr_t, GdkRectangle> m_aViewCursors; + std::map<int, GdkRectangle> m_aViewCursors; /// Cursor overlay is visible or hidden (for blinking). gboolean m_bCursorOverlayVisible; /// Cursor is visible or hidden (e.g. for graphic selection). @@ -95,7 +95,7 @@ struct LOKDocViewPrivateImpl std::vector<GdkRectangle> m_aTextSelectionRectangles; /// Rectangles of view selections. The current view can only see /// them, can't modify them. Key is the view id. - std::map<std::uintptr_t, std::vector<GdkRectangle>> m_aTextViewSelectionRectangles; + std::map<int, std::vector<GdkRectangle>> m_aTextViewSelectionRectangles; /// Position and size of the selection start (as if there would be a cursor caret there). GdkRectangle m_aTextSelectionStart; /// Position and size of the selection end. @@ -137,7 +137,7 @@ struct LOKDocViewPrivateImpl ///@} /// View ID, returned by createView() or 0 by default. - std::uintptr_t m_nViewId; + int m_nViewId; /** * Contains a freshly set zoom level: logic size of a tile. @@ -1180,7 +1180,7 @@ callback (gpointer pData) std::stringstream aStream(pCallback->m_aPayload); boost::property_tree::ptree aTree; boost::property_tree::read_json(aStream, aTree); - std::uintptr_t nViewId = aTree.get<std::uintptr_t>("viewId"); + int nViewId = aTree.get<int>("viewId"); const std::string& rRectangle = aTree.get<std::string>("rectangle"); priv->m_aViewCursors[nViewId] = payloadToRectangle(pDocView, rRectangle.c_str()); gtk_widget_queue_draw(GTK_WIDGET(pDocView)); @@ -1191,7 +1191,7 @@ callback (gpointer pData) std::stringstream aStream(pCallback->m_aPayload); boost::property_tree::ptree aTree; boost::property_tree::read_json(aStream, aTree); - std::uintptr_t nViewId = aTree.get<std::uintptr_t>("viewId"); + int nViewId = aTree.get<int>("viewId"); const std::string& rSelection = aTree.get<std::string>("selection"); priv->m_aTextViewSelectionRectangles[nViewId] = payloadToRectangles(pDocView, rSelection.c_str()); gtk_widget_queue_draw(GTK_WIDGET(pDocView)); @@ -1434,9 +1434,9 @@ renderDocument(LOKDocView* pDocView, cairo_t* pCairo) return FALSE; } -static const GdkRGBA& getDarkColor(std::uintptr_t nViewId) +static const GdkRGBA& getDarkColor(int nViewId) { - static std::map<std::uintptr_t, GdkRGBA> aColorMap; + static std::map<int, GdkRGBA> aColorMap; auto it = aColorMap.find(nViewId); if (it != aColorMap.end()) return it->second; @@ -1556,7 +1556,7 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo) } // Selections of other views. - for (std::pair<const std::uintptr_t, std::vector<GdkRectangle>>& rPair : priv->m_aTextViewSelectionRectangles) + for (std::pair<const int, std::vector<GdkRectangle>>& rPair : priv->m_aTextViewSelectionRectangles) { for (GdkRectangle& rRectangle : rPair.second) { |