vidMode need moniter

This commit is contained in:
halx99 2020-08-02 16:36:58 +08:00
parent 020b0ff79c
commit a624babd09
1 changed files with 11 additions and 4 deletions

View File

@ -645,8 +645,7 @@ bool GLViewImpl::isFullscreen() const {
void GLViewImpl::setFullscreen() void GLViewImpl::setFullscreen()
{ {
const GLFWvidmode* videoMode = glfwGetVideoMode(_monitor); setFullscreen(-1, -1, -1);
setFullscreen(videoMode->width, videoMode->height, videoMode->refreshRate);
} }
void GLViewImpl::setFullscreen(int w, int h, int refreshRate) { void GLViewImpl::setFullscreen(int w, int h, int refreshRate) {
@ -661,8 +660,7 @@ void GLViewImpl::setFullscreen(int w, int h, int refreshRate) {
void GLViewImpl::setFullscreen(int monitorIndex) void GLViewImpl::setFullscreen(int monitorIndex)
{ {
const GLFWvidmode* videoMode = glfwGetVideoMode(_monitor); setFullscreen(monitorIndex, -1, -1, -1);
setFullscreen(monitorIndex, videoMode->width, videoMode->height, videoMode->refreshRate);
} }
void GLViewImpl::setFullscreen(int monitorIndex, int w, int h, int refreshRate) { void GLViewImpl::setFullscreen(int monitorIndex, int w, int h, int refreshRate) {
@ -682,6 +680,15 @@ void GLViewImpl::setFullscreen(int monitorIndex, int w, int h, int refreshRate)
void GLViewImpl::setFullscreen(GLFWmonitor *monitor, int w, int h, int refreshRate) { void GLViewImpl::setFullscreen(GLFWmonitor *monitor, int w, int h, int refreshRate) {
_monitor = monitor; _monitor = monitor;
if (w == -1 || h == -1 || refreshRate == -1)
{
const GLFWvidmode* videoMode = glfwGetVideoMode(_monitor);
w = videoMode->width;
h = videoMode->height;
refreshRate = videoMode->refreshRate;
}
glfwSetWindowMonitor(_mainWindow, _monitor, 0, 0, w, h, refreshRate); glfwSetWindowMonitor(_mainWindow, _monitor, 0, 0, w, h, refreshRate);
updateWindowSize(); updateWindowSize();