mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-24 14:12:02 +00:00
Merge branch 'fix-x11-scroll-crossing-storm' of https://github.com/liguangsheng/kitty
This commit is contained in:
commit
e2252170cc
2 changed files with 13 additions and 4 deletions
2
glfw/x11_platform.h
vendored
2
glfw/x11_platform.h
vendored
|
|
@ -246,7 +246,7 @@ typedef struct AtomArray {
|
|||
typedef struct XIScrollValuator {
|
||||
double increment, value, min, max;
|
||||
int number, resolution, mode;
|
||||
bool is_vertical, initialized;
|
||||
bool is_vertical, initialized, has_value;
|
||||
} XIScrollValuator;
|
||||
|
||||
typedef struct XIScrollDevice {
|
||||
|
|
|
|||
15
glfw/x11_window.c
vendored
15
glfw/x11_window.c
vendored
|
|
@ -1308,11 +1308,20 @@ handle_xi_motion_event(_GLFWwindow *window, XIDeviceEvent *de) {
|
|||
scroll_valuator_found = true;
|
||||
if (!v->initialized) {
|
||||
v->initialized = true;
|
||||
v->value = value;
|
||||
continue;
|
||||
if (!v->has_value) {
|
||||
v->has_value = true;
|
||||
v->value = value;
|
||||
continue;
|
||||
}
|
||||
const double max_plausible_delta = 10. * (v->increment != 0. ? fabs(v->increment) : 1.);
|
||||
if (fabs(value - v->value) > max_plausible_delta) {
|
||||
v->value = value;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
double delta = value - v->value;
|
||||
v->value = value;
|
||||
v->has_value = true;
|
||||
delta *= -1;
|
||||
double *off = v->is_vertical ? &yOffset : &xOffset;
|
||||
*off = delta;
|
||||
|
|
@ -2018,7 +2027,7 @@ processEvent(XEvent *event) {
|
|||
}
|
||||
|
||||
case LeaveNotify: {
|
||||
resetScrollValuators();
|
||||
if (event->xcrossing.mode == NotifyNormal && event->xcrossing.detail != NotifyInferior) resetScrollValuators();
|
||||
_glfwInputCursorEnter(window, false);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue