diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2013-09-27 19:32:54 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2013-11-22 12:49:32 +0100 |
commit | a53a931755111446eb7b94394034bbad1c341dc1 (patch) | |
tree | fd4f9dec6ebef6c1c56ede1e4e741d33a3457e05 /gdk/x11 | |
parent | 189b9c643d0a688f77241d352f5ca363d84ad3bf (diff) | |
download | gtk+-a53a931755111446eb7b94394034bbad1c341dc1.tar.gz |
x11: Unset GdkX11DeviceXI2 scroll valuators on device change
Scroll valuators were being just appended again and again, leading
to 1) a growing memory issue anytime a device changed 2) the first
scroll valuators to stay permanent on the application lifetime, as
the first stored valuators would always match.
https://bugzilla.gnome.org/show_bug.cgi?id=705203
Diffstat (limited to 'gdk/x11')
-rw-r--r-- | gdk/x11/gdkdevice-xi2.c | 8 | ||||
-rw-r--r-- | gdk/x11/gdkdevicemanager-xi2.c | 1 | ||||
-rw-r--r-- | gdk/x11/gdkprivate-x11.h | 2 |
3 files changed, 11 insertions, 0 deletions
diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c index 8245fe4cab..b3289c0e92 100644 --- a/gdk/x11/gdkdevice-xi2.c +++ b/gdk/x11/gdkdevice-xi2.c @@ -876,6 +876,14 @@ _gdk_device_xi2_reset_scroll_valuators (GdkX11DeviceXI2 *device) } } +void +_gdk_device_xi2_unset_scroll_valuators (GdkX11DeviceXI2 *device) +{ + if (device->scroll_valuators->len > 0) + g_array_remove_range (device->scroll_valuators, 0, + device->scroll_valuators->len); +} + gint _gdk_x11_device_xi2_get_id (GdkX11DeviceXI2 *device) { diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c index 87d28100f3..b4e3c19cca 100644 --- a/gdk/x11/gdkdevicemanager-xi2.c +++ b/gdk/x11/gdkdevicemanager-xi2.c @@ -765,6 +765,7 @@ handle_device_changed (GdkX11DeviceManagerXI2 *device_manager, if (device) { _gdk_device_reset_axes (device); + _gdk_device_xi2_unset_scroll_valuators ((GdkX11DeviceXI2 *) device); translate_device_classes (display, device, ev->classes, ev->num_classes); g_signal_emit_by_name (G_OBJECT (device), "changed"); diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h index 543c42d0ea..fcd6da4202 100644 --- a/gdk/x11/gdkprivate-x11.h +++ b/gdk/x11/gdkprivate-x11.h @@ -231,6 +231,8 @@ guint _gdk_x11_device_xi2_translate_state (XIModifierState *mods_state, XIButtonState *buttons_state, XIGroupState *group_state); gint _gdk_x11_device_xi2_get_id (GdkX11DeviceXI2 *device); +void _gdk_device_xi2_unset_scroll_valuators (GdkX11DeviceXI2 *device); + GdkDevice * _gdk_x11_device_manager_xi2_lookup (GdkX11DeviceManagerXI2 *device_manager_xi2, gint device_id); |