mirror of
https://github.com/glfw/glfw.git
synced 2025-12-19 21:51:56 +00:00
Compare commits
3 Commits
ebfd590832
...
1813157f5b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1813157f5b | ||
|
|
162896e5b9 | ||
|
|
2307384a83 |
@ -144,6 +144,8 @@ information on what to include when reporting a bug.
|
||||
a modal to a fallback decoration
|
||||
- [Wayland] Bugfix: The cursor position was not updated when clicking through
|
||||
from a modal to the content area
|
||||
- [Wayland] Bugfix: free modules at end of terminate function to resolve
|
||||
potential segmentation fault (#2744)
|
||||
- [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631)
|
||||
- [X11] Bugfix: Occasional crash when an idle display awakes (#2766)
|
||||
- [X11] Bugfix: Prevent BadWindow when creating small windows with a content scale
|
||||
|
||||
@ -555,7 +555,8 @@ void _glfwTerminateEGL(void)
|
||||
_glfw.egl.display = EGL_NO_DISPLAY;
|
||||
}
|
||||
|
||||
if (_glfw.egl.handle)
|
||||
// Free modules only after all wayland termination functions are called
|
||||
if (_glfw.egl.handle && _glfw.platform.platformID != GLFW_PLATFORM_WAYLAND)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.egl.handle);
|
||||
_glfw.egl.handle = NULL;
|
||||
|
||||
@ -907,18 +907,6 @@ void _glfwTerminateWayland(void)
|
||||
libdecor_unref(_glfw.wl.libdecor.context);
|
||||
}
|
||||
|
||||
if (_glfw.wl.libdecor.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.libdecor.handle);
|
||||
_glfw.wl.libdecor.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.egl.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.egl.handle);
|
||||
_glfw.wl.egl.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.xkb.composeState)
|
||||
xkb_compose_state_unref(_glfw.wl.xkb.composeState);
|
||||
if (_glfw.wl.xkb.keymap)
|
||||
@ -927,21 +915,11 @@ void _glfwTerminateWayland(void)
|
||||
xkb_state_unref(_glfw.wl.xkb.state);
|
||||
if (_glfw.wl.xkb.context)
|
||||
xkb_context_unref(_glfw.wl.xkb.context);
|
||||
if (_glfw.wl.xkb.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.xkb.handle);
|
||||
_glfw.wl.xkb.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.cursorTheme)
|
||||
wl_cursor_theme_destroy(_glfw.wl.cursorTheme);
|
||||
if (_glfw.wl.cursorThemeHiDPI)
|
||||
wl_cursor_theme_destroy(_glfw.wl.cursorThemeHiDPI);
|
||||
if (_glfw.wl.cursor.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.cursor.handle);
|
||||
_glfw.wl.cursor.handle = NULL;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < _glfw.wl.offerCount; i++)
|
||||
wl_data_offer_destroy(_glfw.wl.offers[i].offer);
|
||||
@ -1001,6 +979,36 @@ void _glfwTerminateWayland(void)
|
||||
if (_glfw.wl.cursorTimerfd >= 0)
|
||||
close(_glfw.wl.cursorTimerfd);
|
||||
|
||||
// Free modules only after all wayland termination functions are called
|
||||
if (_glfw.egl.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.egl.handle);
|
||||
_glfw.egl.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.libdecor.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.libdecor.handle);
|
||||
_glfw.wl.libdecor.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.egl.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.egl.handle);
|
||||
_glfw.wl.egl.handle = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.wl.xkb.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.xkb.handle);
|
||||
_glfw.wl.xkb.handle = NULL;
|
||||
}
|
||||
if (_glfw.wl.cursor.handle)
|
||||
{
|
||||
_glfwPlatformFreeModule(_glfw.wl.cursor.handle);
|
||||
_glfw.wl.cursor.handle = NULL;
|
||||
}
|
||||
|
||||
_glfw_free(_glfw.wl.clipboardString);
|
||||
}
|
||||
|
||||
|
||||
@ -372,6 +372,7 @@ typedef struct _GLFWwindowWayland
|
||||
GLFWbool iconified;
|
||||
GLFWbool activated;
|
||||
GLFWbool fullscreen;
|
||||
double cursorPosX, cursorPosY;
|
||||
} pending;
|
||||
|
||||
struct {
|
||||
@ -387,6 +388,7 @@ typedef struct _GLFWwindowWayland
|
||||
|
||||
_GLFWcursor* currentCursor;
|
||||
double cursorPosX, cursorPosY;
|
||||
GLFWbool pendingCursorPos;
|
||||
|
||||
char* appId;
|
||||
|
||||
|
||||
@ -2720,9 +2720,35 @@ void _glfwGetCursorPosWayland(_GLFWwindow* window, double* xpos, double* ypos)
|
||||
}
|
||||
|
||||
void _glfwSetCursorPosWayland(_GLFWwindow* window, double x, double y)
|
||||
{
|
||||
if (!_glfw.wl.pointerConstraints)
|
||||
{
|
||||
_glfwInputError(GLFW_FEATURE_UNAVAILABLE,
|
||||
"Wayland: The platform does not support setting the cursor position");
|
||||
"Wayland: The compositor does not support setting the cursor position");
|
||||
return;
|
||||
}
|
||||
|
||||
if (window->wl.lockedPointer) {
|
||||
zwp_locked_pointer_v1_set_cursor_position_hint(window->wl.lockedPointer,
|
||||
wl_fixed_from_double(x),
|
||||
wl_fixed_from_double(y));
|
||||
} else {
|
||||
if (window->cursorMode != GLFW_CURSOR_DISABLED) {
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Wayland: Delaying the cursor position update until "
|
||||
"the cursor mode is set to GLFW_CURSOR_DISABLED");
|
||||
}
|
||||
|
||||
// The cursor is not currently locked, but it may be locked later. Either
|
||||
// - the application has already set the cursor mode to GLFW_CURSOR_DISABLED,
|
||||
// but the cursor is currently outside of the window, or
|
||||
// - the application has not yet set the cursor mode to GLFW_CURSOR_DISABLED,
|
||||
// but will do so soon.
|
||||
// Defer setting the cursor position to _glfwSetCursorWayland.
|
||||
window->wl.pending.cursorPosX = x;
|
||||
window->wl.pending.cursorPosY = y;
|
||||
window->wl.pendingCursorPos = GLFW_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void _glfwSetCursorModeWayland(_GLFWwindow* window, int mode)
|
||||
@ -3063,6 +3089,13 @@ void _glfwSetCursorWayland(_GLFWwindow* window, _GLFWcursor* cursor)
|
||||
unconfinePointer(window);
|
||||
if (!window->wl.lockedPointer)
|
||||
lockPointer(window);
|
||||
|
||||
if (window->wl.pendingCursorPos == GLFW_TRUE) {
|
||||
zwp_locked_pointer_v1_set_cursor_position_hint(window->wl.lockedPointer,
|
||||
wl_fixed_from_double(window->wl.pending.cursorPosX),
|
||||
wl_fixed_from_double(window->wl.pending.cursorPosY));
|
||||
window->wl.pendingCursorPos = GLFW_FALSE;
|
||||
}
|
||||
}
|
||||
else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user