mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-26 22:48:19 +00:00
MouseInterface: redesign
This commit is contained in:
parent
4461c74918
commit
58273e3a32
@ -57,7 +57,7 @@
|
||||
SpiceCoreInterface *core = NULL;
|
||||
static MigrationInterface *mig = NULL;
|
||||
static SpiceKbdInstance *keyboard = NULL;
|
||||
static MouseInterface *mouse = NULL;
|
||||
static SpiceMouseInstance *mouse = NULL;
|
||||
static TabletInterface *tablet = NULL;
|
||||
static VDIPortInterface *vdagent = NULL;
|
||||
|
||||
@ -2163,8 +2163,11 @@ static void inputs_handle_input(void *opaque, SpiceDataHeader *header)
|
||||
}
|
||||
}
|
||||
if (mouse && reds->mouse_mode == SPICE_MOUSE_MODE_SERVER) {
|
||||
mouse->moution(mouse, mouse_motion->dx, mouse_motion->dy, 0,
|
||||
RED_MOUSE_STATE_TO_LOCAL(mouse_motion->buttons_state));
|
||||
SpiceMouseInterface *sif;
|
||||
sif = SPICE_CONTAINEROF(mouse->base.sif, SpiceMouseInterface, base);
|
||||
sif->motion(mouse,
|
||||
mouse_motion->dx, mouse_motion->dy, 0,
|
||||
RED_MOUSE_STATE_TO_LOCAL(mouse_motion->buttons_state));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -2219,7 +2222,10 @@ static void inputs_handle_input(void *opaque, SpiceDataHeader *header)
|
||||
tablet->wheel(tablet, dz, RED_MOUSE_STATE_TO_LOCAL(mouse_press->buttons_state));
|
||||
}
|
||||
} else if (mouse) {
|
||||
mouse->moution(mouse, 0, 0, dz, RED_MOUSE_STATE_TO_LOCAL(mouse_press->buttons_state));
|
||||
SpiceMouseInterface *sif;
|
||||
sif = SPICE_CONTAINEROF(mouse->base.sif, SpiceMouseInterface, base);
|
||||
sif->motion(mouse, 0, 0, dz,
|
||||
RED_MOUSE_STATE_TO_LOCAL(mouse_press->buttons_state));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -2234,7 +2240,10 @@ static void inputs_handle_input(void *opaque, SpiceDataHeader *header)
|
||||
tablet->buttons(tablet, RED_MOUSE_STATE_TO_LOCAL(mouse_release->buttons_state));
|
||||
}
|
||||
} else if (mouse) {
|
||||
mouse->buttons(mouse, RED_MOUSE_STATE_TO_LOCAL(mouse_release->buttons_state));
|
||||
SpiceMouseInterface *sif;
|
||||
sif = SPICE_CONTAINEROF(mouse->base.sif, SpiceMouseInterface, base);
|
||||
sif->buttons(mouse,
|
||||
RED_MOUSE_STATE_TO_LOCAL(mouse_release->buttons_state));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -4041,18 +4050,19 @@ __visible__ int spice_server_add_interface(SpiceServer *s,
|
||||
keyboard = SPICE_CONTAINEROF(sin, SpiceKbdInstance, base);
|
||||
keyboard->st = spice_new0(SpiceKbdState, 1);
|
||||
|
||||
} else if (strcmp(interface->type, VD_INTERFACE_MOUSE) == 0) {
|
||||
red_printf("VD_INTERFACE_MOUSE");
|
||||
} else if (strcmp(interface->type, SPICE_INTERFACE_MOUSE) == 0) {
|
||||
red_printf("SPICE_INTERFACE_MOUSE");
|
||||
if (mouse) {
|
||||
red_printf("already have mouse");
|
||||
return -1;
|
||||
}
|
||||
if (interface->major_version != VD_INTERFACE_MOUSE_MAJOR ||
|
||||
interface->minor_version < VD_INTERFACE_MOUSE_MINOR) {
|
||||
if (interface->major_version != SPICE_INTERFACE_MOUSE_MAJOR ||
|
||||
interface->minor_version < SPICE_INTERFACE_MOUSE_MINOR) {
|
||||
red_printf("unsuported mouse interface");
|
||||
return -1;
|
||||
}
|
||||
mouse = (MouseInterface *)interface;
|
||||
mouse = SPICE_CONTAINEROF(sin, SpiceMouseInstance, base);
|
||||
mouse->st = spice_new0(SpiceMouseState, 1);
|
||||
|
||||
} else if (strcmp(interface->type, VD_INTERFACE_MIGRATION) == 0) {
|
||||
red_printf("VD_INTERFACE_MIGRATION");
|
||||
|
||||
@ -62,6 +62,10 @@ struct SpiceKbdState {
|
||||
int dummy;
|
||||
};
|
||||
|
||||
struct SpiceMouseState {
|
||||
int dummy;
|
||||
};
|
||||
|
||||
void reds_desable_mm_timer();
|
||||
void reds_enable_mm_timer();
|
||||
void reds_update_mm_timer(uint32_t mm_time);
|
||||
|
||||
@ -219,17 +219,24 @@ struct SpiceKbdInstance {
|
||||
SpiceKbdState *st;
|
||||
};
|
||||
|
||||
#define VD_INTERFACE_MOUSE "mouse"
|
||||
#define VD_INTERFACE_MOUSE_MAJOR 1
|
||||
#define VD_INTERFACE_MOUSE_MINOR 1
|
||||
typedef struct MouseInterface MouseInterface;
|
||||
#define SPICE_INTERFACE_MOUSE "mouse"
|
||||
#define SPICE_INTERFACE_MOUSE_MAJOR 1
|
||||
#define SPICE_INTERFACE_MOUSE_MINOR 1
|
||||
typedef struct SpiceMouseInterface SpiceMouseInterface;
|
||||
typedef struct SpiceMouseInstance SpiceMouseInstance;
|
||||
typedef struct SpiceMouseState SpiceMouseState;
|
||||
|
||||
struct MouseInterface {
|
||||
struct SpiceMouseInterface {
|
||||
SpiceBaseInterface base;
|
||||
|
||||
void (*moution)(MouseInterface* mouse, int dx, int dy, int dz,
|
||||
uint32_t buttons_state);
|
||||
void (*buttons)(MouseInterface* mouse, uint32_t buttons_state);
|
||||
void (*motion)(SpiceMouseInstance *sin, int dx, int dy, int dz,
|
||||
uint32_t buttons_state);
|
||||
void (*buttons)(SpiceMouseInstance *sin, uint32_t buttons_state);
|
||||
};
|
||||
|
||||
struct SpiceMouseInstance {
|
||||
SpiceBaseInstance base;
|
||||
SpiceMouseState *st;
|
||||
};
|
||||
|
||||
#define VD_INTERFACE_TABLET "tablet"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user