Skip to contentSkip to conversation

paravirtual mouse/tablet

Qemu-devel Gerd Hoffmann 10 participants 39 messages Jan 13, 2011 – Jan 18, 2011

lore
Share & tools
lore
#0 lore raw

Hi,

Just throwing a quick writeup into the ring to kickstart the design discussion ;)

cheers,
Gerd

#ifndef __QEMU_PVTABLET__
#define __QEMU_PVTABLET__ 1

/*
* qemu patavirtual tablet interface
*/

#include <inttypes.h>

/* our virtio-serial channel */
#define QEMU_PVTABLET_NAME "org.qemu.pvtablet.0"

enum qemu_pvtablet_buttons {
QEMU_PVTABLET_BTN_LEFT,
QEMU_PVTABLET_BTN_RIGHT,
QEMU_PVTABLET_BTN_MIDDLE,
/*
* we can handle up to 32 buttons although
* not every has a individual name ;)
*/
};

/* send button down+up events */

typedef struct qemu_pvtablet_button {
    uint32_t button;
    uint32_t mask;
} qemu_pvtablet_button;

/* send pointer move events */

typedef struct qemu_pvtablet_position {
    uint32_t pos_x;  /* range: 0 -> 0xffff */
    uint32_t pos_y;  /* range: 0 -> 0xffff */
} qemu_pvtablet_position;

/*
* specify which display all following events refering to
* (for multihead setups).
*/

typedef struct qemu_pvtablet_display {
    /*
     * FIXME: spice just uses the display channel number, but that
     * doesn't fly in general ...
     */
    uint32_t spice_display_channel;
} qemu_pvtablet_display;

enum qemu_pvtablet_type {
QEMU_PVTABLET_MSG_MOVE, /* qemu_pvtablet_position */
QEMU_PVTABLET_MSG_BTN_DOWN, /* qemu_pvtablet_button */
QEMU_PVTABLET_MSG_BTN_UP, /* qemu_pvtablet_button */
QEMU_PVTABLET_MSG_DISPLAY, /* qemu_pvtablet_display */
};

typedef struct qemu_pvtablet_message {
    uint32_t size;            /* whole message size */
    uint32_t type;            /* qemu_pvtablet_type */
    uint64_t tv_secs;
    uint64_t tv_usecs;
    union {
        qemu_pvtablet_position position;
        qemu_pvtablet_button   button;
        qemu_pvtablet_display  display;
    } m;
} qemu_pvtablet_message;

#endif /* __QEMU_PVTABLET__ */

#1 lore raw

Can you elaborate how the spice display channel comes into play? On a physical machine you just have input devices with no notion of display. It's up to the windowing system to process input events and handle multihead. Why does a pv tablet tie itself to a display channel?

What about mouse wheel (aka z axis motion)?

Stefan

#2 lore raw
Quoted 5 lines · Stefan Hajnoczi

Can you elaborate how the spice display channel comes into play? On a physical machine you just have input devices with no notion of display. It's up to the windowing system to process input events and handle multihead. Why does a pv tablet tie itself to a display channel?

You have two qxl devices, each linked to a spice display channel. The spice client will open one window for each channel. The mouse position is a triple consisting of (x, y, window/channel).

Only the guest knows how it configured the displays, so only the guest is able to create a correct pointer position out of this data. So the X-Server would combine this data with its virtual display configuration (basically adding the display offset to the coordinates), then send this as event to the X clients.

Quoted 1 line

What about mouse wheel (aka z axis motion)?

It's covered. That are really just button presses at mouse protocol level (buttons 4+5). We can add them to the enum to have fancy names for them, that is just the sugar on top though.

cheers,
Gerd

#12 lore raw
In reply to Gerd Hoffmann
Quoted 34 lines · Gerd Hoffmann

Hi,

Just throwing a quick writeup into the ring to kickstart the design discussion ;)

cheers,
Gerd
#ifndef __QEMU_PVTABLET__
#define __QEMU_PVTABLET__ 1

/*
* qemu patavirtual tablet interface
*/

#include<inttypes.h>

/* our virtio-serial channel */
#define QEMU_PVTABLET_NAME "org.qemu.pvtablet.0"

enum qemu_pvtablet_buttons {
QEMU_PVTABLET_BTN_LEFT,
QEMU_PVTABLET_BTN_RIGHT,
QEMU_PVTABLET_BTN_MIDDLE,
/*
* we can handle up to 32 buttons although
* not every has a individual name;)
*/
};

/* send button down+up events */

typedef struct qemu_pvtablet_button {
     uint32_t button;
     uint32_t mask;
} qemu_pvtablet_button;
Quoted 7 lines

/* send pointer move events */

typedef struct qemu_pvtablet_position {
     uint32_t pos_x;  /* range: 0 ->  0xffff */
     uint32_t pos_y;  /* range: 0 ->  0xffff */
} qemu_pvtablet_position;

Let's add feature negotiation and not hardcode the resolution.

typedef enum qemu_pvtablet_features {
    /* None yet */
};

/* host->guest, sent before any other events */ typedef struct qemu_pvtablet_init {
uint32_t res_x; /* x axis resolution */
uint32_t res_y; /* y axis resolution */
uint32_t features; /* qemu_pvtablet_features */
} qemu_pvtablet_init;

/* guest->host, sent after pvtablet_init. host will not send additional messages until this is received */ typedef struct qemu_pvtablet_ack {
uint32_t features; /* qemu_pvtable_features */
};

Quoted 5 lines

