From 62fd356b973d44c1df7a39e93a6c87f6895a06b1 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 5 Dec 2017 22:11:15 -0500 Subject: [PATCH] Switch to glfw master, use glfwGetWindowContentScale() to get DPI of window --- dep/Makefile | 11 +++++------ src/gui.cpp | 8 +++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/dep/Makefile b/dep/Makefile index 6f43c97b..9038f68e 100755 --- a/dep/Makefile +++ b/dep/Makefile @@ -86,13 +86,12 @@ $(glew): $(MAKE) -C glew-2.1.0 GLEW_DEST="$(LOCAL)" LIBDIR="$(LOCAL)/lib" install $(glfw): - $(WGET) https://github.com/glfw/glfw/releases/download/3.2.1/glfw-3.2.1.zip - $(UNZIP) glfw-3.2.1.zip - cd glfw-3.2.1 && $(CMAKE) . \ + git clone https://github.com/glfw/glfw.git + cd glfw && $(CMAKE) . \ -DCMAKE_INSTALL_PREFIX="$(LOCAL)" -DBUILD_SHARED_LIBS=ON \ - -DGLFW_USE_CHDIR=OFF -DGLFW_USE_MENUBAR=ON -DGLFW_USE_RETINA=ON - $(MAKE) -C glfw-3.2.1 - $(MAKE) -C glfw-3.2.1 install + -DGLFW_COCOA_CHDIR_RESOURCES=OFF -DGLFW_COCOA_MENUBAR=ON -DGLFW_COCOA_RETINA_FRAMEBUFFER=ON + $(MAKE) -C glfw + $(MAKE) -C glfw install ifeq ($(ARCH),win) # Not sure why the GLFW build system puts a .dll in the lib directory mv "$(LOCAL)/lib/glfw3.dll" "$(LOCAL)/bin/" diff --git a/src/gui.cpp b/src/gui.cpp index af9632fd..bfb1165b 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -418,11 +418,9 @@ void guiRun() { } // Get framebuffer size - int width, height; - glfwGetFramebufferSize(gWindow, &width, &height); - int windowWidth, windowHeight; - glfwGetWindowSize(gWindow, &windowWidth, &windowHeight); - float pixelRatio = (float)width / windowWidth; + float pixelRatio; + glfwGetWindowContentScale(gWindow, &pixelRatio, NULL); + pixelRatio = roundf(pixelRatio); if (pixelRatio != gPixelRatio) { EventZoom eZoom; gScene->onZoom(eZoom);