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__ */

Reply via email to