enum qemu_pvtablet_type {
QEMU_PVTABLET_MSG_MOVE, /* qemu_pvtablet_position */
QEMU_PVTABLET_MSG_BTN_DOWN, /* qemu_pvtablet_button */
QEMU_PVTABLET_MSG_BTN_UP, /* qemu_pvtablet_button */

QEMU_PVTABLET_MSG_INIT, /* qemu_pvtable_init */
QEMU_PVTABLE_MSG_ACK, /* qemu_pvtable_ack */

Regards,

Anthony Liguori

Quoted 19 lines

};

typedef struct qemu_pvtablet_message {
     uint32_t size;            /* whole message size */
     uint32_t type;            /* qemu_pvtablet_type */
     uint64_t tv_secs;
     uint64_t tv_usecs;
     union {
         qemu_pvtablet_position position;
         qemu_pvtablet_button   button;
         qemu_pvtablet_display  display;
     } m;
} qemu_pvtablet_message;

#endif /* __QEMU_PVTABLET__ */

#3 lore raw
In reply to Gerd Hoffmann
Quoted 10 lines · Gerd Hoffmann
Quoted 5 lines · Stefan Hajnoczi

Can you elaborate how the spice display channel comes into play? On a physical machine you just have input devices with no notion of display. It's up to the windowing system to process input events and handle multihead. Why does a pv tablet tie itself to a display channel?

You have two qxl devices, each linked to a spice display channel. The spice client will open one window for each channel. The mouse position is a triple consisting of (x, y, window/channel).

Would be slightly cleaner to have multiple devices. That avoids breaking the abstraction and sets us up to handling multiple mice properly in the future. That maybe implies that we need an offscreen coordinate for the mouse so that you can hide the mouse when it leaves one window.

Quoted 5 lines

Only the guest knows how it configured the displays, so only the guest is able to create a correct pointer position out of this data. So the X-Server would combine this data with its virtual display configuration (basically adding the display offset to the coordinates), then send this as event to the X clients.

Quoted 1 line

What about mouse wheel (aka z axis motion)?

It's covered. That are really just button presses at mouse protocol level (buttons 4+5). We can add them to the enum to have fancy names for them, that is just the sugar on top though.

If we add features, then we can deal with things like an additional axis to cover pressure sensitive touchpads. Not worth designing now but a feature negotiation gives us the option later.

Regards,

Anthony Liguori

Quoted 4 lines

cheers,
Gerd

#13 lore raw
In reply to Anthony Liguori
Quoted 6 lines · Anthony Liguori

/* host->guest, sent before any other events */ typedef struct qemu_pvtablet_init {
uint32_t res_x; /* x axis resolution */
uint32_t res_y; /* y axis resolution */
uint32_t features; /* qemu_pvtablet_features */

uint32_t available_buttons; /* bitmask */

Quoted 1 line

} qemu_pvtablet_init;

Signature · 1 line
error compiling committee.c: too many arguments to function
#34 lore raw
In reply to Gerd Hoffmann
Quoted 10 lines · Gerd Hoffmann

Hi,

Just throwing a quick writeup into the ring to kickstart the design discussion ;)

typedef struct qemu_pvtablet_message {
uint32_t size; /* whole message size */
uint32_t type; /* qemu_pvtablet_type */
uint64_t tv_secs;
uint64_t tv_usecs;

time relative to what base?

can we actually provide it? if the tablet is remote, there may not be a synchronized time source.

Quoted 7 lines
     union {
         qemu_pvtablet_position position;
         qemu_pvtablet_button   button;
         qemu_pvtablet_display  display;
     } m;
} qemu_pvtablet_message;

So the message size for a qemu_pvtablet_position would only include the position member?

Signature · 1 line
error compiling committee.c: too many arguments to function
#14 lore raw
In reply to Avi Kivity
Quoted 9 lines · Avi Kivity
Quoted 6 lines · Anthony Liguori

/* host->guest, sent before any other events */ typedef struct qemu_pvtablet_init {
uint32_t res_x; /* x axis resolution */
uint32_t res_y; /* y axis resolution */
uint32_t features; /* qemu_pvtablet_features */

uint32_t available_buttons; /* bitmask */

Yes, I had intended to do that but left it out.

Should it be a bitmask or just a button count? Buttons really have no standard meaning so usually a button count is sufficient.

Regards,

Anthony Liguori

Quoted 3 lines
Quoted 2 lines

} qemu_pvtablet_init;

#35 lore raw
In reply to Avi Kivity
Quoted 12 lines · Avi Kivity
Quoted 10 lines · Gerd Hoffmann

Hi,

Just throwing a quick writeup into the ring to kickstart the design discussion ;)

typedef struct qemu_pvtablet_message {
uint32_t size; /* whole message size */
uint32_t type; /* qemu_pvtablet_type */
uint64_t tv_secs;
uint64_t tv_usecs;

Quoted 3 lines

time relative to what base?

can we actually provide it? if the tablet is remote, there may not be a synchronized time source.

I had the same thought, but if it's just treated as time since the init message, the guest is capable of working it out (minus drift).

Quoted 9 lines
Quoted 7 lines
     union {
         qemu_pvtablet_position position;
         qemu_pvtablet_button   button;
         qemu_pvtablet_display  display;
     } m;
} qemu_pvtablet_message;

So the message size for a qemu_pvtablet_position would only include the position member?

I didn't comment on this because I was treating this as a protocol proposal and not actual code but usually the following is clearer:

