[Spice-devel] [3/6] [PATCH spice] Add horizontal mouse wheel support

Christophe de Dinechin christophe.de.dinechin at gmail.com
Tue Oct 31 17:20:55 UTC 2017


Matthew J. Francis writes:
> On 30/10/2017 17:28, Frediano Ziglio wrote:
>> This patch changes ABI so would need a version bump and a Qemu patch.
>> Did you send a patch to Qemu too?
>
> As mentioned in the patch overview, I haven't touched qemu yet - if I
> can get agreement on what the API/ABI should look like from the SPICE
> end, I will work on that next.
>
>> Maybe some capability and usage of some bits in wheel_motion could do
>> instead of we could add an additional function in SpiceTabletInstance/SpiceMouseInterface
>> to have a compatible ABI.
>
> I considered three options for this in total, each of which has some
> advantages and disadvantages
>
> 1) Change the existing API (as in the posted patch)
>     + Gives the cleanest code on the SPICE server side
>     - ABI incompatible, code that links against it must update in step
>
> 2) Add "motion_2()" (SpiceMouseInterface) and "wheel_2()"
>     (SpiceTabletInterface)
>     + Compatible ABI
>     - Having two functions in the interfaces for the same thing is nasty,
>       and complicates the server code
>
> 3) Redefine the semantics of the existing interfaces such that e.g.
>     +1/-1 wheel means vertical, +2/-2 means horizontal
>     + Nominally the least invasive option in terms of API/ABI
>     - Also feels a bit nasty in terms of API, and the behaviour of
>       existing code would have to be considered carefully
>
>
> If option 1) is not preferred, is 3) worth considering?
> If not, I will rework with option 2).
>
>
>> OT: what about support for touch pads?
>
> What requirements might there be in terms of touch pads?

I would expect touch pads (and some mice) to send events that have
delta_x and delta_y in the same GdkEventScroll message. Some testing on
macOS with a MacBook trackpad gives me something like:

spice-widget.c:2035: [103 28.932795] scroll_event: going down: x=327.000000 y=332.000000 delta_x=0.000000 delta_y=0.900009
spice-widget.c:2035: [104 28.973638] scroll_event: going down: x=327.000000 y=332.000000 delta_x=0.000000 delta_y=1.000000
spice-widget.c:2035: [105 28.983640] scroll_event: going left: x=327.000000 y=332.000000 delta_x=0.800003 delta_y=0.000000
spice-widget.c:2035: [107 29.015997] scroll_event: going left: x=327.000000 y=332.000000 delta_x=1.000000 delta_y=0.000000
spice-widget.c:2035: [109 29.056910] scroll_event: going left: x=327.000000 y=332.000000 delta_x=1.200012 delta_y=0.000000
spice-widget.c:2035: [111 29.091373] scroll_event: going up: x=327.000000 y=332.000000 delta_x=0.000000 delta_y=1.000000
spice-widget.c:2035: [112 29.123201] scroll_event: going up: x=327.000000 y=332.000000 delta_x=0.000000 delta_y=1.300003
spice-widget.c:2035: [113 29.155868] scroll_event: going up: x=327.000000 y=332.000000 delta_x=0.000000 delta_y=1.300003
spice-widget.c:2035: [114 29.180780] scroll_event: going right: x=327.000000 y=332.000000 delta_x=0.800003 delta_y=0.000000
spice-widget.c:2035: [116 29.214177] scroll_event: going right: x=327.000000 y=332.000000 delta_x=0.900009 delta_y=0.000000
spice-widget.c:2035: [118 29.256171] scroll_event: going right: x=327.000000 y=332.000000 delta_x=0.900009 delta_y=0.000000
spice-widget.c:2035: [120 29.338235] scroll_event: going down: x=327.000000 y=332.000000 delta_x=0.000000 delta_y=0.600006

So it looks like I never get the GDK_SCROLL_SMOOTH event, and that
otherwise the delta_x and delta_y values are garbage (I was hoping for
+/-1 there for up/down events).

But if you feel like bumping the protocol, maybe you could also add
support for GDK_SCROLL_SMOOTH, and convert everything to delta_x /
delta_y messages.

>
>
> Regards
> Matthew Francis
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


--
Cheers,
Christophe de Dinechin (c3d)


More information about the Spice-devel mailing list