From 993f6b5ff9a386d08e0741e6e07cfee46340f675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Thu, 25 May 2017 21:13:54 -0700 Subject: [PATCH] glfw: Fixed toggle fullscreen. --- examples/common/entry/entry_glfw.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/examples/common/entry/entry_glfw.cpp b/examples/common/entry/entry_glfw.cpp index 0ff8fd31c..1f281ec4a 100644 --- a/examples/common/entry/entry_glfw.cpp +++ b/examples/common/entry/entry_glfw.cpp @@ -28,8 +28,9 @@ #include -#include #include +#include +#include #include #include "dbg.h" @@ -533,17 +534,25 @@ namespace entry case GLFW_WINDOW_TOGGLE_FULL_SCREEN: { GLFWwindow* window = m_windows[msg->m_handle.idx]; - if (glfwGetWindowMonitor(window)) + if (glfwGetWindowMonitor(window) ) { - int width, height; - glfwGetWindowSize(window, &width, &height); - glfwSetWindowMonitor(window, NULL, 0, 0, width, height, 0); + glfwSetWindowMonitor(window + , NULL + , m_oldX + , m_oldY + , m_oldWidth + , m_oldHeight + , 0 + ); } else { GLFWmonitor* monitor = glfwGetPrimaryMonitor(); if (NULL != monitor) { + glfwGetWindowPos(window, &m_oldX, &m_oldY); + glfwGetWindowSize(window, &m_oldWidth, &m_oldHeight); + const GLFWvidmode* mode = glfwGetVideoMode(monitor); glfwSetWindowMonitor(window , monitor @@ -624,6 +633,11 @@ namespace entry bx::SpScUnboundedQueueT m_msgs; + int32_t m_oldX; + int32_t m_oldY; + int32_t m_oldWidth; + int32_t m_oldHeight; + double m_scrollPos; };