struct qemu_pvtablet_hdr {
    uint32_t size;
    uint32_t type;
    uint64_t tv_secs;
    uint64_t tv_usecs;
};
struct qemu_pvtablet_position {
    struct qemu_pvtablet_hdr hdr;
    uint32_t x;
    uint32_t y;
};
union qemu_pvtablet_message {
    struct qemu_pvtablet_hdr hdr;
    struct qemu_pvtablet_position position;
    ...
};

Regards,

Anthony Liguori

#4 lore raw
In reply to Anthony Liguori
Quoted 9 lines · Anthony Liguori
Quoted 8 lines · Gerd Hoffmann
Quoted 5 lines · Stefan Hajnoczi

Can you elaborate how the spice display channel comes into play? On a physical machine you just have input devices with no notion of display. It's up to the windowing system to process input events and handle multihead. Why does a pv tablet tie itself to a display channel?

Quoted 6 lines
Quoted 4 lines

You have two qxl devices, each linked to a spice display channel. The spice client will open one window for each channel. The mouse position is a triple consisting of (x, y, window/channel).

Would be slightly cleaner to have multiple devices.

Yea, right, that would work too. If we have some way to assign a display to a pvmouse device this works equally well.

Quoted 2 lines

That maybe implies that we need an offscreen coordinate for the mouse so that you can hide the mouse when it leaves one window.

Hmm? I fail to see why multihead is special here.

cheers,
Gerd

#15 lore raw
In reply to Anthony Liguori
Quoted 9 lines · Anthony Liguori
Quoted 8 lines · Avi Kivity
Quoted 6 lines · Anthony Liguori

/* host->guest, sent before any other events */ typedef struct qemu_pvtablet_init { uint32_t res_x; /* x axis resolution */ uint32_t res_y; /* y axis resolution */ uint32_t features; /* qemu_pvtablet_features */

Quoted 6 lines
Quoted 1 line

uint32_t available_buttons; /* bitmask */

Yes, I had intended to do that but left it out.

Should it be a bitmask or just a button count? Buttons really have no standard meaning so usually a button count is sufficient.

3/4 are the mouse wheel, so if you had a mouse with 5 buttons and no wheel those would be buttons 0/1/2/5/6.

Paolo

#17 lore raw
In reply to Anthony Liguori
Quoted 9 lines · Anthony Liguori
Quoted 8 lines · Avi Kivity
Quoted 6 lines · Anthony Liguori

/* host->guest, sent before any other events */ typedef struct qemu_pvtablet_init {
uint32_t res_x; /* x axis resolution */
uint32_t res_y; /* y axis resolution */
uint32_t features; /* qemu_pvtablet_features */

Quoted 5 lines
Quoted 1 line

uint32_t available_buttons; /* bitmask */

Yes, I had intended to do that but left it out.

Should it be a bitmask or just a button count? Buttons really have no standard meaning so usually a button count is sufficient.

Some random thoughts:

* multitouch capabilities would be good to design in a mouse protocol for 2011, so having say 16 x/y pairs would be better
* on mac os at least scrolling is not done by pressing virtual buttons, but by having a separate scroll interface that knows about velocity and such - maybe worth adding that to the protocol from the beginning too.

Alex

#36 lore raw
In reply to Avi Kivity
Quoted 7 lines · Avi Kivity
Quoted 6 lines · Gerd Hoffmann

Hi,

Just throwing a quick writeup into the ring to kickstart the design discussion ;)

Quoted 7 lines
Quoted 5 lines

typedef struct qemu_pvtablet_message {
uint32_t size; /* whole message size */
uint32_t type; /* qemu_pvtablet_type */
uint64_t tv_secs;
uint64_t tv_usecs;

time relative to what base?

Guess that needs to be refined ;)

Just something relative (if available) should good enougth. The intended purpose is being able to figure how much time passed between two events, so one can figure whenever two mouse clicks should be considered a double-click or not. Ideally the timestamps from the original mouse event in the vnc/spice client would be passed all the way through to the guest. Didn't check the protocols whenever they actually support that, but I think we should have this in the protocol even if they don't ...

cheers,
Gerd

#37 lore raw
Quoted 14 lines · Gerd Hoffmann
Quoted 13 lines · Avi Kivity
Quoted 11 lines · Gerd Hoffmann

Hi,

Just throwing a quick writeup into the ring to kickstart the design discussion ;)

typedef struct qemu_pvtablet_message {
uint32_t size; /* whole message size */
uint32_t type; /* qemu_pvtablet_type */
uint64_t tv_secs;
uint64_t tv_usecs;

Quoted 5 lines
Quoted 1 line

time relative to what base?

Guess that needs to be refined ;)

Just something relative (if available) should good enougth. The intended purpose is being able to figure how much time passed between two events, so one can figure whenever two mouse clicks should be considered a double-click or not. Ideally the timestamps from the original mouse event in the vnc/spice client would be passed all the way through to the guest. Didn't check the protocols whenever they actually support that, but I think we should have this in the protocol even if they don't ...

Ok. We should then specify that the base is arbitrary (and get rid of tv_secs - 2^64 usecs is half a million years, which should be sufficient time to get a fully threaded qemu.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#38 lore raw
In reply to Gerd Hoffmann
Quoted 4 lines · Gerd Hoffmann

Hi,

Just throwing a quick writeup into the ring to kickstart the design discussion ;)

I apologize for not reading everything before sending, I just don't want to forget this detail: Whatever we design needs to address having multiple mice in a single guest. This will be good for multiple user scenario (multiple vnc connections already possible, multiple spice not yet but planned) where each owns it's own mouse. This is supported already in X for a while (multi pointer, different from the multi touch which is harder and not yet there).

