mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-22 18:28:52 -05:00
Wayland: Fix behavior of leaving full screen mode
These changes make GLFW fullscreen more consistent, but unfortunately also make GLFW even more oblivious to user-initiated XDG shell fullscreen changes. Fixes #1995
This commit is contained in:
parent
523fdf50c1
commit
ddd087d662
|
@ -160,6 +160,7 @@ video tutorials.
|
|||
- Christopher Pelloux
|
||||
- Arturo J. Pérez
|
||||
- Vladimir Perminov
|
||||
- Olivier Perret
|
||||
- Anthony Pesch
|
||||
- Orson Peters
|
||||
- Emmanuel Gil Peyrot
|
||||
|
|
|
@ -331,6 +331,10 @@ information on what to include when reporting a bug.
|
|||
- [Wayland] Bugfix: The OSMesa library was not unloaded on termination
|
||||
- [Wayland] Bugfix: `glfwCreateWindow` could emit `GLFW_FEATURE_UNAVAILABLE`
|
||||
- [Wayland] Bugfix: Lock key modifier bits were only set when lock keys were pressed
|
||||
- [Wayland] Bugfix: A window leaving full screen mode would be iconified (#1995)
|
||||
- [Wayland] Bugfix: A window leaving full screen mode ignored its desired size
|
||||
- [Wayland] Bugfix: `glfwSetWindowMonitor` did not update windowed mode size
|
||||
- [Wayland] Bugfix: `glfwRestoreWindow` would make a full screen window windowed
|
||||
- [POSIX] Removed use of deprecated function `gettimeofday`
|
||||
- [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled
|
||||
- [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072)
|
||||
|
|
|
@ -233,6 +233,7 @@ typedef struct _GLFWwindowWayland
|
|||
int width, height;
|
||||
GLFWbool visible;
|
||||
GLFWbool maximized;
|
||||
GLFWbool activated;
|
||||
GLFWbool hovered;
|
||||
GLFWbool transparent;
|
||||
struct wl_surface* surface;
|
||||
|
@ -264,8 +265,6 @@ typedef struct _GLFWwindowWayland
|
|||
|
||||
struct zwp_idle_inhibitor_v1* idleInhibitor;
|
||||
|
||||
GLFWbool wasFullscreen;
|
||||
|
||||
struct {
|
||||
GLFWbool serverSide;
|
||||
struct wl_buffer* buffer;
|
||||
|
|
|
@ -429,20 +429,35 @@ static void setIdleInhibitor(_GLFWwindow* window, GLFWbool enable)
|
|||
}
|
||||
}
|
||||
|
||||
static void setFullscreen(_GLFWwindow* window, _GLFWmonitor* monitor,
|
||||
int refreshRate)
|
||||
// Make the specified window and its video mode active on its monitor
|
||||
//
|
||||
static void acquireMonitor(_GLFWwindow* window)
|
||||
{
|
||||
if (window->wl.xdg.toplevel)
|
||||
{
|
||||
xdg_toplevel_set_fullscreen(
|
||||
window->wl.xdg.toplevel,
|
||||
monitor->wl.output);
|
||||
xdg_toplevel_set_fullscreen(window->wl.xdg.toplevel,
|
||||
window->monitor->wl.output);
|
||||
}
|
||||
|
||||
setIdleInhibitor(window, GLFW_TRUE);
|
||||
|
||||
if (!window->wl.decorations.serverSide)
|
||||
destroyDecorations(window);
|
||||
}
|
||||
|
||||
// Remove the window and restore the original video mode
|
||||
//
|
||||
static void releaseMonitor(_GLFWwindow* window)
|
||||
{
|
||||
if (window->wl.xdg.toplevel)
|
||||
xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel);
|
||||
|
||||
setIdleInhibitor(window, GLFW_FALSE);
|
||||
|
||||
if (!_glfw.wl.decorationManager)
|
||||
createDecorations(window);
|
||||
}
|
||||
|
||||
static void xdgToplevelHandleConfigure(void* userData,
|
||||
struct xdg_toplevel* toplevel,
|
||||
int32_t width,
|
||||
|
@ -495,16 +510,13 @@ static void xdgToplevelHandleConfigure(void* userData,
|
|||
_glfwInputWindowDamage(window);
|
||||
}
|
||||
|
||||
if (window->wl.wasFullscreen && window->autoIconify)
|
||||
if (window->wl.activated && !activated)
|
||||
{
|
||||
if (!activated || !fullscreen)
|
||||
{
|
||||
if (window->monitor && window->autoIconify)
|
||||
_glfwIconifyWindowWayland(window);
|
||||
window->wl.wasFullscreen = GLFW_FALSE;
|
||||
}
|
||||
}
|
||||
if (fullscreen && activated)
|
||||
window->wl.wasFullscreen = GLFW_TRUE;
|
||||
|
||||
window->wl.activated = activated;
|
||||
}
|
||||
|
||||
static void xdgToplevelHandleClose(void* userData,
|
||||
|
@ -1896,14 +1908,12 @@ void _glfwRestoreWindowWayland(_GLFWwindow* window)
|
|||
{
|
||||
if (window->wl.xdg.toplevel)
|
||||
{
|
||||
if (window->monitor)
|
||||
xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel);
|
||||
if (window->wl.maximized)
|
||||
xdg_toplevel_unset_maximized(window->wl.xdg.toplevel);
|
||||
// There is no way to unset minimized, or even to know if we are
|
||||
// minimized, so there is nothing to do in this case.
|
||||
}
|
||||
_glfwInputWindowMonitor(window, NULL);
|
||||
|
||||
window->wl.maximized = GLFW_FALSE;
|
||||
}
|
||||
|
||||
|
@ -1959,19 +1969,23 @@ void _glfwSetWindowMonitorWayland(_GLFWwindow* window,
|
|||
int width, int height,
|
||||
int refreshRate)
|
||||
{
|
||||
if (monitor)
|
||||
if (window->monitor == monitor)
|
||||
{
|
||||
setFullscreen(window, monitor, refreshRate);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (window->wl.xdg.toplevel)
|
||||
xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel);
|
||||
setIdleInhibitor(window, GLFW_FALSE);
|
||||
if (!_glfw.wl.decorationManager)
|
||||
createDecorations(window);
|
||||
if (!monitor)
|
||||
_glfwSetWindowSizeWayland(window, width, height);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (window->monitor)
|
||||
releaseMonitor(window);
|
||||
|
||||
_glfwInputWindowMonitor(window, monitor);
|
||||
|
||||
if (window->monitor)
|
||||
acquireMonitor(window);
|
||||
else
|
||||
_glfwSetWindowSizeWayland(window, width, height);
|
||||
}
|
||||
|
||||
GLFWbool _glfwWindowFocusedWayland(_GLFWwindow* window)
|
||||
|
|
Loading…
Reference in New Issue
Block a user