[*] 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)
{ GLFW_PLATFORM_COCOA, _glfwConnectCocoa },
#endif
#if defined(_GLFW_X11)
{ GLFW_PLATFORM_X11, _glfwConnectX11 },
#endif
#if defined(_GLFW_WAYLAND)
{ GLFW_PLATFORM_WAYLAND, _glfwConnectWayland },
#endif
#if defined(_GLFW_X11)
{ GLFW_PLATFORM_X11, _glfwConnectX11 },
#endif
};
GLFWbool _glfwSelectPlatform(int desiredID, _GLFWplatform* platform)

View File

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

View File

@ -1107,7 +1107,11 @@ static void inputText(_GLFWwindow* window, uint32_t scancode)
{
const int mods = _glfw.wl.xkb.modifiers;
const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT));
_glfwInputChar(window, codepoint, mods, plain);
if (plain)
{
_glfwInputChar(window, codepoint, mods, plain);
}
}
}
}
@ -1550,6 +1554,11 @@ static void pointerHandleAxis(void* userData,
if (!window)
return;
if (window->wl.pointerAxisTime == time)
return;
window->wl.pointerAxisTime = time;
assert(axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL ||
axis == WL_POINTER_AXIS_VERTICAL_SCROLL);
@ -2515,8 +2524,7 @@ void _glfwSetWindowTitleWayland(_GLFWwindow* window, const char* title)
void _glfwSetWindowIconWayland(_GLFWwindow* window,
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)
@ -2562,6 +2570,8 @@ void _glfwSetWindowSizeWayland(_GLFWwindow* window, int width, int height)
libdecor_frame_commit(window->wl.libdecor.frame, frameState, NULL);
libdecor_state_free(frameState);
}
_glfwInputWindowSize(window, width, height);
if (window->wl.visible)
_glfwInputWindowDamage(window);
@ -2945,8 +2955,22 @@ void _glfwGetCursorPosWayland(_GLFWwindow* window, double* xpos, double* ypos)
void _glfwSetCursorPosWayland(_GLFWwindow* window, double x, double y)
{
_glfwInputError(GLFW_FEATURE_UNAVAILABLE,
"Wayland: The platform does not support setting the cursor position");
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
{
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)