Quoted 75 lines

cheers,
Gerd

#ifndef __QEMU_PVTABLET__
#define __QEMU_PVTABLET__ 1

/*
* qemu patavirtual tablet interface
*/

#include <inttypes.h>

/* our virtio-serial channel */
#define QEMU_PVTABLET_NAME "org.qemu.pvtablet.0"

enum qemu_pvtablet_buttons {
QEMU_PVTABLET_BTN_LEFT,
QEMU_PVTABLET_BTN_RIGHT,
QEMU_PVTABLET_BTN_MIDDLE,
/*
* we can handle up to 32 buttons although
* not every has a individual name ;)
*/
};

/* send button down+up events */

typedef struct qemu_pvtablet_button {
    uint32_t button;
    uint32_t mask;
} qemu_pvtablet_button;

/* send pointer move events */

typedef struct qemu_pvtablet_position {
    uint32_t pos_x;  /* range: 0 -> 0xffff */
    uint32_t pos_y;  /* range: 0 -> 0xffff */
} qemu_pvtablet_position;

/*
* specify which display all following events refering to
* (for multihead setups).
*/

typedef struct qemu_pvtablet_display {
    /*
     * FIXME: spice just uses the display channel number, but that
     * doesn't fly in general ...
     */
    uint32_t spice_display_channel;
} qemu_pvtablet_display;

enum qemu_pvtablet_type {
QEMU_PVTABLET_MSG_MOVE, /* qemu_pvtablet_position */
QEMU_PVTABLET_MSG_BTN_DOWN, /* qemu_pvtablet_button */
QEMU_PVTABLET_MSG_BTN_UP, /* qemu_pvtablet_button */
QEMU_PVTABLET_MSG_DISPLAY, /* qemu_pvtablet_display */
};

typedef struct qemu_pvtablet_message {
    uint32_t size;            /* whole message size */
    uint32_t type;            /* qemu_pvtablet_type */
    uint64_t tv_secs;
    uint64_t tv_usecs;
    union {
        qemu_pvtablet_position position;
        qemu_pvtablet_button   button;
        qemu_pvtablet_display  display;
    } m;
} qemu_pvtablet_message;

#endif /* __QEMU_PVTABLET__ */

_______________________________________________
Spice-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/spice-devel

#16 lore raw
In reply to Paolo Bonzini
Quoted 10 lines · Paolo Bonzini
Quoted 9 lines · Anthony Liguori
Quoted 8 lines · Avi Kivity
Quoted 6 lines · Anthony Liguori

