[*] alleged wayland fixes

This commit is contained in:
Reece Wilson 2023-11-05 00:28:29 +00:00
parent 6a2af83029
commit 9ffdc4e8ab
3 changed files with 33 additions and 8 deletions

View File

@ -49,12 +49,12 @@ static const struct
#if defined(_GLFW_COCOA) #if defined(_GLFW_COCOA)
{ GLFW_PLATFORM_COCOA, _glfwConnectCocoa }, { GLFW_PLATFORM_COCOA, _glfwConnectCocoa },
#endif #endif
#if defined(_GLFW_X11)
{ GLFW_PLATFORM_X11, _glfwConnectX11 },
#endif
#if defined(_GLFW_WAYLAND) #if defined(_GLFW_WAYLAND)
{ GLFW_PLATFORM_WAYLAND, _glfwConnectWayland }, { GLFW_PLATFORM_WAYLAND, _glfwConnectWayland },
#endif #endif
#if defined(_GLFW_X11)
{ GLFW_PLATFORM_X11, _glfwConnectX11 },
#endif
}; };
GLFWbool _glfwSelectPlatform(int desiredID, _GLFWplatform* platform) GLFWbool _glfwSelectPlatform(int desiredID, _GLFWplatform* platform)

View File

@ -419,6 +419,7 @@ typedef struct _GLFWwindowWayland
char* preeditText; char* preeditText;
char* commitTextOnReset; char* commitTextOnReset;
} textInputV1Context; } textInputV1Context;
uint32_t pointerAxisTime;
} _GLFWwindowWayland; } _GLFWwindowWayland;
// Wayland-specific global data // Wayland-specific global data

View File

@ -1107,10 +1107,14 @@ static void inputText(_GLFWwindow* window, uint32_t scancode)
{ {
const int mods = _glfw.wl.xkb.modifiers; const int mods = _glfw.wl.xkb.modifiers;
const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT)); const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT));
if (plain)
{
_glfwInputChar(window, codepoint, mods, plain); _glfwInputChar(window, codepoint, mods, plain);
} }
} }
} }
}
static struct pollfd gFds[4]; static struct pollfd gFds[4];
@ -1550,6 +1554,11 @@ static void pointerHandleAxis(void* userData,
if (!window) if (!window)
return; return;
if (window->wl.pointerAxisTime == time)
return;
window->wl.pointerAxisTime = time;
assert(axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL || assert(axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL ||
axis == WL_POINTER_AXIS_VERTICAL_SCROLL); axis == WL_POINTER_AXIS_VERTICAL_SCROLL);
@ -2515,8 +2524,7 @@ void _glfwSetWindowTitleWayland(_GLFWwindow* window, const char* title)
void _glfwSetWindowIconWayland(_GLFWwindow* window, void _glfwSetWindowIconWayland(_GLFWwindow* window,
int count, const GLFWimage* images) int count, const GLFWimage* images)
{ {
_glfwInputError(GLFW_FEATURE_UNAVAILABLE,
"Wayland: The platform does not support setting the window icon");
} }
void _glfwGetWindowPosWayland(_GLFWwindow* window, int* xpos, int* ypos) void _glfwGetWindowPosWayland(_GLFWwindow* window, int* xpos, int* ypos)
@ -2563,6 +2571,8 @@ void _glfwSetWindowSizeWayland(_GLFWwindow* window, int width, int height)
libdecor_state_free(frameState); libdecor_state_free(frameState);
} }
_glfwInputWindowSize(window, width, height);
if (window->wl.visible) if (window->wl.visible)
_glfwInputWindowDamage(window); _glfwInputWindowDamage(window);
} }
@ -2945,8 +2955,22 @@ void _glfwGetCursorPosWayland(_GLFWwindow* window, double* xpos, double* ypos)
void _glfwSetCursorPosWayland(_GLFWwindow* window, double x, double y) void _glfwSetCursorPosWayland(_GLFWwindow* window, double x, double y)
{ {
_glfwInputError(GLFW_FEATURE_UNAVAILABLE, if (window->wl.lockedPointer)
"Wayland: The platform does not support setting the cursor position"); {
zwp_locked_pointer_v1_set_cursor_position_hint(window->wl.lockedPointer,
wl_fixed_from_double(x),
wl_fixed_from_double(y));
}
else
{
lockPointer(window);
zwp_locked_pointer_v1_set_cursor_position_hint(window->wl.lockedPointer,
wl_fixed_from_double(x),
wl_fixed_from_double(y));
unlockPointer(window);
}
window->wl.cursorPosX = x;
window->wl.cursorPosY = y;
} }
void _glfwSetCursorModeWayland(_GLFWwindow* window, int mode) void _glfwSetCursorModeWayland(_GLFWwindow* window, int mode)