mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Wayland: Remove support for wl_shell
This is adapted to 3.3-stable from599fb3de34
and27295b508f
.
This commit is contained in:
parent
9f8ec83411
commit
581fed38be
@ -139,6 +139,7 @@ information on what to include when reporting a bug.
|
|||||||
- [X11] Bugfix: A malformed response during selection transfer could cause a segfault
|
- [X11] Bugfix: A malformed response during selection transfer could cause a segfault
|
||||||
- [X11] Bugfix: Some calls would reset Xlib to the default error handler (#2108)
|
- [X11] Bugfix: Some calls would reset Xlib to the default error handler (#2108)
|
||||||
- [Wayland] Added support for file path drop events (#2040)
|
- [Wayland] Added support for file path drop events (#2040)
|
||||||
|
- [Wayland] Removed support for the deprecated wl\_shell protocol
|
||||||
- [Wayland] Bugfix: `glfwSetClipboardString` would fail if set to result of
|
- [Wayland] Bugfix: `glfwSetClipboardString` would fail if set to result of
|
||||||
`glfwGetClipboardString`
|
`glfwGetClipboardString`
|
||||||
- [Wayland] Bugfix: Data source creation error would cause double free at termination
|
- [Wayland] Bugfix: Data source creation error would cause double free at termination
|
||||||
|
@ -104,11 +104,7 @@ has been configured in the compositor.
|
|||||||
GLFW uses the [xdg-shell
|
GLFW uses the [xdg-shell
|
||||||
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml)
|
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml)
|
||||||
to provide better window management. This protocol is part of
|
to provide better window management. This protocol is part of
|
||||||
wayland-protocols 1.12, and mandatory at build time. If the running compositor
|
wayland-protocols 1.12, and mandatory at build time.
|
||||||
does not support this protocol, the older [wl_shell
|
|
||||||
interface](https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml#n972)
|
|
||||||
will be used instead. This will result in a worse integration with the
|
|
||||||
desktop, especially on tiling compositors.
|
|
||||||
|
|
||||||
GLFW uses the [relative pointer
|
GLFW uses the [relative pointer
|
||||||
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/relative-pointer/relative-pointer-unstable-v1.xml)
|
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/relative-pointer/relative-pointer-unstable-v1.xml)
|
||||||
|
@ -378,6 +378,13 @@ Existing projects and makefiles that set the `LIB_SUFFIX` option will use the
|
|||||||
suffix chosen by the GNUInstallDirs package and the option will be ignored.
|
suffix chosen by the GNUInstallDirs package and the option will be ignored.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection wl_shell_33 Support for the wl_shell protocol
|
||||||
|
|
||||||
|
Support for the wl_shell protocol has been removed and GLFW now only supports
|
||||||
|
the XDG-Shell protocol. If your Wayland compositor does not support XDG-Shell
|
||||||
|
then GLFW will fail to initialize.
|
||||||
|
|
||||||
|
|
||||||
@subsubsection mir_removed_33 Mir support
|
@subsubsection mir_removed_33 Mir support
|
||||||
|
|
||||||
The experimental Mir support has been completely removed as the Mir project has
|
The experimental Mir support has been completely removed as the Mir project has
|
||||||
|
@ -3226,10 +3226,6 @@ GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity);
|
|||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
* GLFW_PLATFORM_ERROR.
|
* GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @remark @wayland There is no concept of iconification in wl_shell, this
|
|
||||||
* function will emit @ref GLFW_PLATFORM_ERROR when using this deprecated
|
|
||||||
* protocol.
|
|
||||||
*
|
|
||||||
* @thread_safety This function must only be called from the main thread.
|
* @thread_safety This function must only be called from the main thread.
|
||||||
*
|
*
|
||||||
* @sa @ref window_iconify
|
* @sa @ref window_iconify
|
||||||
@ -3809,8 +3805,8 @@ GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwi
|
|||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||||
*
|
*
|
||||||
* @remark @wayland The wl_shell protocol has no concept of iconification,
|
* @remark @wayland The XDG-shell protocol has no event for iconification, so
|
||||||
* this callback will never be called when using this deprecated protocol.
|
* this callback will never be called.
|
||||||
*
|
*
|
||||||
* @thread_safety This function must only be called from the main thread.
|
* @thread_safety This function must only be called from the main thread.
|
||||||
*
|
*
|
||||||
|
@ -76,11 +76,6 @@ static void registryHandleGlobal(void* userData,
|
|||||||
_glfw.wl.shm =
|
_glfw.wl.shm =
|
||||||
wl_registry_bind(registry, name, &wl_shm_interface, 1);
|
wl_registry_bind(registry, name, &wl_shm_interface, 1);
|
||||||
}
|
}
|
||||||
else if (strcmp(interface, "wl_shell") == 0)
|
|
||||||
{
|
|
||||||
_glfw.wl.shell =
|
|
||||||
wl_registry_bind(registry, name, &wl_shell_interface, 1);
|
|
||||||
}
|
|
||||||
else if (strcmp(interface, "wl_output") == 0)
|
else if (strcmp(interface, "wl_output") == 0)
|
||||||
{
|
{
|
||||||
_glfwAddOutputWayland(name, version);
|
_glfwAddOutputWayland(name, version);
|
||||||
@ -439,6 +434,13 @@ int _glfwPlatformInit(void)
|
|||||||
if (_glfw.wl.seatVersion >= 4)
|
if (_glfw.wl.seatVersion >= 4)
|
||||||
_glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
_glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
||||||
|
|
||||||
|
if (!_glfw.wl.wmBase)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Wayland: Failed to find xdg-shell in your compositor");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (_glfw.wl.pointer && _glfw.wl.shm)
|
if (_glfw.wl.pointer && _glfw.wl.shm)
|
||||||
{
|
{
|
||||||
cursorTheme = getenv("XCURSOR_THEME");
|
cursorTheme = getenv("XCURSOR_THEME");
|
||||||
@ -529,8 +531,6 @@ void _glfwPlatformTerminate(void)
|
|||||||
wl_compositor_destroy(_glfw.wl.compositor);
|
wl_compositor_destroy(_glfw.wl.compositor);
|
||||||
if (_glfw.wl.shm)
|
if (_glfw.wl.shm)
|
||||||
wl_shm_destroy(_glfw.wl.shm);
|
wl_shm_destroy(_glfw.wl.shm);
|
||||||
if (_glfw.wl.shell)
|
|
||||||
wl_shell_destroy(_glfw.wl.shell);
|
|
||||||
if (_glfw.wl.viewporter)
|
if (_glfw.wl.viewporter)
|
||||||
wp_viewporter_destroy(_glfw.wl.viewporter);
|
wp_viewporter_destroy(_glfw.wl.viewporter);
|
||||||
if (_glfw.wl.decorationManager)
|
if (_glfw.wl.decorationManager)
|
||||||
|
@ -185,7 +185,6 @@ typedef struct _GLFWwindowWayland
|
|||||||
GLFWbool transparent;
|
GLFWbool transparent;
|
||||||
struct wl_surface* surface;
|
struct wl_surface* surface;
|
||||||
struct wl_egl_window* native;
|
struct wl_egl_window* native;
|
||||||
struct wl_shell_surface* shellSurface;
|
|
||||||
struct wl_callback* callback;
|
struct wl_callback* callback;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@ -231,7 +230,6 @@ typedef struct _GLFWlibraryWayland
|
|||||||
struct wl_registry* registry;
|
struct wl_registry* registry;
|
||||||
struct wl_compositor* compositor;
|
struct wl_compositor* compositor;
|
||||||
struct wl_subcompositor* subcompositor;
|
struct wl_subcompositor* subcompositor;
|
||||||
struct wl_shell* shell;
|
|
||||||
struct wl_shm* shm;
|
struct wl_shm* shm;
|
||||||
struct wl_seat* seat;
|
struct wl_seat* seat;
|
||||||
struct wl_pointer* pointer;
|
struct wl_pointer* pointer;
|
||||||
|
195
src/wl_window.c
195
src/wl_window.c
@ -43,72 +43,6 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
static void shellSurfaceHandlePing(void* data,
|
|
||||||
struct wl_shell_surface* shellSurface,
|
|
||||||
uint32_t serial)
|
|
||||||
{
|
|
||||||
wl_shell_surface_pong(shellSurface, serial);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void shellSurfaceHandleConfigure(void* data,
|
|
||||||
struct wl_shell_surface* shellSurface,
|
|
||||||
uint32_t edges,
|
|
||||||
int32_t width,
|
|
||||||
int32_t height)
|
|
||||||
{
|
|
||||||
_GLFWwindow* window = data;
|
|
||||||
float aspectRatio;
|
|
||||||
float targetRatio;
|
|
||||||
|
|
||||||
if (!window->monitor)
|
|
||||||
{
|
|
||||||
if (_glfw.wl.viewporter && window->decorated)
|
|
||||||
{
|
|
||||||
width -= _GLFW_DECORATION_HORIZONTAL;
|
|
||||||
height -= _GLFW_DECORATION_VERTICAL;
|
|
||||||
}
|
|
||||||
if (width < 1)
|
|
||||||
width = 1;
|
|
||||||
if (height < 1)
|
|
||||||
height = 1;
|
|
||||||
|
|
||||||
if (window->numer != GLFW_DONT_CARE && window->denom != GLFW_DONT_CARE)
|
|
||||||
{
|
|
||||||
aspectRatio = (float)width / (float)height;
|
|
||||||
targetRatio = (float)window->numer / (float)window->denom;
|
|
||||||
if (aspectRatio < targetRatio)
|
|
||||||
height = width / targetRatio;
|
|
||||||
else if (aspectRatio > targetRatio)
|
|
||||||
width = height * targetRatio;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window->minwidth != GLFW_DONT_CARE && width < window->minwidth)
|
|
||||||
width = window->minwidth;
|
|
||||||
else if (window->maxwidth != GLFW_DONT_CARE && width > window->maxwidth)
|
|
||||||
width = window->maxwidth;
|
|
||||||
|
|
||||||
if (window->minheight != GLFW_DONT_CARE && height < window->minheight)
|
|
||||||
height = window->minheight;
|
|
||||||
else if (window->maxheight != GLFW_DONT_CARE && height > window->maxheight)
|
|
||||||
height = window->maxheight;
|
|
||||||
}
|
|
||||||
|
|
||||||
_glfwInputWindowSize(window, width, height);
|
|
||||||
_glfwPlatformSetWindowSize(window, width, height);
|
|
||||||
_glfwInputWindowDamage(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void shellSurfaceHandlePopupDone(void* data,
|
|
||||||
struct wl_shell_surface* shellSurface)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct wl_shell_surface_listener shellSurfaceListener = {
|
|
||||||
shellSurfaceHandlePing,
|
|
||||||
shellSurfaceHandleConfigure,
|
|
||||||
shellSurfaceHandlePopupDone
|
|
||||||
};
|
|
||||||
|
|
||||||
static int createTmpfileCloexec(char* tmpname)
|
static int createTmpfileCloexec(char* tmpname)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
@ -546,66 +480,12 @@ static void setFullscreen(_GLFWwindow* window, _GLFWmonitor* monitor,
|
|||||||
window->wl.xdg.toplevel,
|
window->wl.xdg.toplevel,
|
||||||
monitor->wl.output);
|
monitor->wl.output);
|
||||||
}
|
}
|
||||||
else if (window->wl.shellSurface)
|
|
||||||
{
|
|
||||||
wl_shell_surface_set_fullscreen(
|
|
||||||
window->wl.shellSurface,
|
|
||||||
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
|
|
||||||
refreshRate * 1000, // Convert Hz to mHz.
|
|
||||||
monitor->wl.output);
|
|
||||||
}
|
|
||||||
setIdleInhibitor(window, GLFW_TRUE);
|
setIdleInhibitor(window, GLFW_TRUE);
|
||||||
if (!window->wl.decorations.serverSide)
|
if (!window->wl.decorations.serverSide)
|
||||||
destroyDecorations(window);
|
destroyDecorations(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLFWbool createShellSurface(_GLFWwindow* window)
|
|
||||||
{
|
|
||||||
if (!_glfw.wl.shell)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Wayland: wl_shell protocol not available");
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
window->wl.shellSurface = wl_shell_get_shell_surface(_glfw.wl.shell,
|
|
||||||
window->wl.surface);
|
|
||||||
if (!window->wl.shellSurface)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Wayland: Shell surface creation failed");
|
|
||||||
return GLFW_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_shell_surface_add_listener(window->wl.shellSurface,
|
|
||||||
&shellSurfaceListener,
|
|
||||||
window);
|
|
||||||
|
|
||||||
if (window->wl.title)
|
|
||||||
wl_shell_surface_set_title(window->wl.shellSurface, window->wl.title);
|
|
||||||
|
|
||||||
if (window->monitor)
|
|
||||||
{
|
|
||||||
setFullscreen(window, window->monitor, 0);
|
|
||||||
}
|
|
||||||
else if (window->wl.maximized)
|
|
||||||
{
|
|
||||||
wl_shell_surface_set_maximized(window->wl.shellSurface, NULL);
|
|
||||||
setIdleInhibitor(window, GLFW_FALSE);
|
|
||||||
createDecorations(window);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wl_shell_surface_set_toplevel(window->wl.shellSurface);
|
|
||||||
setIdleInhibitor(window, GLFW_FALSE);
|
|
||||||
createDecorations(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_surface_commit(window->wl.surface);
|
|
||||||
|
|
||||||
return GLFW_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void xdgToplevelHandleConfigure(void* userData,
|
static void xdgToplevelHandleConfigure(void* userData,
|
||||||
struct xdg_toplevel* toplevel,
|
struct xdg_toplevel* toplevel,
|
||||||
int32_t width,
|
int32_t width,
|
||||||
@ -1238,8 +1118,7 @@ static void pointerHandleButton(void* userData,
|
|||||||
_GLFWwindow* window = _glfw.wl.pointerFocus;
|
_GLFWwindow* window = _glfw.wl.pointerFocus;
|
||||||
int glfwButton;
|
int glfwButton;
|
||||||
|
|
||||||
// Both xdg-shell and wl_shell use the same values.
|
uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_NONE;
|
||||||
uint32_t edges = WL_SHELL_SURFACE_RESIZE_NONE;
|
|
||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
@ -1251,46 +1130,39 @@ static void pointerHandleButton(void* userData,
|
|||||||
break;
|
break;
|
||||||
case topDecoration:
|
case topDecoration:
|
||||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
||||||
edges = WL_SHELL_SURFACE_RESIZE_TOP;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (window->wl.xdg.toplevel)
|
|
||||||
xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial);
|
xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial);
|
||||||
else
|
|
||||||
wl_shell_surface_move(window->wl.shellSurface, _glfw.wl.seat, serial);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case leftDecoration:
|
case leftDecoration:
|
||||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
||||||
edges = WL_SHELL_SURFACE_RESIZE_TOP_LEFT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT;
|
||||||
else
|
else
|
||||||
edges = WL_SHELL_SURFACE_RESIZE_LEFT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_LEFT;
|
||||||
break;
|
break;
|
||||||
case rightDecoration:
|
case rightDecoration:
|
||||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
||||||
edges = WL_SHELL_SURFACE_RESIZE_TOP_RIGHT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT;
|
||||||
else
|
else
|
||||||
edges = WL_SHELL_SURFACE_RESIZE_RIGHT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_RIGHT;
|
||||||
break;
|
break;
|
||||||
case bottomDecoration:
|
case bottomDecoration:
|
||||||
if (window->wl.cursorPosX < _GLFW_DECORATION_WIDTH)
|
if (window->wl.cursorPosX < _GLFW_DECORATION_WIDTH)
|
||||||
edges = WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT;
|
||||||
else if (window->wl.cursorPosX > window->wl.width + _GLFW_DECORATION_WIDTH)
|
else if (window->wl.cursorPosX > window->wl.width + _GLFW_DECORATION_WIDTH)
|
||||||
edges = WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT;
|
||||||
else
|
else
|
||||||
edges = WL_SHELL_SURFACE_RESIZE_BOTTOM;
|
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
if (edges != WL_SHELL_SURFACE_RESIZE_NONE)
|
if (edges != XDG_TOPLEVEL_RESIZE_EDGE_NONE)
|
||||||
{
|
{
|
||||||
if (window->wl.xdg.toplevel)
|
|
||||||
xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat,
|
xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat,
|
||||||
serial, edges);
|
serial, edges);
|
||||||
else
|
|
||||||
wl_shell_surface_resize(window->wl.shellSurface, _glfw.wl.seat,
|
|
||||||
serial, edges);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1958,9 +1830,6 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
|||||||
if (window->wl.native)
|
if (window->wl.native)
|
||||||
wl_egl_window_destroy(window->wl.native);
|
wl_egl_window_destroy(window->wl.native);
|
||||||
|
|
||||||
if (window->wl.shellSurface)
|
|
||||||
wl_shell_surface_destroy(window->wl.shellSurface);
|
|
||||||
|
|
||||||
if (window->wl.xdg.toplevel)
|
if (window->wl.xdg.toplevel)
|
||||||
xdg_toplevel_destroy(window->wl.xdg.toplevel);
|
xdg_toplevel_destroy(window->wl.xdg.toplevel);
|
||||||
|
|
||||||
@ -1981,8 +1850,6 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
|||||||
window->wl.title = _glfw_strdup(title);
|
window->wl.title = _glfw_strdup(title);
|
||||||
if (window->wl.xdg.toplevel)
|
if (window->wl.xdg.toplevel)
|
||||||
xdg_toplevel_set_title(window->wl.xdg.toplevel, title);
|
xdg_toplevel_set_title(window->wl.xdg.toplevel, title);
|
||||||
else if (window->wl.shellSurface)
|
|
||||||
wl_shell_surface_set_title(window->wl.shellSurface, title);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
|
void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
|
||||||
@ -2027,8 +1894,6 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
|||||||
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
|
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
|
||||||
int minwidth, int minheight,
|
int minwidth, int minheight,
|
||||||
int maxwidth, int maxheight)
|
int maxwidth, int maxheight)
|
||||||
{
|
|
||||||
if (_glfw.wl.wmBase)
|
|
||||||
{
|
{
|
||||||
if (window->wl.xdg.toplevel)
|
if (window->wl.xdg.toplevel)
|
||||||
{
|
{
|
||||||
@ -2041,18 +1906,12 @@ void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
|
|||||||
wl_surface_commit(window->wl.surface);
|
wl_surface_commit(window->wl.surface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// TODO: find out how to trigger a resize.
|
|
||||||
// The actual limits are checked in the wl_shell_surface::configure handler.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window,
|
void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window,
|
||||||
int numer, int denom)
|
int numer, int denom)
|
||||||
{
|
{
|
||||||
// TODO: find out how to trigger a resize.
|
// TODO: find out how to trigger a resize.
|
||||||
// The actual limits are checked in the wl_shell_surface::configure handler.
|
// The actual limits are checked in the xdg_toplevel::configure handler.
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window,
|
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window,
|
||||||
@ -2092,18 +1951,10 @@ void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
||||||
{
|
|
||||||
if (_glfw.wl.wmBase)
|
|
||||||
{
|
{
|
||||||
if (window->wl.xdg.toplevel)
|
if (window->wl.xdg.toplevel)
|
||||||
xdg_toplevel_set_minimized(window->wl.xdg.toplevel);
|
xdg_toplevel_set_minimized(window->wl.xdg.toplevel);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
||||||
"Wayland: Iconify window not supported on wl_shell");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
@ -2116,11 +1967,7 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
|||||||
// There is no way to unset minimized, or even to know if we are
|
// There is no way to unset minimized, or even to know if we are
|
||||||
// minimized, so there is nothing to do here.
|
// minimized, so there is nothing to do here.
|
||||||
}
|
}
|
||||||
else if (window->wl.shellSurface)
|
|
||||||
{
|
|
||||||
if (window->monitor || window->wl.maximized)
|
|
||||||
wl_shell_surface_set_toplevel(window->wl.shellSurface);
|
|
||||||
}
|
|
||||||
_glfwInputWindowMonitor(window, NULL);
|
_glfwInputWindowMonitor(window, NULL);
|
||||||
window->wl.maximized = GLFW_FALSE;
|
window->wl.maximized = GLFW_FALSE;
|
||||||
}
|
}
|
||||||
@ -2131,11 +1978,7 @@ void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
xdg_toplevel_set_maximized(window->wl.xdg.toplevel);
|
xdg_toplevel_set_maximized(window->wl.xdg.toplevel);
|
||||||
}
|
}
|
||||||
else if (window->wl.shellSurface)
|
|
||||||
{
|
|
||||||
// Let the compositor select the best output.
|
|
||||||
wl_shell_surface_set_maximized(window->wl.shellSurface, NULL);
|
|
||||||
}
|
|
||||||
window->wl.maximized = GLFW_TRUE;
|
window->wl.maximized = GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2145,13 +1988,8 @@ void _glfwPlatformShowWindow(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
// NOTE: The XDG/shell surface is created here so command-line applications
|
// NOTE: The XDG/shell surface is created here so command-line applications
|
||||||
// with off-screen windows do not appear in for example the Unity dock
|
// with off-screen windows do not appear in for example the Unity dock
|
||||||
if (_glfw.wl.wmBase)
|
|
||||||
{
|
|
||||||
if (!window->wl.xdg.toplevel)
|
if (!window->wl.xdg.toplevel)
|
||||||
createXdgSurface(window);
|
createXdgSurface(window);
|
||||||
}
|
|
||||||
else if (!window->wl.shellSurface)
|
|
||||||
createShellSurface(window);
|
|
||||||
|
|
||||||
window->wl.visible = GLFW_TRUE;
|
window->wl.visible = GLFW_TRUE;
|
||||||
_glfwInputWindowDamage(window);
|
_glfwInputWindowDamage(window);
|
||||||
@ -2195,8 +2033,6 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
if (window->wl.xdg.toplevel)
|
if (window->wl.xdg.toplevel)
|
||||||
xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel);
|
xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel);
|
||||||
else if (window->wl.shellSurface)
|
|
||||||
wl_shell_surface_set_toplevel(window->wl.shellSurface);
|
|
||||||
setIdleInhibitor(window, GLFW_FALSE);
|
setIdleInhibitor(window, GLFW_FALSE);
|
||||||
if (!_glfw.wl.decorationManager)
|
if (!_glfw.wl.decorationManager)
|
||||||
createDecorations(window);
|
createDecorations(window);
|
||||||
@ -2211,8 +2047,7 @@ int _glfwPlatformWindowFocused(_GLFWwindow* window)
|
|||||||
|
|
||||||
int _glfwPlatformWindowIconified(_GLFWwindow* window)
|
int _glfwPlatformWindowIconified(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
// wl_shell doesn't have any iconified concept, and xdg-shell doesn’t give
|
// xdg-shell doesn’t give any way to request whether a surface is iconified
|
||||||
// any way to request whether a surface is iconified.
|
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user