[Spice-devel] [spice-gtk] widget: Send all smooth-scroll events to the guest

Christophe Fergeau cfergeau at redhat.com
Mon Sep 17 16:37:08 UTC 2018


On Fri, Sep 14, 2018 at 02:25:39PM +0200, Victor Toso wrote:
> From: Victor Toso <me at victortoso.com>
> 
> Introduced in 2212f05145c5f1d5, smooth-scroll events were taking
> inconsideration that the delta_y value received by GdkEventScroll was
> 1.0 but that can be different for other input devices.
> 
> That can trigger the bug rhbz#1627823 where scroll->delta_y is too
> small, not triggering the while(ABS(d->scroll_delta_y) > 1) loop
> leading to scroll meetings being missed in the guest.

s/meetings/events/ I guess.

> 
> Instead, let's send every event to the guest besides delta_y of 0.0
> value that is sent in my machine after several events at once, related
> to usage of 2-fingers on trackpad.

On my laptop with a USB mouse plugged, I get fractional delta_y when I
use the touchpad, but I get a 1/-1 when I use the wheel of the
mouse. Sending a scroll event every time we get a smooth scroll event is
likely to result in too fast scrolling in the VM I would think?

> ---
>  src/spice-widget-priv.h |  1 -
>  src/spice-widget.c      | 16 +++++++---------
>  2 files changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index 853c9df..83d264f 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -1978,15 +1978,13 @@ static gboolean scroll_event(GtkWidget *widget, GdkEventScroll *scroll)
>          press_and_release(display, SPICE_MOUSE_BUTTON_DOWN, button_state);
>          break;
>      case GDK_SCROLL_SMOOTH:
> -        d->scroll_delta_y += scroll->delta_y;
> -        while (ABS(d->scroll_delta_y) > 1) {

Actually, we should be checking for >= 1 here, not >, otherwise we'll
indeed be delaying the emission of the button up/down event.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180917/def384c5/attachment.sig>


More information about the Spice-devel mailing list