trigger a bogus mouse move event to interrupt glfwWaitEvents()

see https://github.com/glfw/glfw/issues/218
This commit is contained in:
Konstantin Käfer
2014-02-21 12:05:27 +01:00
parent 66a2c994ac
commit bd2d865fc4
3 changed files with 5 additions and 15 deletions

View File

@@ -29,8 +29,6 @@ public:
/* callback */
bool render();
void cancelAnimations();
void tileLoaded(std::shared_ptr<Tile> tile);
void tileFailed(std::shared_ptr<Tile> tile);
/* position */
void moveBy(double dx, double dy, double duration = 0);

View File

@@ -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<void(Response&)> background_function, std::function<void()> foreground_callback) {

View File

@@ -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::thread::id>()(std::this_thread::get_id()),
// tile->z, tile->x, tile->y);
}