From b6c168bbb6477145e843bb4a2e56e72e6d47822d Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Wed, 2 Feb 2011 21:39:10 +0100 Subject: Remove QEMU-ism from UI code. This gets rid of qemu_set_fd_handler() users in the UI program. We can remove its implementation from vl-android-ui.c + Really remove qemu-timer-ui.c :-) Change-Id: I490df8ad5d5eea36b332bf54e2b156f6b5872bf4 --- vl-android-ui.c | 89 ++------------------------------------------------------- 1 file changed, 3 insertions(+), 86 deletions(-) (limited to 'vl-android-ui.c') diff --git a/vl-android-ui.c b/vl-android-ui.c index 91a7764..b0a4e7f 100644 --- a/vl-android-ui.c +++ b/vl-android-ui.c @@ -54,90 +54,6 @@ static Looper* mainLooper; /***********************************************************/ -/* I/O handling */ - -typedef struct IOHandlerRecord { - LoopIo io[1]; - IOHandler* fd_read; - IOHandler* fd_write; - int running; - int deleted; - void* opaque; - struct IOHandlerRecord *next; -} IOHandlerRecord; - -static IOHandlerRecord *first_io_handler; - -static void ioh_callback(void* opaque, int fd, unsigned events) -{ - IOHandlerRecord* ioh = opaque; - ioh->running = 1; - if ((events & LOOP_IO_READ) != 0) { - ioh->fd_read(ioh->opaque); - } - if (!ioh->deleted && (events & LOOP_IO_WRITE) != 0) { - ioh->fd_write(ioh->opaque); - } - ioh->running = 0; - if (ioh->deleted) { - loopIo_done(ioh->io); - free(ioh); - } -} - -int qemu_set_fd_handler(int fd, - IOHandler *fd_read, - IOHandler *fd_write, - void *opaque) -{ - IOHandlerRecord **pioh, *ioh; - - if (!fd_read && !fd_write) { - pioh = &first_io_handler; - for(;;) { - ioh = *pioh; - if (ioh == NULL) - return 0; - if (ioh->io->fd == fd) { - break; - } - pioh = &ioh->next; - } - if (ioh->running) { - ioh->deleted = 1; - } else { - *pioh = ioh->next; - loopIo_done(ioh->io); - free(ioh); - } - } else { - for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { - if (ioh->io->fd == fd) - goto found; - } - ANEW0(ioh); - ioh->next = first_io_handler; - first_io_handler = ioh; - loopIo_init(ioh->io, mainLooper, fd, ioh_callback, ioh); - found: - ioh->fd_read = fd_read; - ioh->fd_write = fd_write; - ioh->opaque = opaque; - - if (fd_read != NULL) - loopIo_wantRead(ioh->io); - else - loopIo_dontWantRead(ioh->io); - - if (fd_write != NULL) - loopIo_wantWrite(ioh->io); - else - loopIo_dontWantWrite(ioh->io); - } - return 0; -} - -/***********************************************************/ /* main execution loop */ static LoopTimer gui_timer[1]; @@ -247,12 +163,13 @@ int qemu_main(int argc, char **argv, char **envp) // Connect to the core's framebuffer service if (implFb_create(attachUiImpl_get_console_socket(), "-raw", - qemulator_get_first_framebuffer(qemulator_get()))) { + qemulator_get_first_framebuffer(qemulator_get()), + mainLooper)) { return -1; } // Attach the recepient of UI commands. - if (uiCmdImpl_create(attachUiImpl_get_console_socket())) { + if (uiCmdImpl_create(attachUiImpl_get_console_socket(), mainLooper)) { return -1; } -- cgit v1.1