/* host->guest, sent before any other events */ typedef struct qemu_pvtablet_init { uint32_t res_x; /* x axis resolution */ uint32_t res_y; /* y axis resolution */ uint32_t features; /* qemu_pvtablet_features */

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

uint32_t available_buttons; /* bitmask */

Yes, I had intended to do that but left it out.

Should it be a bitmask or just a button count? Buttons really have no standard meaning so usually a button count is sufficient.

3/4 are the mouse wheel, so if you had a mouse with 5 buttons and no wheel those would be buttons 0/1/2/5/6.

It can still be reported as a 7 button mouse but I don't really mind either way.

Regards,

Anthony Liguori

Quoted 3 lines

Paolo

#5 lore raw
In reply to Gerd Hoffmann
Quoted 10 lines · Gerd Hoffmann
Quoted 9 lines · Anthony Liguori
Quoted 8 lines · Gerd Hoffmann
Quoted 5 lines · Stefan Hajnoczi

Can you elaborate how the spice display channel comes into play? On a physical machine you just have input devices with no notion of display. It's up to the windowing system to process input events and handle multihead. Why does a pv tablet tie itself to a display channel?

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

You have two qxl devices, each linked to a spice display channel. The spice client will open one window for each channel. The mouse position is a triple consisting of (x, y, window/channel).

Would be slightly cleaner to have multiple devices.

Yea, right, that would work too. If we have some way to assign a display to a pvmouse device this works equally well.

I think that has to be outside of the device. There are so many ways to map mice to multi heads. In fact, one mouse could easily map to a single device. It's almost something that really should be part of the guest configuration.

Quoted 4 lines
Quoted 2 lines

That maybe implies that we need an offscreen coordinate for the mouse so that you can hide the mouse when it leaves one window.

Hmm? I fail to see why multihead is special here.

If you show two mice in the guest, would X render two cursors?

Regards,

Anthony Liguori

Quoted 3 lines

cheers,
Gerd

#18 lore raw
In reply to Alexander Graf
Quoted 10 lines · Alexander Graf
Quoted 5 lines

Yes, I had intended to do that but left it out.

Should it be a bitmask or just a button count? Buttons really have no standard meaning so usually a button count is sufficient.

Some random thoughts:

* multitouch capabilities would be good to design in a mouse protocol for 2011, so having say 16 x/y pairs would be better
* on mac os at least scrolling is not done by pressing virtual buttons, but by having a separate scroll interface that knows about velocity and such - maybe worth adding that to the protocol from the beginning too.

Features negotiation takes care of this.

Regards,

Anthony Liguori

Quoted 4 lines

Alex

#6 lore raw
In reply to Anthony Liguori

Hi,

Quoted 4 lines

I think that has to be outside of the device. There are so many ways to map mice to multi heads. In fact, one mouse could easily map to a single device. It's almost something that really should be part of the guest configuration.

Ok, reasonable. Multihead with spice pretty much requires a guest agent anyway, so I'm sure we'll can figure a way to handle this.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

That maybe implies that we need an offscreen coordinate for the mouse so that you can hide the mouse when it leaves one window.

Hmm? I fail to see why multihead is special here.

If you show two mice in the guest, would X render two cursors?

With two mice you still have just one cursor. Just plug a usb mouse into your laptop, you can move the single pointer with both usb mouse and touchpad then. Didn't try what happens with two tablets, but I expect it wouldn't be different ...

cheers,
Gerd

#7 lore raw
Quoted 11 lines · Gerd Hoffmann
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

That maybe implies that we need an offscreen coordinate for the mouse so that you can hide the mouse when it leaves one window.

Hmm? I fail to see why multihead is special here.

If you show two mice in the guest, would X render two cursors?

With two mice you still have just one cursor. Just plug a usb mouse into your laptop, you can move the single pointer with both usb mouse and touchpad then. Didn't try what happens with two tablets, but I expect it wouldn't be different ...

NB having all mice bound to one cursor is merely the historical default behaviour. IIUC the recent "Multi-Pointer X" feature lets you now have multiple cursors, one per pointing device.

https://secure.wikimedia.org/wikipedia/en/wiki/Multi-Pointer_X

Regards,
Daniel

#19 lore raw
In reply to Alexander Graf

Hi,

Quoted 2 lines

* multitouch capabilities would be good to design in a mouse protocol for 2011, so having say 16 x/y pairs would be better

Point. What do we need here? Finger $n down, finger $n up, finger $n moved to $x,$y? Does it make sense to just add this to the move+buttonup/down structs? Or should it better be separate?

Quoted 4 lines

* on mac os at least scrolling is not done by pressing virtual buttons, but by having a separate scroll interface that knows about velocity and such - maybe worth adding that to the protocol from the beginning too.

Is that actually done by the hardware? I'd expect macos processes the multitouch events, then provides this (finger $n moves this fast into that direction) as high-level interface, so this isn't something we have to care about at virtual hardware level.

cheers,
Gerd

#8 lore raw
In reply to Daniel P. Berrange
Quoted 6 lines · Daniel P. Berrange

NB having all mice bound to one cursor is merely the historical default behaviour. IIUC the recent "Multi-Pointer X" feature lets you now have multiple cursors, one per pointing device.

https://secure.wikimedia.org/wikipedia/en/wiki/Multi-Pointer_X

Yeah, that's exactly what I had in mind and why I suggested an offscreen coordinate.

Regards,

Anthony Liguori

Quoted 3 lines

Regards,
Daniel

#9 lore raw
In reply to Daniel P. Berrange
Quoted 13 lines · Daniel P. Berrange
Quoted 11 lines · Gerd Hoffmann
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

That maybe implies that we need an offscreen coordinate for the mouse so that you can hide the mouse when it leaves one window.

Hmm? I fail to see why multihead is special here.

If you show two mice in the guest, would X render two cursors?

With two mice you still have just one cursor. Just plug a usb mouse into your laptop, you can move the single pointer with both usb mouse and touchpad then. Didn't try what happens with two tablets, but I expect it wouldn't be different ...

Quoted 5 lines

NB having all mice bound to one cursor is merely the historical default behaviour. IIUC the recent "Multi-Pointer X" feature lets you now have multiple cursors, one per pointing device.

https://secure.wikimedia.org/wikipedia/en/wiki/Multi-Pointer_X

Yes, you can enable that, and if we want to have multiple pointers then they shouldn't disappear - that would be the case if multiple users where connected, each with their own cursor. You expect the non active cursor to remain (maybe X hides it after some seconds of inactivity, guest specific).

Quoted 4 lines

Regards,
Daniel

#20 lore raw
In reply to Gerd Hoffmann
Quoted 6 lines · Gerd Hoffmann

Hi,

Quoted 2 lines

* multitouch capabilities would be good to design in a mouse protocol for 2011, so having say 16 x/y pairs would be better

Point. What do we need here? Finger $n down, finger $n up, finger $n moved to $x,$y? Does it make sense to just add this to the move+buttonup/down structs? Or should it better be separate?

I guess a mere tuple of (x,y,down) N times should be enough for the protocol, no? This would even be useful for single-point tablets which usually also have a proximity detector. Thinking about this a bit more - there are proximity sensors in tablets :). So they know how hard you pressed. If we want to be able to forward that to the guest from a real world tablet, we need a pressure field.

So it'd end up being (x,y,pressure) N times (I think 16 is fine for the foreseeable future). The details of what exactly that means should be figured out by the guest driver. If the guest is multitouch capable, it'd forward those events to the respective system. If it's tablet compatible, take the first entry and if it only supports plain mice, just make it (x,y) when pressure > 0.

Quoted 7 lines
Quoted 5 lines

* on mac os at least scrolling is not done by pressing virtual buttons, but by having a separate scroll interface that knows about velocity and such - maybe worth adding that to the protocol from the beginning too.

Is that actually done by the hardware? I'd expect macos processes the multitouch events, then provides this (finger $n moves this fast into that direction) as high-level interface, so this isn't something we have to care about at virtual hardware level.

I'm not familiar with the hardware interface, but in order to support that the background interface must be a lot more complex than a simple button press. I'd frankly assume they do that in software with their own multitouch detection code though, so it should be fine to have the buttons as legacy interface as long as there is multitouch to implement the scrolling.

But then again - how would we forward fine-grained scrolling to the guest if we only know that it's scrolling, but not what the actual presses on the touchpad looked like? Ugh.

