aboutsummaryrefslogtreecommitdiffstats
path: root/vl-android-ui.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-02-02 21:39:10 +0100
committerDavid 'Digit' Turner <digit@android.com>2011-02-02 22:01:44 +0100
commitb6c168bbb6477145e843bb4a2e56e72e6d47822d (patch)
treef74ead6211540d266ce0dd5c468a6f24b8f4aee3 /vl-android-ui.c
parentd6eda1d7b357746ad8d9a4c80dc0235ef56c40e0 (diff)
downloadexternal_qemu-b6c168bbb6477145e843bb4a2e56e72e6d47822d.zip
external_qemu-b6c168bbb6477145e843bb4a2e56e72e6d47822d.tar.gz
external_qemu-b6c168bbb6477145e843bb4a2e56e72e6d47822d.tar.bz2
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
Diffstat (limited to 'vl-android-ui.c')
-rw-r--r--vl-android-ui.c89
1 files changed, 3 insertions, 86 deletions
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;
}