diff options
-rw-r--r-- | platform/default/glfw_view.cpp | 16 | ||||
-rw-r--r-- | src/mbgl/util/token.hpp | 4 |
2 files changed, 8 insertions, 12 deletions
diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp index 295e106621..1118bc23a7 100644 --- a/platform/default/glfw_view.cpp +++ b/platform/default/glfw_view.cpp @@ -58,13 +58,11 @@ void GLFWView::initialize(mbgl::Map *map_) { glfwSetWindowUserPointer(window, this); glfwMakeContextCurrent(window); + glfwSwapInterval(1); int width, height; glfwGetWindowSize(window, &width, &height); - int fbWidth, fbHeight; - glfwGetFramebufferSize(window, &fbWidth, &fbHeight); - - resize(window, 0, 0); + resize(window, width, height); glfwSetCursorPosCallback(window, mouseMove); glfwSetMouseButtonCallback(window, mouseClick); @@ -281,12 +279,6 @@ int GLFWView::run() { map->start(); while (!glfwWindowShouldClose(window)) { - if (map->needsSwap()) { - glfwSwapBuffers(window); - map->swapped(); - fps(); - } - glfwWaitEvents(); } @@ -310,7 +302,9 @@ void GLFWView::notify() { } void GLFWView::swap() { - glfwPostEmptyEvent(); + glfwSwapBuffers(window); + map->swapped(); + fps(); } void GLFWView::notifyMapChange(mbgl::MapChange /*change*/, mbgl::timestamp /*delay*/) { diff --git a/src/mbgl/util/token.hpp b/src/mbgl/util/token.hpp index 64192a99f9..455190aabf 100644 --- a/src/mbgl/util/token.hpp +++ b/src/mbgl/util/token.hpp @@ -8,6 +8,8 @@ namespace mbgl { namespace util { +const static std::string tokenReservedChars = "{}()[]<>$=:;.,^"; + // Replaces {tokens} in a string by calling the lookup function. template <typename Lookup> std::string replaceTokens(const std::string &source, const Lookup &lookup) { @@ -22,7 +24,7 @@ std::string replaceTokens(const std::string &source, const Lookup &lookup) { result.append(pos, brace); pos = brace; if (pos != end) { - for (brace++; brace != end && (std::isalnum(*brace) || *brace == '_'); brace++); + for (brace++; brace != end && tokenReservedChars.find(*brace) == std::string::npos; brace++); if (brace != end && *brace == '}') { result.append(lookup({ pos + 1, brace })); pos = brace + 1; |