diff options
author | Mike Morris <michael.patrick.morris@gmail.com> | 2014-09-10 18:53:20 -0400 |
---|---|---|
committer | Mike Morris <michael.patrick.morris@gmail.com> | 2014-09-10 18:53:20 -0400 |
commit | 15564b81a37e097b52d1751b99dc91d36d37d66e (patch) | |
tree | 521a1949a89e55e6dbfb0dd7080e5bcdab1aac95 /common | |
parent | 4316d2c40585e3d0dcdb25fa6f2341531025e20e (diff) | |
parent | 7a4c914d05cab81ca55ac3cde478997c6d32477e (diff) | |
download | qtlocation-mapboxgl-15564b81a37e097b52d1751b99dc91d36d37d66e.tar.gz |
Merge branch 'fix-context-shutdown-merge' into libuv-0.10-fix-context-shutdown
Conflicts:
src/map/map.cpp
Diffstat (limited to 'common')
-rw-r--r-- | common/glfw_view.cpp | 9 | ||||
-rw-r--r-- | common/glfw_view.hpp | 1 | ||||
-rw-r--r-- | common/headless_view.cpp | 13 | ||||
-rw-r--r-- | common/headless_view.hpp | 1 |
4 files changed, 23 insertions, 1 deletions
diff --git a/common/glfw_view.cpp b/common/glfw_view.cpp index f53090a000..0908786bb6 100644 --- a/common/glfw_view.cpp +++ b/common/glfw_view.cpp @@ -8,7 +8,10 @@ GLFWView::GLFWView(bool fullscreen) : fullscreen(fullscreen) { #endif } -GLFWView::~GLFWView() { glfwTerminate(); } +GLFWView::~GLFWView() { + map->terminate(); + glfwTerminate(); +} void GLFWView::initialize(mbgl::Map *map) { View::initialize(map); @@ -192,6 +195,10 @@ void GLFWView::make_active() { glfwMakeContextCurrent(window); } +void GLFWView::make_inactive() { + glfwMakeContextCurrent(nullptr); +} + void GLFWView::swap() { glfwPostEmptyEvent(); diff --git a/common/glfw_view.hpp b/common/glfw_view.hpp index d2f6872fc7..04085f7750 100644 --- a/common/glfw_view.hpp +++ b/common/glfw_view.hpp @@ -17,6 +17,7 @@ public: void initialize(mbgl::Map *map); void swap(); void make_active(); + void make_inactive(); void notify_map_change(mbgl::MapChange change, mbgl::timestamp delay = 0); static void key(GLFWwindow *window, int key, int scancode, int action, int mods); diff --git a/common/headless_view.cpp b/common/headless_view.cpp index 0fce223986..0b4d7ce64a 100644 --- a/common/headless_view.cpp +++ b/common/headless_view.cpp @@ -181,6 +181,19 @@ void HeadlessView::make_active() { #endif } +void HeadlessView::make_inactive() { +#if MBGL_USE_CGL + CGLError error = CGLSetCurrentContext(nullptr); + if (error) { + fprintf(stderr, "Removing OpenGL context failed\n"); + } +#endif + +#if MBGL_USE_GLX + // no-op +#endif +} + void HeadlessView::swap() {} unsigned int HeadlessView::root_fbo() { diff --git a/common/headless_view.hpp b/common/headless_view.hpp index 0b255b4a38..a4432bbae3 100644 --- a/common/headless_view.hpp +++ b/common/headless_view.hpp @@ -23,6 +23,7 @@ public: void notify_map_change(MapChange change, timestamp delay = 0); void make_active(); + void make_inactive(); void swap(); unsigned int root_fbo(); |