summaryrefslogtreecommitdiff
path: root/macosx
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-01-21 16:16:21 +0100
committerKonstantin Käfer <mail@kkaefer.com>2014-01-21 16:16:21 +0100
commit474fb42807e855825909ed818a6d410b1b062d4c (patch)
tree985e2412ca4100e9fbb38846c74f790383e9270b /macosx
parent50f99e414ed02e6ab0edb9425b8c1074623b4719 (diff)
downloadqtlocation-mapboxgl-474fb42807e855825909ed818a6d410b1b062d4c.tar.gz
make it work on retina screens
Diffstat (limited to 'macosx')
-rw-r--r--macosx/main.mm18
1 files changed, 11 insertions, 7 deletions
diff --git a/macosx/main.mm b/macosx/main.mm
index 3fb8564443..cbf61eaf9d 100644
--- a/macosx/main.mm
+++ b/macosx/main.mm
@@ -33,14 +33,13 @@ public:
exit(1);
}
+ glfwSetWindowUserPointer(window, this);
glfwMakeContextCurrent(window);
settings.load();
map.setup();
- int width, height;
- glfwGetWindowSize(window, &width, &height);
- map.resize(width, height);
+ resize(window, 0, 0);
glfwSwapInterval(1);
@@ -49,11 +48,10 @@ public:
glfwSetCursorPosCallback(window, mousemove);
glfwSetMouseButtonCallback(window, mouseclick);
glfwSetWindowSizeCallback(window, resize);
+ glfwSetFramebufferSizeCallback(window, resize);
glfwSetScrollCallback(window, scroll);
glfwSetCharCallback(window, character);
glfwSetKeyCallback(window, key);
-
- glfwSetWindowUserPointer(window, this);
}
static void character(GLFWwindow *window, unsigned int codepoint) {
@@ -105,9 +103,15 @@ public:
view->map.scaleBy(scale, view->last_x, view->last_y);
}
- static void resize(GLFWwindow *window, int width, int height) {
+ static void resize(GLFWwindow *window, int, int) {
MapView *view = (MapView *)glfwGetWindowUserPointer(window);
- view->map.resize(width, height);
+
+ int width, height;
+ glfwGetWindowSize(window, &width, &height);
+ int fb_width, fb_height;
+ glfwGetFramebufferSize(window, &fb_width, &fb_height);
+
+ view->map.resize(width, height, fb_width, fb_height);
}
static void mouseclick(GLFWwindow *window, int button, int action, int modifiers) {