diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-04-22 16:54:55 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-04-22 16:54:55 +0200 |
commit | 1ecff578295a44cd33e476acf9960d989e65b99b (patch) | |
tree | 820b2769560b0460d188482dbd660639cacefd2f /linux/main.cpp | |
parent | 9ff9d0edb55bcf15eb030b96f57cc6d5c63b8c5c (diff) | |
download | qtlocation-mapboxgl-1ecff578295a44cd33e476acf9960d989e65b99b.tar.gz |
use libuv event loop in the glfw view
Integrates libuv's default loop with GLFW's glfwWaitEvents() call. See https://github.com/joyent/libuv/issues/1246 for more details on integrating event loops.
fixes #149
Diffstat (limited to 'linux/main.cpp')
-rw-r--r-- | linux/main.cpp | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/linux/main.cpp b/linux/main.cpp index 42aa579b8c..49de8a2ac8 100644 --- a/linux/main.cpp +++ b/linux/main.cpp @@ -6,15 +6,8 @@ #include "settings.hpp" #include "../common/glfw_view.hpp" -#include "request.hpp" - - MapView *mapView = nullptr; -std::forward_list<std::shared_ptr<llmr::platform::Request>> requests; - - - void quit_handler(int s) { if (mapView) { @@ -26,10 +19,6 @@ void quit_handler(int s) { } } - - - - int main(int argc, char *argv[]) { int fullscreen_flag = 0; @@ -51,13 +40,6 @@ int main(int argc, char *argv[]) { sigIntHandler.sa_flags = 0; sigaction(SIGINT, &sigIntHandler, NULL); - - // curl init - curl_global_init(CURL_GLOBAL_ALL); - - llmr::platform::Request::initialize(); - - // main loop llmr::Settings_JSON settings; mapView = new MapView(settings, fullscreen_flag); @@ -66,49 +48,5 @@ int main(int argc, char *argv[]) { mapView->settings.sync(); delete mapView; - - llmr::platform::Request::finish(); - - curl_global_cleanup(); return ret; } - -namespace llmr { - -void platform::cleanup() { - bool& dirty = mapView->dirty; - requests.remove_if([&dirty](std::shared_ptr<llmr::platform::Request> &req) { - if (req->done) { - req->foreground_callback(); - dirty = true; - return true; - } else { - return false; - } - }); -} - -void platform::restart() { - if (mapView) { - mapView->dirty = true; - } -} - -std::shared_ptr<platform::Request> -platform::request_http(const std::string &url, std::function<void(Response *)> background_function, - std::function<void()> foreground_callback) { - std::shared_ptr<Request> req = - std::make_shared<Request>(url, background_function, foreground_callback); - requests.push_front(req); - return req; -} - -// Cancels an HTTP request. -void platform::cancel_request_http(const std::shared_ptr<Request> &req) { - if (req) { - req->cancel(); - } -} - - -} |