Alex

#10 lore raw
In reply to Alon Levy
Quoted 18 lines · Alon Levy
Quoted 17 lines · Daniel P. Berrange
Quoted 11 lines · Gerd Hoffmann
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

That maybe implies that we need an offscreen coordinate for the mouse so that you can hide the mouse when it leaves one window.

Hmm? I fail to see why multihead is special here.

If you show two mice in the guest, would X render two cursors?

With two mice you still have just one cursor. Just plug a usb mouse into your laptop, you can move the single pointer with both usb mouse and touchpad then. Didn't try what happens with two tablets, but I expect it wouldn't be different ...

NB having all mice bound to one cursor is merely the historical default behaviour. IIUC the recent "Multi-Pointer X" feature lets you now have multiple cursors, one per pointing device.

Quoted 7 lines
Quoted 1 line

https://secure.wikimedia.org/wikipedia/en/wiki/Multi-Pointer_X

Yes, you can enable that, and if we want to have multiple pointers then they shouldn't disappear - that would be the case if multiple users where connected, each with their own cursor. You expect the non active cursor to remain (maybe X hides it after some seconds of inactivity, guest specific).

Multi-Pointer X isn't just about allowing different users to have their own pointer. It is explicitly designed to allow one person to control multiple pointers at the same time and to allow applications to receive events from multiple devices concurrently.

Regards,
Daniel

#21 lore raw
In reply to Alexander Graf
Quoted 2 lines

So it'd end up being (x,y,pressure) N times (I think 16 is fine for the foreseeable future).

It's highly speculative, but Microsoft just released Surface 2, and it is able to handle up to 40 different pressure points... It is aimed at people in reunion meeting around a table and manipulation/exchanging documents with each other... If there is no hard/soft limit at 16, maybe it would be a good idea to allow some more from the beginning...

Frederic.

#22 lore raw
In reply to Alexander Graf

Hi,

Quoted 2 lines

So it'd end up being (x,y,pressure) N times (I think 16 is fine for the foreseeable future).

I'd tend to extend MOVE to (x,y,pressure,index) and send N events with the same timestamp. Needs to send only as many events as it finds fingers on the touchpad, i.e. usually just one or two, even if the protocol can easily handle alot more than 16 ;)

For a simple tablet pressure and index would just be 0.

Quoted 2 lines

The details of what exactly that means
should be figured out by the guest driver.

Agree.

Quoted 3 lines

I'm not familiar with the hardware interface, but in order to support that the background interface must be a lot more complex than a simple button press.

Buttons events are for buttons. Real ones, which apple lost ;)

Of course a tap on the trackpad is usually interpreted as mouse click. But that is the job of the guest OS, our virtual hardware doesn't care.

Quoted 3 lines

But then again - how would we forward fine-grained scrolling to the guest if we only know that it's scrolling, but not what the actual presses on the touchpad looked like? Ugh.

There must be an interface to get (more or less) the raw touchpad data, for apps which want implement their own multitouch gestures?

cheers,
Gerd

#23 lore raw
Quoted 8 lines · Gerd Hoffmann

Hi,

Quoted 2 lines

So it'd end up being (x,y,pressure) N times (I think 16 is fine for the foreseeable future).

I'd tend to extend MOVE to (x,y,pressure,index) and send N events with the same timestamp. Needs to send only as many events as it finds fingers on the touchpad, i.e. usually just one or two, even if the protocol can easily handle alot more than 16 ;)

For a simple tablet pressure and index would just be 0.

For a simple tablet pressure would be MAX and index would be 0. But yes, I like the idea :).

Quoted 6 lines
Quoted 3 lines

The details of what exactly that means
should be figured out by the guest driver.

Agree.

Quoted 7 lines
Quoted 3 lines

I'm not familiar with the hardware interface, but in order to support that the background interface must be a lot more complex than a simple button press.

Buttons events are for buttons. Real ones, which apple lost ;)

Of course a tap on the trackpad is usually interpreted as mouse click. But that is the job of the guest OS, our virtual hardware doesn't care.

With an interface the way you mention it below (self-implemented gesture support), this shouldn't be an issue. A tap should just get forwarded to the guest as a tap and then the guest can configure what a tap means - which is what users want.

Quoted 6 lines
Quoted 4 lines

But then again - how would we forward fine-grained scrolling to the guest if we only know that it's scrolling, but not what the actual presses on the touchpad looked like? Ugh.

There must be an interface to get (more or less) the raw touchpad data, for apps which want implement their own multitouch gestures?

I'm not sure there is, but that seems like the only viable solution. This way the guest can define its own multitouch gestures that the host doesn't even have to know about (think of osx guests on linux hosts for example).

Alex

#30 lore raw
In reply to Alexander Graf
Quoted 6 lines · Alexander Graf
Quoted 3 lines · Gerd Hoffmann

Hi,

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

* multitouch capabilities would be good to design in a mouse protocol for 2011, so having say 16 x/y pairs would be better

Point. What do we need here? Finger $n down, finger $n up, finger $n moved to $x,$y? Does it make sense to just add this to the move+buttonup/down structs? Or should it better be separate?

I guess a mere tuple of (x,y,down) N times should be enough for the protocol, no?

Surely, evdev has an interface to support this already. Let's just do what it does instead of inventing something that none of us can validate actually works.

Or better yet, delay implementing it until someone actually knows how to support it.

Regards,

Anthony Liguori

Quoted 21 lines

