From 6df71197252e119baccbe4dd060935222af4f8ba Mon Sep 17 00:00:00 2001 From: Vladimir Chtchetkine Date: Tue, 15 May 2012 07:59:51 -0700 Subject: Refresh stale SdkController screen. When MT handler gets deactivated, and then activated again, it shows a stale emulator display, since it didn't have a chance to catch up with emulator display updates. This CL ensures that entire emulator display is pushed to the device when MT handler gets activated. Change-Id: I58c1680f50e2af3e6afa0518f6bcaa3ed087638d --- android/multitouch-port.c | 2 ++ android/multitouch-screen.c | 18 +++++++++++++++++- android/multitouch-screen.h | 5 +++++ 3 files changed, 24 insertions(+), 1 deletion(-) (limited to 'android') diff --git a/android/multitouch-port.c b/android/multitouch-port.c index d872b30..faefdbf 100644 --- a/android/multitouch-port.c +++ b/android/multitouch-port.c @@ -260,6 +260,8 @@ _on_multitouch_port_connection(void* opaque, if (android_hw->hw_gpu_enabled) { android_setPostCallback(multitouch_opengles_fb_update, NULL); } + /* Refresh (possibly stale) device screen. */ + multitouch_refresh_screen(); break; case SDKCTL_PORT_DISABLED: diff --git a/android/multitouch-screen.c b/android/multitouch-screen.c index 59d4d75..155218a 100644 --- a/android/multitouch-screen.c +++ b/android/multitouch-screen.c @@ -87,7 +87,7 @@ typedef struct MTSState { } MTSState; /* Default multi-touch screen descriptor */ -static MTSState _MTSState; +static MTSState _MTSState = { 0 }; /* Pushes event to the event device. */ static void @@ -376,6 +376,22 @@ multitouch_opengles_fb_update(void* context, _mt_fb_common_update(mts_state, 0, 0, w, h); } +void multitouch_refresh_screen(void) +{ + MTSState* const mts_state = &_MTSState; + + /* Make sure MT port is initialized. */ + if (!_is_mt_initialized) { + return; + } + + /* Lets see if any updates have been received so far. */ + if (NULL != mts_state->current_fb) { + _mt_fb_common_update(mts_state, 0, 0, mts_state->fb_header.disp_width, + mts_state->fb_header.disp_height); + } +} + void multitouch_init(AndroidMTSPort* mtsp) { diff --git a/android/multitouch-screen.h b/android/multitouch-screen.h index 95ae86a..901d76e 100644 --- a/android/multitouch-screen.h +++ b/android/multitouch-screen.h @@ -95,4 +95,9 @@ extern void multitouch_opengles_fb_update(void* context, int type, unsigned char* pixels); +/* Pushes the entire framebuffer to the device. This will force the device to + * refresh the entire screen. + */ +extern void multitouch_refresh_screen(void); + #endif /* ANDROID_MULTITOUCH_SCREEN_H_ */ -- cgit v1.1