From bd2d865fc474f752b48b88b4b8fd2c8eb307f301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Fri, 21 Feb 2014 12:05:27 +0100 Subject: [PATCH] trigger a bogus mouse move event to interrupt glfwWaitEvents() see https://github.com/glfw/glfw/issues/218 --- include/llmr/map/map.hpp | 2 -- macosx/main.mm | 3 +++ src/map/map.cpp | 15 ++------------- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/include/llmr/map/map.hpp b/include/llmr/map/map.hpp index 84cb4d12e..c82fcae47 100644 --- a/include/llmr/map/map.hpp +++ b/include/llmr/map/map.hpp @@ -29,8 +29,6 @@ public: /* callback */ bool render(); void cancelAnimations(); - void tileLoaded(std::shared_ptr tile); - void tileFailed(std::shared_ptr tile); /* position */ void moveBy(double dx, double dy, double duration = 0); diff --git a/macosx/main.mm b/macosx/main.mm index 7c2f0cc1e..18229f9f4 100644 --- a/macosx/main.mm +++ b/macosx/main.mm @@ -227,6 +227,9 @@ namespace platform { void restart(void *) { mapView->dirty = true; + CGEventRef event = CGEventCreate(NULL); + CGEventSetType(event, kCGEventMouseMoved); + [[NSApplication sharedApplication] postEvent: [NSEvent eventWithCGEvent:event] atStart:NO]; } void request_http(std::string url, std::function background_function, std::function foreground_callback) { diff --git a/src/map/map.cpp b/src/map/map.cpp index e837ecffb..5e31c97c1 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -375,12 +375,12 @@ bool Map::updateTiles() { } bool Map::render() { - bool changed = false; if (transform.needsAnimation()) { transform.updateAnimations(); - changed = updateTiles(); } + bool changed = updateTiles(); + painter.clear(); for (Tile::Ptr& tile : tiles) { @@ -395,14 +395,3 @@ bool Map::render() { return changed || transform.needsAnimation(); } - -void Map::tileLoaded(Tile::Ptr tile) { - // std::cerr << "loaded " << tile->toString() << std::endl; - update(); -} - -void Map::tileFailed(Tile::Ptr tile) { - // fprintf(stderr, "[%8zx] tile failed to load %d/%d/%d\n", - // std::hash()(std::this_thread::get_id()), - // tile->z, tile->x, tile->y); -}