This would even be useful for single-point tablets which usually also have a proximity detector. Thinking about this a bit more - there are proximity sensors in tablets :). So they know how hard you pressed. If we want to be able to forward that to the guest from a real world tablet, we need a pressure field.

So it'd end up being (x,y,pressure) N times (I think 16 is fine for the foreseeable future). The details of what exactly that means should be figured out by the guest driver. If the guest is multitouch capable, it'd forward those events to the respective system. If it's tablet compatible, take the first entry and if it only supports plain mice, just make it (x,y) when pressure> 0.

Quoted 8 lines
Quoted 6 lines

* on mac os at least scrolling is not done by pressing virtual buttons, but by having a separate scroll interface that knows about velocity and such - maybe worth adding that to the protocol from the beginning too.

Is that actually done by the hardware? I'd expect macos processes the multitouch events, then provides this (finger $n moves this fast into that direction) as high-level interface, so this isn't something we have to care about at virtual hardware level.

I'm not familiar with the hardware interface, but in order to support that the background interface must be a lot more complex than a simple button press. I'd frankly assume they do that in software with their own multitouch detection code though, so it should be fine to have the buttons as legacy interface as long as there is multitouch to implement the scrolling.

But then again - how would we forward fine-grained scrolling to the guest if we only know that it's scrolling, but not what the actual presses on the touchpad looked like? Ugh.

Alex

#24 lore raw
In reply to Alexander Graf
Quoted 5 lines · Alexander Graf
Quoted 2 lines · Gerd Hoffmann

Hi,

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

So it'd end up being (x,y,pressure) N times (I think 16 is fine for the foreseeable future).

I'd tend to extend MOVE to (x,y,pressure,index) and send N events with the same timestamp. Needs to send only as many events as it finds fingers on the touchpad, i.e. usually just one or two, even if the protocol can easily handle alot more than 16 ;)

For a simple tablet pressure and index would just be 0.

For a simple tablet pressure would be MAX and index would be 0. But yes, I like the idea :).

0 for non-presses of course :). Sorry

Alex

#11 lore raw
In reply to Daniel P. Berrange
Quoted 27 lines · Daniel P. Berrange
Quoted 18 lines · Alon Levy
Quoted 17 lines · Daniel P. Berrange
Quoted 11 lines · Gerd Hoffmann
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

That maybe implies that we need an offscreen coordinate for the mouse so that you can hide the mouse when it leaves one window.

Hmm? I fail to see why multihead is special here.

If you show two mice in the guest, would X render two cursors?

With two mice you still have just one cursor. Just plug a usb mouse into your laptop, you can move the single pointer with both usb mouse and touchpad then. Didn't try what happens with two tablets, but I expect it wouldn't be different ...

NB having all mice bound to one cursor is merely the historical default behaviour. IIUC the recent "Multi-Pointer X" feature lets you now have multiple cursors, one per pointing device.

Quoted 7 lines
Quoted 1 line

https://secure.wikimedia.org/wikipedia/en/wiki/Multi-Pointer_X

Yes, you can enable that, and if we want to have multiple pointers then they shouldn't disappear - that would be the case if multiple users where connected, each with their own cursor. You expect the non active cursor to remain (maybe X hides it after some seconds of inactivity, guest specific).

Quoted 5 lines

Multi-Pointer X isn't just about allowing different users to have their own pointer. It is explicitly designed to allow one person to control multiple pointers at the same time and to allow applications to receive events from multiple devices concurrently.

Yes, of course, I didn't suggest otherwise. I don't even think most setup's will be able to distinguish these two scenarios.

Quoted 7 lines

Regards,
Daniel
_______________________________________________
Spice-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/spice-devel

#31 lore raw
In reply to Anthony Liguori

Hi,

Quoted 6 lines
Quoted 2 lines

I guess a mere tuple of (x,y,down) N times should be enough for the protocol, no?

Surely, evdev has an interface to support this already. Let's just do what it does instead of inventing something that none of us can validate actually works.

http://www.mjmwired.net/kernel/Documentation/input/multi-touch-protocol.txt

Looks like the linux input layer does effectively the same: send series of events for multitouch.

A sync event to mark the end of the batch is obviously a pretty good idea I'm going to steal.

Some devices seem to be able to attach IDs to the touchpoints. Then you don't have to send the whole set each time but can limit yourself to the ones which did actually change. We should support that too.

Quoted 2 lines

Or better yet, delay implementing it until someone actually knows how to support it.

I think we can get sane support into the protocol right from start, and that is much better than adding something afterwards. Just look at the linux input layer document -- some of the loops they have to hop though are there just because multitouch is a extension which came later.

cheers,
Gerd

#25 lore raw
In reply to Alexander Graf

Hi,

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

For a simple tablet pressure and index would just be 0.

For a simple tablet pressure would be MAX and index would be 0. But yes, I like the idea :).

0 for non-presses of course :). Sorry

Right ;)

There are three cases:

(1) no pressure supported (i.e. your mouse moving around in the vnc window and qemu reporting this as tablet coordinates).
(2) just pen/finger present/not present supported. pressure jumps

    between 0 and max (and we can make max == 1 in that case).

(3) real pressure measurement.

Will send out v3 shortly.

cheers,
Gerd

#26 lore raw
Quoted 8 lines · Gerd Hoffmann

Hi,

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

For a simple tablet pressure and index would just be 0.

For a simple tablet pressure would be MAX and index would be 0. But yes, I like the idea :).

0 for non-presses of course :). Sorry

Quoted 8 lines

Right ;)

There are three cases:

