diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2010-03-30 12:20:41 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2010-05-19 11:22:06 +0200 |
commit | 58273e3a32d89e59eb7da742c9b4a059dbfdfd37 (patch) | |
tree | 28555b55f7b72958150fed87aff1a1e850311259 /server/reds.c | |
parent | 4461c749187a704a1d17b29695cf9f8a68cd3f80 (diff) | |
download | spice-58273e3a32d89e59eb7da742c9b4a059dbfdfd37.tar.gz spice-58273e3a32d89e59eb7da742c9b4a059dbfdfd37.tar.xz spice-58273e3a32d89e59eb7da742c9b4a059dbfdfd37.zip |
MouseInterface: redesign
Diffstat (limited to 'server/reds.c')
-rw-r--r-- | server/reds.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/server/reds.c b/server/reds.c index 1eee21d4..8d6e14d1 100644 --- a/server/reds.c +++ b/server/reds.c @@ -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"); |