aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2010-05-25 18:16:10 -0700
committerDavid 'Digit' Turner <digit@android.com>2010-05-25 18:45:33 -0700
commit34f2974ce7ec7c71beb47b5daf9089d5c8c40c79 (patch)
tree0a8291f99ace9a1c770ddd701c08dc581609825d /android
parent3bca7734dc4b3a9e1e24964183d9765780dee4ea (diff)
downloadexternal_qemu-34f2974ce7ec7c71beb47b5daf9089d5c8c40c79.zip
external_qemu-34f2974ce7ec7c71beb47b5daf9089d5c8c40c79.tar.gz
external_qemu-34f2974ce7ec7c71beb47b5daf9089d5c8c40c79.tar.bz2
Add small user-event abstraction interface.
Preparation for future UI frontend/backend separation. This is done to ensure that the code under android/skin/ does not depend on any QEMU-specific header. We achieve this by adding a new abstract header "user-events.h" and one QEMU-specific implementations for the functions defined here. This also modifies console.h and vl-android.c to make them closer to upstream (by removing Android-specific changes). + fix Makefile.android to always build SDL from sources in standalone mode. Change-Id: I0d152741e7bb2c9cd283f5c35bd054385c7c1eb3
Diffstat (limited to 'android')
-rw-r--r--android/console.c3
-rw-r--r--android/main.c15
-rw-r--r--android/skin/keyboard.c3
-rw-r--r--android/skin/window.c12
4 files changed, 13 insertions, 20 deletions
diff --git a/android/console.c b/android/console.c
index 8eb1497..c6b8a4e 100644
--- a/android/console.c
+++ b/android/console.c
@@ -47,6 +47,7 @@
#include <fcntl.h>
#include "android/hw-events.h"
#include "android/skin/keyboard.h"
+#include "user-events.h"
#if defined(CONFIG_SLIRP)
#include "libslirp.h"
@@ -1701,7 +1702,7 @@ do_event_send( ControlClient client, char* args )
return -1;
}
- kbd_generic_event( type, code, value );
+ user_event_generic( type, code, value );
p = q;
}
return 0;
diff --git a/android/main.c b/android/main.c
index c4e94c3..6f5fca4 100644
--- a/android/main.c
+++ b/android/main.c
@@ -24,6 +24,7 @@
#include "qemu-common.h"
#include "sysemu.h"
#include "console.h"
+#include "user-events.h"
#include <SDL.h>
#include <SDL_syswm.h>
@@ -275,16 +276,6 @@ uint64_t convertMBToBytes( unsigned megaBytes )
/***********************************************************************/
/***********************************************************************/
-void send_key_event(unsigned code, unsigned down)
-{
- if(code == 0) {
- return;
- }
- if (VERBOSE_CHECK(keys))
- printf(">> KEY [0x%03x,%s]\n", (code & 0x1ff), down ? "down" : " up " );
- kbd_put_keycode((code & 0x1ff) | (down ? 0x200 : 0));
-}
-
/* called by the emulated framebuffer device each time the content of the
* framebuffer has changed. the rectangle is the bounding box of all changes
*/
@@ -373,7 +364,7 @@ static void sdl_refresh(DisplayState *ds)
kcode = // qemulator_rotate_keycode(kKeyCodeDpadUp);
android_keycode_rotate(kKeyCodeDpadUp,
skin_layout_get_dpad_rotation(qemulator_get_layout(qemulator_get())));
- send_key_event( kcode, down );
+ user_event_key( kcode, down );
}
else if (ev.button.button == 5)
{
@@ -383,7 +374,7 @@ static void sdl_refresh(DisplayState *ds)
kcode = // qemulator_rotate_keycode(kKeyCodeDpadDown);
android_keycode_rotate(kKeyCodeDpadDown,
skin_layout_get_dpad_rotation(qemulator_get_layout(qemulator_get())));
- send_key_event( kcode, down );
+ user_event_key( kcode, down );
}
else if (ev.button.button == SDL_BUTTON_LEFT) {
skin_window_process_event( window, &ev );
diff --git a/android/skin/keyboard.c b/android/skin/keyboard.c
index e3537f1..00fa1df 100644
--- a/android/skin/keyboard.c
+++ b/android/skin/keyboard.c
@@ -14,6 +14,7 @@
#include "android/utils/bufprint.h"
#include "android/utils/system.h"
#include "android/android.h"
+#include "user-events.h"
#define DEBUG 1
@@ -125,7 +126,7 @@ skin_keyboard_flush( SkinKeyboard* kb )
}
printf( "\n" );
}
- kbd_put_keycodes(kb->keycodes, kb->keycode_count);
+ user_event_keycodes(kb->keycodes, kb->keycode_count);
kb->keycode_count = 0;
}
}
diff --git a/android/skin/window.c b/android/skin/window.c
index 24baaa6..4765bba 100644
--- a/android/skin/window.c
+++ b/android/skin/window.c
@@ -17,7 +17,7 @@
#include "android/utils/system.h"
#include "android/hw-sensors.h"
#include <SDL_syswm.h>
-#include "qemu-common.h"
+#include "user-events.h"
#include <math.h>
#include "framebuffer.h"
@@ -855,7 +855,7 @@ add_finger_event(unsigned x, unsigned y, unsigned state)
/* NOTE: the 0 is used in hw/goldfish_events.c to differentiate
* between a touch-screen and a trackball event
*/
- kbd_mouse_event(x, y, 0, state);
+ user_event_mouse(x, y, 0, state);
}
static void
@@ -984,7 +984,7 @@ skin_window_move_mouse( SkinWindow* window,
static void
skin_window_trackball_press( SkinWindow* window, int down )
{
- send_key_event( BTN_MOUSE, down );
+ user_event_key( BTN_MOUSE, down );
}
static void
@@ -1221,7 +1221,7 @@ skin_window_reset_internal ( SkinWindow* window, SkinLayout* slayout )
skin_window_redraw( window, NULL );
if (slayout->event_type != 0) {
- kbd_generic_event( slayout->event_type, slayout->event_code, slayout->event_value );
+ user_event_generic( slayout->event_type, slayout->event_code, slayout->event_value );
/* XXX: hack, replace by better code here */
if (slayout->event_value != 0)
android_sensors_set_coarse_orientation( ANDROID_COARSE_PORTRAIT );
@@ -1457,7 +1457,7 @@ skin_window_process_event( SkinWindow* window, SDL_Event* ev )
skin_window_redraw( window, &button->rect );
window->button.pressed = button;
if(button->keycode) {
- send_key_event(button->keycode, 1);
+ user_event_key(button->keycode, 1);
}
}
}
@@ -1477,7 +1477,7 @@ skin_window_process_event( SkinWindow* window, SDL_Event* ev )
button->down = 0;
skin_window_redraw( window, &button->rect );
if(button->keycode) {
- send_key_event(button->keycode, 0);
+ user_event_key(button->keycode, 0);
}
window->button.pressed = NULL;
window->button.hover = NULL;