1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2025-02-07 06:38:50 -05:00

Merge branch '3.3-stable' into new-cursors-on-3.3-stable

This commit is contained in:
Camilla Löwy 2020-07-16 13:35:26 +02:00
commit 02bd652f2b
5 changed files with 39 additions and 18 deletions

View File

@ -137,7 +137,12 @@ information on what to include when reporting a bug.
non-printable keys (#1598) non-printable keys (#1598)
- [X11] Bugfix: Function keys were mapped to `GLFW_KEY_UNKNOWN` for some layout - [X11] Bugfix: Function keys were mapped to `GLFW_KEY_UNKNOWN` for some layout
combinaitons (#1598) combinaitons (#1598)
- [X11] Bugfix: Keys pressed simultaneously with others were not always
reported (#1112,#1415,#1472,#1616)
- [Wayland] Bugfix: Repeated keys could be reported with `NULL` window (#1704) - [Wayland] Bugfix: Repeated keys could be reported with `NULL` window (#1704)
- [Wayland] Bugfix: Retrieving partial framebuffer size would segfault
- [Wayland] Bugfix: Scrolling offsets were inverted compared to other platforms
(#1463)
## Contact ## Contact
@ -276,6 +281,7 @@ skills.
- ndogxj - ndogxj
- Kristian Nielsen - Kristian Nielsen
- Kamil Nowakowski - Kamil Nowakowski
- onox
- Denis Ovod - Denis Ovod
- Ozzy - Ozzy
- Andri Pálsson - Andri Pálsson
@ -300,8 +306,10 @@ skills.
- Eddie Ringle - Eddie Ringle
- Max Risuhin - Max Risuhin
- Jorge Rodriguez - Jorge Rodriguez
- Luca Rood
- Ed Ropple - Ed Ropple
- Aleksey Rybalkin - Aleksey Rybalkin
- Mikko Rytkönen
- Riku Salminen - Riku Salminen
- Brandon Schaefer - Brandon Schaefer
- Sebastian Schuberth - Sebastian Schuberth

View File

@ -347,9 +347,9 @@ static void pointerHandleAxis(void* data,
axis == WL_POINTER_AXIS_VERTICAL_SCROLL); axis == WL_POINTER_AXIS_VERTICAL_SCROLL);
if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL)
x = wl_fixed_to_double(value) * scrollFactor; x = -wl_fixed_to_double(value) * scrollFactor;
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
y = wl_fixed_to_double(value) * scrollFactor; y = -wl_fixed_to_double(value) * scrollFactor;
_glfwInputScroll(window, x, y); _glfwInputScroll(window, x, y);
} }

View File

@ -1096,8 +1096,10 @@ void _glfwPlatformGetFramebufferSize(_GLFWwindow* window,
int* width, int* height) int* width, int* height)
{ {
_glfwPlatformGetWindowSize(window, width, height); _glfwPlatformGetWindowSize(window, width, height);
*width *= window->wl.scale; if (width)
*height *= window->wl.scale; *width *= window->wl.scale;
if (height)
*height *= window->wl.scale;
} }
void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,

View File

@ -205,8 +205,9 @@ typedef struct _GLFWwindowX11
// The last position the cursor was warped to by GLFW // The last position the cursor was warped to by GLFW
int warpCursorPosX, warpCursorPosY; int warpCursorPosX, warpCursorPosY;
// The time of the last KeyPress event // The time of the last KeyPress event per keycode, for discarding
Time lastKeyTime; // duplicate key events generated for some keys by ibus
Time keyPressTimes[256];
} _GLFWwindowX11; } _GLFWwindowX11;

View File

@ -1275,16 +1275,20 @@ static void processEvent(XEvent *event)
if (window->x11.ic) if (window->x11.ic)
{ {
// HACK: Ignore duplicate key press events generated by ibus // HACK: Do not report the key press events duplicated by XIM
// These have the same timestamp as the original event // Duplicate key releases are filtered out implicitly by
// Corresponding release events are filtered out // the GLFW key repeat logic in _glfwInputKey
// implicitly by the GLFW key repeat logic // A timestamp per key is used to handle simultaneous keys
if (window->x11.lastKeyTime < event->xkey.time) // NOTE: Always allow the first event for each key through
// (the server never sends a timestamp of zero)
// NOTE: Timestamp difference is compared to handle wrap-around
Time diff = event->xkey.time - window->x11.keyPressTimes[keycode];
if (diff == event->xkey.time || (diff > 0 && diff < (1 << 31)))
{ {
if (keycode) if (keycode)
_glfwInputKey(window, key, keycode, GLFW_PRESS, mods); _glfwInputKey(window, key, keycode, GLFW_PRESS, mods);
window->x11.lastKeyTime = event->xkey.time; window->x11.keyPressTimes[keycode] = event->xkey.time;
} }
if (!filtered) if (!filtered)
@ -2587,13 +2591,19 @@ int _glfwPlatformWindowHovered(_GLFWwindow* window)
int rootX, rootY, childX, childY; int rootX, rootY, childX, childY;
unsigned int mask; unsigned int mask;
if (!XQueryPointer(_glfw.x11.display, w, _glfwGrabErrorHandlerX11();
&root, &w, &rootX, &rootY, &childX, &childY, &mask))
{
return GLFW_FALSE;
}
if (w == window->x11.handle) const Bool result = XQueryPointer(_glfw.x11.display, w,
&root, &w, &rootX, &rootY,
&childX, &childY, &mask);
_glfwReleaseErrorHandlerX11();
if (_glfw.x11.errorCode == BadWindow)
w = _glfw.x11.root;
else if (!result)
return GLFW_FALSE;
else if (w == window->x11.handle)
return GLFW_TRUE; return GLFW_TRUE;
} }