[Spice-devel] [PATCH spice-gtk 3/3] win32: implement disabling mouse accel
Marc-André Lureau
marcandre.lureau at gmail.com
Fri Oct 19 10:28:21 PDT 2012
https://bugzilla.redhat.com/show_bug.cgi?id=867885
---
gtk/spice-widget-priv.h | 2 ++
gtk/spice-widget.c | 11 +++++++++++
2 files changed, 13 insertions(+)
diff --git a/gtk/spice-widget-priv.h b/gtk/spice-widget-priv.h
index 4ee0e59..597ce10 100644
--- a/gtk/spice-widget-priv.h
+++ b/gtk/spice-widget-priv.h
@@ -114,6 +114,8 @@ struct _SpiceDisplayPrivate {
gint mark;
#ifdef WIN32
HHOOK keyboard_hook;
+ int win_mouse[3];
+ int win_mouse_speed;
#endif
guint keypress_delay;
gint zoom_level;
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 5fab420..cdcff03 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -709,6 +709,17 @@ static void set_mouse_accel(SpiceDisplay *display, gboolean enabled)
SPICE_DEBUG("disabled X11 mouse motion %d %d %d",
d->x11_accel_numerator, d->x11_accel_denominator, d->x11_threshold);
}
+#elif defined GDK_WINDOWING_WIN32
+ if (enabled) {
+ g_return_if_fail(SystemParametersInfo(SPI_SETMOUSE, 0, &d->win_mouse, 0));
+ g_return_if_fail(SystemParametersInfo(SPI_SETMOUSESPEED, 0, (PVOID)d->win_mouse_speed, 0));
+ } else {
+ int accel[3] = { 0, 0, 0 }; // disabled
+ g_return_if_fail(SystemParametersInfo(SPI_GETMOUSE, 0, &d->win_mouse, 0));
+ g_return_if_fail(SystemParametersInfo(SPI_GETMOUSESPEED, 0, &d->win_mouse_speed, 0));
+ g_return_if_fail(SystemParametersInfo(SPI_SETMOUSE, 0, &accel, SPIF_SENDCHANGE));
+ g_return_if_fail(SystemParametersInfo(SPI_SETMOUSESPEED, 0, (PVOID)10, SPIF_SENDCHANGE)); // default
+ }
#else
g_warning("Mouse acceleration code missing for your platform");
#endif
--
1.7.11.7
More information about the Spice-devel
mailing list