Last active
December 12, 2021 09:19
-
-
Save talchas/7a3df6c78e10d1cfe47c8b02298a3057 to your computer and use it in GitHub Desktop.
Fix gtk3 to workaround XI2 + reparenting WMs scroll issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur gtk+-3.24.29.bak/gdk/x11/gdkdevicemanager-xi2.c gtk+-3.24.29/gdk/x11/gdkdevicemanager-xi2.c | |
--- gtk+-3.24.29.bak/gdk/x11/gdkdevicemanager-xi2.c 2021-12-12 01:07:35.648699240 -0800 | |
+++ gtk+-3.24.29/gdk/x11/gdkdevicemanager-xi2.c 2021-12-12 01:07:45.812571463 -0800 | |
@@ -37,6 +37,7 @@ | |
#include <X11/Xatom.h> | |
#include <string.h> | |
+#include <bsd/sys/time.h> | |
static const char *wacom_type_atoms[] = { | |
"STYLUS", | |
@@ -66,6 +67,7 @@ | |
gint opcode; | |
gint major; | |
gint minor; | |
+ struct timespec last_leave; | |
}; | |
struct _GdkX11DeviceManagerXI2Class | |
@@ -156,6 +158,7 @@ | |
g_direct_equal, | |
NULL, | |
(GDestroyNotify) g_object_unref); | |
+ memset(&device_manager->last_leave, 0, sizeof(struct timespec)); | |
} | |
static void | |
@@ -1985,7 +1988,17 @@ | |
gdk_event_set_source_device (event, source_device); | |
gdk_event_set_seat (event, gdk_device_get_seat (device)); | |
- if (ev->evtype == XI_Enter && | |
+ int allow_reset = 0; | |
+ if (ev->evtype == XI_Leave) { | |
+ clock_gettime(CLOCK_MONOTONIC, &device_manager->last_leave); | |
+ } else { | |
+ struct timespec temp, out; | |
+ clock_gettime(CLOCK_MONOTONIC, &temp); | |
+ timespecsub(&temp, &device_manager->last_leave, &out); | |
+ allow_reset = out.tv_sec > 0 || out.tv_nsec > 10000000; // 10ms | |
+ } | |
+ | |
+ if (allow_reset && | |
xev->detail != XINotifyInferior && xev->mode != XINotifyPassiveUngrab && | |
gdk_window_get_window_type (window) == GDK_WINDOW_TOPLEVEL) | |
{ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment