should fix ToggleBorderlessWindowed() on Linux and Macos
should fix issue #4149 Linux MATE : tested Macos : tested Windows : need confirmation --- thanks to @SoloByte and to @paulmelis for their help and efforts to solve this issue
This commit is contained in:
parent
74680748b9
commit
949aa21a7a
|
|
@ -216,22 +216,12 @@ void ToggleBorderlessWindowed(void)
|
||||||
if (!wasOnFullscreen) glfwGetWindowPos(platform.handle, &CORE.Window.previousPosition.x, &CORE.Window.previousPosition.y);
|
if (!wasOnFullscreen) glfwGetWindowPos(platform.handle, &CORE.Window.previousPosition.x, &CORE.Window.previousPosition.y);
|
||||||
CORE.Window.previousScreen = CORE.Window.screen;
|
CORE.Window.previousScreen = CORE.Window.screen;
|
||||||
|
|
||||||
// Set undecorated and topmost modes and flags
|
// Ask fullscreen window :
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_FALSE);
|
glfwSetWindowMonitor(platform.handle, monitors[monitor], 0, 0, mode->width, mode->height, mode->refreshRate);
|
||||||
CORE.Window.flags |= FLAG_WINDOW_UNDECORATED;
|
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_FLOATING, GLFW_TRUE);
|
|
||||||
CORE.Window.flags |= FLAG_WINDOW_TOPMOST;
|
|
||||||
|
|
||||||
// Get monitor position and size
|
// Let's not wait for GLFW to call WindowSizeCallback to update these values :
|
||||||
int monitorPosX = 0;
|
CORE.Window.screen.width = mode->width ;
|
||||||
int monitorPosY = 0;
|
CORE.Window.screen.height = mode->height ;
|
||||||
glfwGetMonitorPos(monitors[monitor], &monitorPosX, &monitorPosY);
|
|
||||||
const int monitorWidth = mode->width;
|
|
||||||
const int monitorHeight = mode->height;
|
|
||||||
|
|
||||||
// Set screen position and size
|
|
||||||
glfwSetWindowPos(platform.handle, monitorPosX, monitorPosY);
|
|
||||||
glfwSetWindowSize(platform.handle, monitorWidth, monitorHeight);
|
|
||||||
|
|
||||||
// Refocus window
|
// Refocus window
|
||||||
glfwFocusWindow(platform.handle);
|
glfwFocusWindow(platform.handle);
|
||||||
|
|
@ -240,16 +230,17 @@ void ToggleBorderlessWindowed(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Remove topmost and undecorated modes and flags
|
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_FLOATING, GLFW_FALSE);
|
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_TOPMOST;
|
|
||||||
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_TRUE);
|
|
||||||
CORE.Window.flags &= ~FLAG_WINDOW_UNDECORATED;
|
|
||||||
|
|
||||||
// Return previous screen size and position
|
// Return previous screen size and position
|
||||||
// NOTE: The order matters here, it must set size first, then set position, otherwise the screen will be positioned incorrectly
|
int prevPosX = CORE.Window.previousPosition.x ;
|
||||||
glfwSetWindowSize(platform.handle, CORE.Window.previousScreen.width, CORE.Window.previousScreen.height);
|
int prevPosY = CORE.Window.previousPosition.y ;
|
||||||
glfwSetWindowPos(platform.handle, CORE.Window.previousPosition.x, CORE.Window.previousPosition.y);
|
int prevWidth = CORE.Window.previousScreen.width ;
|
||||||
|
int prevHeight = CORE.Window.previousScreen.height ;
|
||||||
|
|
||||||
|
glfwSetWindowMonitor(platform.handle, NULL, prevPosX , prevPosY, prevWidth, prevHeight, GLFW_DONT_CARE);
|
||||||
|
|
||||||
|
// Let's not wait for GLFW to call WindowSizeCallback to update these values :
|
||||||
|
CORE.Window.screen.width = prevWidth ;
|
||||||
|
CORE.Window.screen.height = prevHeight ;
|
||||||
|
|
||||||
// Refocus window
|
// Refocus window
|
||||||
glfwFocusWindow(platform.handle);
|
glfwFocusWindow(platform.handle);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user