diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2010-03-04 10:57:02 +0100 |
---|---|---|
committer | Uri Lublin <uril@redhat.com> | 2010-03-08 04:15:34 +0200 |
commit | 3e52f3b836ba6b0effbe39eef278068d5eea13db (patch) | |
tree | 54fd91d6076e06439725c07e2f6d766f6e2da12d | |
parent | 5baae1c7a08c5eb1f0076df05f41843b4532ee49 (diff) | |
download | spice-3e52f3b836ba6b0effbe39eef278068d5eea13db.tar.gz spice-3e52f3b836ba6b0effbe39eef278068d5eea13db.tar.xz spice-3e52f3b836ba6b0effbe39eef278068d5eea13db.zip |
new libspice api: zap function pointer indirection.
Make register_*_notifier calls optional, long term they should go away
entriely. Add direct library calls as replacement.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r-- | server/reds.c | 37 | ||||
-rw-r--r-- | server/spice.h | 4 |
2 files changed, 36 insertions, 5 deletions
diff --git a/server/reds.c b/server/reds.c index 35b1a164..f6f43840 100644 --- a/server/reds.c +++ b/server/reds.c @@ -5125,8 +5125,10 @@ static void interface_change_notifier(void *opaque, VDInterface *interface, return; } keyboard = (KeyboardInterface *)interface; - if (!keyboard->register_leds_notifier(keyboard, reds_on_keyborad_leads_change, NULL)) { - red_error("register leds notifier failed"); + if (keyboard->register_leds_notifier) { + if (!keyboard->register_leds_notifier(keyboard, reds_on_keyborad_leads_change, NULL)) { + red_error("register leds notifier failed"); + } } } else if (strcmp(interface->type, VD_INTERFACE_MOUSE) == 0) { red_printf("VD_INTERFACE_MOUSE"); @@ -5410,10 +5412,14 @@ static void do_spice_init(CoreInterface *core_interface) red_error("key modifiers timer create failed"); } - while ((interface = core->next(core, interface))) { - interface_change_notifier(&reds, interface, VD_INTERFACE_ADDING); + if (core->next) { + while ((interface = core->next(core, interface))) { + interface_change_notifier(&reds, interface, VD_INTERFACE_ADDING); + } + } + if (core->register_change_notifiers) { + core->register_change_notifiers(core, &reds, interface_change_notifier); } - core->register_change_notifiers(core, &reds, interface_change_notifier); #ifdef RED_STATISTICS int shm_name_len = strlen(REDS_STAT_SHM_NAME) + 20; @@ -5539,3 +5545,24 @@ int spice_server_set_ticket(SpiceServer *s, const char *passwd, int lifetime, } return 0; } + +int spice_server_add_interface(SpiceServer *s, VDInterface *interface) +{ + ASSERT(reds == s); + interface_change_notifier(NULL, interface, VD_INTERFACE_ADDING); + return 0; +} + +int spice_server_remove_interface(SpiceServer *s, VDInterface *interface) +{ + ASSERT(reds == s); + interface_change_notifier(NULL, interface, VD_INTERFACE_REMOVING); + return 0; +} + +int spice_server_kbd_leds(SpiceServer *s, KeyboardInterface *kbd, int leds) +{ + ASSERT(reds == s); + reds_on_keyborad_leads_change(NULL, leds); + return 0; +} diff --git a/server/spice.h b/server/spice.h index b8a476e1..c72b3059 100644 --- a/server/spice.h +++ b/server/spice.h @@ -37,4 +37,8 @@ int spice_server_set_noauth(SpiceServer *s); int spice_server_set_ticket(SpiceServer *s, const char *passwd, int lifetime, int fail_if_connected, int disconnect_if_connected); +int spice_server_add_interface(SpiceServer *s, VDInterface *interface); +int spice_server_remove_interface(SpiceServer *s, VDInterface *interface); +int spice_server_kbd_leds(SpiceServer *s, KeyboardInterface *kbd, int leds); + #endif |