(1) no pressure supported (i.e. your mouse moving around in the vnc window and qemu reporting this as tablet coordinates).
(2) just pen/finger present/not present supported. pressure jumps between 0 and max (and we can make max == 1 in that case).

Phew - that's one of the bits where touchpads and tablets behave differently IIUC. For touchpads, pressing means movement happens. For tablets, pressing means an actual press, as if you would press your pencil on a sheet of paper. So for tablets, pressure==1 basically means click.

Now the thing is that multitouch gestures might take non-click pressure into account for their calculations. So we need pressure for movements on touchpads, but with tablets, we only need pressure when clicks happen. For everyone else, clicks would just be a button press.

Tricky.

Alex

#32 lore raw
In reply to Anthony Liguori

On 14 January 2011 09:37, Anthony Liguori <[email protected]> wrote:
[multitouch]

Quoted 6 lines

Surely, evdev has an interface to support this already.  Let's just do what it does instead of inventing something that none of us can validate actually works.

Or better yet, delay implementing it until someone actually knows how to support it.

I was just talking to Chase Douglas here at the ubuntu sprint about this, and he pointed me at https://launchpad.net/rinput which is a program which can forward remote events including multitouch over the network (including forwarding from both Linux and MacOS X clients). Maybe that would be worth looking at since it's a working implementation of forwarding multitouch events between systems?

-- PMM

#29 lore raw
In reply to Gerd Hoffmann
Quoted 9 lines · Gerd Hoffmann

Hi,

Quoted 2 lines

So it'd end up being (x,y,pressure) N times (I think 16 is fine for the foreseeable future).

I'd tend to extend MOVE to (x,y,pressure,index) and send N events with the same timestamp. Needs to send only as many events as it finds fingers on the touchpad, i.e. usually just one or two, even if the protocol can easily handle alot more than 16 ;)

Doesn't that lose the coincidence? I expect mostly presses happen sequentially (milliseconds apart maybe, but still), so probably not an issue at all.

Quoted 29 lines

For a simple tablet pressure and index would just be 0.

Quoted 2 lines

The details of what exactly that means
should be figured out by the guest driver.

Agree.

Quoted 3 lines

I'm not familiar with the hardware interface, but in order to support that the background interface must be a lot more complex than a simple button press.

Buttons events are for buttons. Real ones, which apple lost ;)

Of course a tap on the trackpad is usually interpreted as mouse click. But that is the job of the guest OS, our virtual hardware doesn't care.

Quoted 3 lines

But then again - how would we forward fine-grained scrolling to the guest if we only know that it's scrolling, but not what the actual presses on the touchpad looked like? Ugh.

There must be an interface to get (more or less) the raw touchpad data, for apps which want implement their own multitouch gestures?

cheers,
Gerd

#27 lore raw
In reply to Alexander Graf
Quoted 7 lines
Quoted 6 lines

There are three cases:

(1) no pressure supported (i.e. your mouse moving around in the vnc window and qemu reporting this as tablet coordinates).
(2) just pen/finger present/not present supported. pressure jumps between 0 and max (and we can make max == 1 in that case).

Quoted 5 lines

Phew - that's one of the bits where touchpads and tablets behave differently IIUC. For touchpads, pressing means movement happens. For tablets, pressing means an actual press, as if you would press your pencil on a sheet of paper. So for tablets, pressure==1 basically means click.

I wouldn't make a difference from the virtual hardware perspective. If something touches the pad/tablet surface we'll report the position where it happened (and the pressure if supported). Whenever this is interpreted as click or not is up to the guest.

Quoted 5 lines

Now the thing is that multitouch gestures might take non-click pressure into account for their calculations. So we need pressure for movements on touchpads, but with tablets, we only need pressure when clicks happen. For everyone else, clicks would just be a button press.

-EPARSE. What is "non-click pressure" ?

cheers,
Gerd

#33 lore raw
In reply to Peter Maydell

Hi,

Quoted 6 lines

I was just talking to Chase Douglas here at the ubuntu sprint about this, and he pointed me at https://launchpad.net/rinput which is a program which can forward remote events including multitouch over the network (including forwarding from both Linux and MacOS X clients). Maybe that would be worth looking at since it's a working implementation of forwarding multitouch events between systems?

Looks like they are basically using the linux input layer protocol.

cheers,
Gerd

#28 lore raw
In reply to Gerd Hoffmann
Quoted 7 lines · Gerd Hoffmann
Quoted 7 lines
Quoted 6 lines

There are three cases:

(1) no pressure supported (i.e. your mouse moving around in the vnc window and qemu reporting this as tablet coordinates).
(2) just pen/finger present/not present supported. pressure jumps between 0 and max (and we can make max == 1 in that case).

Quoted 7 lines
Quoted 5 lines

Phew - that's one of the bits where touchpads and tablets behave differently IIUC. For touchpads, pressing means movement happens. For tablets, pressing means an actual press, as if you would press your pencil on a sheet of paper. So for tablets, pressure==1 basically means click.

I wouldn't make a difference from the virtual hardware perspective. If something touches the pad/tablet surface we'll report the position where it happened (and the pressure if supported). Whenever this is interpreted as click or not is up to the guest.

There is a major difference. "Touching" means on

Touchpad: movement of cursor
Tablet: pressing down a pen

This difference needs to be reflected somehow. Maybe in the future there might even be devices that combine both. Imagine a tablet device that has a capacitive touchpad, but also accepts pen input, so you can draw on it. This would be separate events. Pressing down a pen would be interpreted completely differently from touching something on the device.

Alex