83 lines
3.2 KiB
Diff
83 lines
3.2 KiB
Diff
From aed76bbc51853f8604be8c081204eeba716a4a33 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
|
Date: Thu, 18 Oct 2012 20:45:03 +0200
|
|
Subject: [PATCH 20/21] Fix disabling mouse acceleration on X11
|
|
|
|
It turns out the acceleration code didn't work, because we didn't set
|
|
it to the default values. Then we need to restore it back. Eventually,
|
|
it would be nicer to inhibit gnome-settings-daemon to apply devices
|
|
changes, and restore settings when un-inhibiting.
|
|
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=867885
|
|
---
|
|
gtk/spice-widget-priv.h | 5 +++++
|
|
gtk/spice-widget.c | 23 +++++++++--------------
|
|
2 files changed, 14 insertions(+), 14 deletions(-)
|
|
|
|
diff --git a/gtk/spice-widget-priv.h b/gtk/spice-widget-priv.h
|
|
index 4ed5fbc..4ee0e59 100644
|
|
--- a/gtk/spice-widget-priv.h
|
|
+++ b/gtk/spice-widget-priv.h
|
|
@@ -117,6 +117,11 @@ struct _SpiceDisplayPrivate {
|
|
#endif
|
|
guint keypress_delay;
|
|
gint zoom_level;
|
|
+#ifdef GDK_WINDOWING_X11
|
|
+ int x11_accel_numerator;
|
|
+ int x11_accel_denominator;
|
|
+ int x11_threshold;
|
|
+#endif
|
|
};
|
|
|
|
int spicex_image_create (SpiceDisplay *display);
|
|
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
|
|
index 1763b17..7985b3e 100644
|
|
--- a/gtk/spice-widget.c
|
|
+++ b/gtk/spice-widget.c
|
|
@@ -740,16 +740,15 @@ static GdkGrabStatus do_pointer_grab(SpiceDisplay *display)
|
|
|
|
#ifdef GDK_WINDOWING_X11
|
|
if (status == GDK_GRAB_SUCCESS) {
|
|
- int accel_numerator;
|
|
- int accel_denominator;
|
|
- int threshold;
|
|
GdkWindow *w = GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(display)));
|
|
Display *x_display = GDK_WINDOW_XDISPLAY(w);
|
|
|
|
- XGetPointerControl(x_display, &accel_numerator, &accel_denominator,
|
|
- &threshold);
|
|
- XChangePointerControl(x_display, False, False, accel_numerator,
|
|
- accel_denominator, threshold);
|
|
+ XGetPointerControl(x_display,
|
|
+ &d->x11_accel_numerator, &d->x11_accel_denominator, &d->x11_threshold);
|
|
+ /* set mouse acceleration to default */
|
|
+ XChangePointerControl(x_display, True, True, -1, -1, -1);
|
|
+ SPICE_DEBUG("updated mouse motion %d %d %d",
|
|
+ d->x11_accel_numerator, d->x11_accel_denominator, d->x11_threshold);
|
|
}
|
|
#endif
|
|
|
|
@@ -841,16 +840,12 @@ static void try_mouse_ungrab(SpiceDisplay *display)
|
|
#endif
|
|
#ifdef GDK_WINDOWING_X11
|
|
{
|
|
- int accel_numerator;
|
|
- int accel_denominator;
|
|
- int threshold;
|
|
GdkWindow *w = GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(display)));
|
|
Display *x_display = GDK_WINDOW_XDISPLAY(w);
|
|
|
|
- XGetPointerControl(x_display, &accel_numerator, &accel_denominator,
|
|
- &threshold);
|
|
- XChangePointerControl(x_display, True, True, accel_numerator,
|
|
- accel_denominator, threshold);
|
|
+ /* restore mouse acceleration */
|
|
+ XChangePointerControl(x_display, True, True,
|
|
+ d->x11_accel_numerator, d->x11_accel_denominator, d->x11_threshold);
|
|
}
|
|
#endif
|
|
|
|
--
|
|
1.7.12.1
|
|
|