Compare commits

...

5 Commits

Author SHA1 Message Date
Jochen Heizmann
8b74293420
Merge 5115508d2c into feb2a6b728 2025-07-17 17:29:03 +02:00
Doug Binks
feb2a6b728 Wayland: Reset key repeat timer on window destruction
Windows with keyboard focus may have an active key repeat timer.
This should be reset when the window is closed, or key repeat events
could be sent to a NULL window were it not for the quickfix in PR #2732.

Fixes #2741
Probably the source of #2727
2025-07-17 17:24:19 +02:00
Jochen Heizmann
5115508d2c CONTRIBUTURS.md and README.md updated 2025-06-21 11:45:57 +02:00
Jochen Heizmann
dca02a988b typo / missing bracket 2025-06-21 11:45:45 +02:00
Jochen Heizmann
be0d9e8a56 Joystick Detection tweaks for Raspberry PI OS / Linux 2025-06-21 11:28:12 +02:00
4 changed files with 29 additions and 2 deletions

View File

@ -98,6 +98,7 @@ video tutorials.
- Björn Hempel - Björn Hempel
- Matthew Henry - Matthew Henry
- heromyth - heromyth
- Jochen Heizmann
- Lucas Hinderberger - Lucas Hinderberger
- Paul Holden - Paul Holden
- Hajime Hoshi - Hajime Hoshi

View File

@ -132,11 +132,13 @@ information on what to include when reporting a bug.
- [Wayland] Bugfix: `glfwInit` would segfault on compositor with no seat (#2517) - [Wayland] Bugfix: `glfwInit` would segfault on compositor with no seat (#2517)
- [Wayland] Bugfix: A drag entering a non-GLFW surface could cause a segfault - [Wayland] Bugfix: A drag entering a non-GLFW surface could cause a segfault
- [Wayland] Bugfix: Ignore key repeat events when no window has keyboard focus (#2727) - [Wayland] Bugfix: Ignore key repeat events when no window has keyboard focus (#2727)
- [Wayland] Bugfix: Reset key repeat timer when window destroyed (#2741,#2727)
- [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631) - [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631)
- [Null] Added Vulkan 'window' surface creation via `VK_EXT_headless_surface` - [Null] Added Vulkan 'window' surface creation via `VK_EXT_headless_surface`
- [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless` - [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless`
- [EGL] Allowed native access on Wayland with `GLFW_CONTEXT_CREATION_API` set to - [EGL] Allowed native access on Wayland with `GLFW_CONTEXT_CREATION_API` set to
`GLFW_NATIVE_CONTEXT_API` (#2518) `GLFW_NATIVE_CONTEXT_API` (#2518)
- [Linux] Bugfix: Non-joystick input devices were incorrectly detected as joysticks on Raspberry PI OS
## Contact ## Contact

View File

@ -157,10 +157,19 @@ static GLFWbool openJoystickDevice(const char* path)
} }
// Ensure this device supports the events expected of a joystick // Ensure this device supports the events expected of a joystick
if (!isBitSet(EV_ABS, evBits)) // NOTE: SDL2 based Joystick Check
if (isBitSet(BTN_STYLUS, keyBits) ||
isBitSet(BTN_TOOL_PEN, keyBits) ||
isBitSet(BTN_TOOL_FINGER, keyBits) ||
isBitSet(BTN_MOUSE, keyBits) ||
isBitSet(BTN_TOUCH, keyBits) ||
(keyBits[0] & 0xFFFFFFFE) != 0)
{ {
close(linjs.fd); close(linjs.fd);
return GLFW_FALSE; return GLFW_FALSE;
} else if (!isBitSet(EV_ABS, evBits)) {
close(linjs.fd);
return GLFW_FALSE;
} }
char name[256] = ""; char name[256] = "";
@ -168,6 +177,17 @@ static GLFWbool openJoystickDevice(const char* path)
if (ioctl(linjs.fd, EVIOCGNAME(sizeof(name)), name) < 0) if (ioctl(linjs.fd, EVIOCGNAME(sizeof(name)), name) < 0)
strncpy(name, "Unknown", sizeof(name)); strncpy(name, "Unknown", sizeof(name));
// NOTE: Some devices are still indentified as Gamepad devices (Rapsbery PI 500, Hypertouch Square Display).
// They are filtered out for enumeration. I wish there is a more robust way to detect if a device is really
// a gamecontroller/gamepad, but I wasn't able to find a way.
if (strstr(name, "Keyboard System Control") ||
strstr(name, "Keyboard Consumer Control") ||
strstr(name, "11-0048 EP0110M09") ||
strstr(name, "HID 046a:0023")) {
close(linjs.fd);
return GLFW_FALSE;
}
char guid[33] = ""; char guid[33] = "";
// Generate a joystick GUID that matches the SDL 2.0.5+ one // Generate a joystick GUID that matches the SDL 2.0.5+ one
@ -433,4 +453,3 @@ void _glfwUpdateGamepadGUIDLinux(char* guid)
} }
#endif // GLFW_BUILD_LINUX_JOYSTICK #endif // GLFW_BUILD_LINUX_JOYSTICK

View File

@ -2187,7 +2187,12 @@ void _glfwDestroyWindowWayland(_GLFWwindow* window)
_glfw.wl.pointerFocus = NULL; _glfw.wl.pointerFocus = NULL;
if (window == _glfw.wl.keyboardFocus) if (window == _glfw.wl.keyboardFocus)
{
struct itimerspec timer = {0};
timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL);
_glfw.wl.keyboardFocus = NULL; _glfw.wl.keyboardFocus = NULL;
}
if (window->wl.fractionalScale) if (window->wl.fractionalScale)
wp_fractional_scale_v1_destroy(window->wl.fractionalScale); wp_fractional_scale_v1_destroy(window->wl.fractionalScale);