aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--android/multitouch-port.c25
-rw-r--r--android/multitouch-screen.c31
-rw-r--r--android/multitouch-screen.h3
3 files changed, 48 insertions, 11 deletions
diff --git a/android/multitouch-port.c b/android/multitouch-port.c
index faefdbf..88a76fe 100644
--- a/android/multitouch-port.c
+++ b/android/multitouch-port.c
@@ -48,17 +48,21 @@
*/
/* Pointer move message. */
-#define SDKCTL_MT_MOVE 1
+#define SDKCTL_MT_MOVE 1
/* First pointer down message. */
-#define SDKCTL_MT_FISRT_DOWN 2
+#define SDKCTL_MT_FISRT_DOWN 2
/* Last pointer up message. */
-#define SDKCTL_MT_LAST_UP 3
+#define SDKCTL_MT_LAST_UP 3
/* Pointer down message. */
-#define SDKCTL_MT_POINTER_DOWN 4
+#define SDKCTL_MT_POINTER_DOWN 4
/* Pointer up message. */
-#define SDKCTL_MT_POINTER_UP 5
+#define SDKCTL_MT_POINTER_UP 5
/* Sends framebuffer update. */
-#define SDKCTL_MT_FB_UPDATE 6
+#define SDKCTL_MT_FB_UPDATE 6
+/* Framebuffer update has been received. */
+#define SDKCTL_MT_FB_UPDATE_RECEIVED 7
+/* Framebuffer update has been handled. */
+#define SDKCTL_MT_FB_UPDATE_HANDLED 8
/* Multi-touch port descriptor. */
struct AndroidMTSPort {
@@ -332,6 +336,15 @@ _on_multitouch_message(void* client_opaque,
_on_pup((const AndroidMTPtr*)msg_data);
break;
+ case SDKCTL_MT_FB_UPDATE_RECEIVED:
+ D("Framebuffer update ACK.");
+ break;
+
+ case SDKCTL_MT_FB_UPDATE_HANDLED:
+ D("Framebuffer update handled.");
+ multitouch_fb_updated();
+ break;
+
default:
W("Multi-touch: Unknown message %d", msg_type);
break;
diff --git a/android/multitouch-screen.c b/android/multitouch-screen.c
index 155218a..36f937d 100644
--- a/android/multitouch-screen.c
+++ b/android/multitouch-screen.c
@@ -252,16 +252,15 @@ _on_fb_sent(void* opaque, SDKCtlDirectPacket* packet, AsyncIOState status)
if (status == ASIO_STATE_SUCCEEDED) {
/* Lets see if we have accumulated more changes while transmission has been
* in progress. */
- if (mts_state->fb_header.w && mts_state->fb_header.h) {
+ if (mts_state->fb_header.w && mts_state->fb_header.h &&
+ !mts_state->fb_transfer_in_progress) {
+ mts_state->fb_transfer_in_progress = 1;
/* Send accumulated updates. */
if (mts_port_send_frame(mts_state->mtsp, &mts_state->fb_header,
mts_state->current_fb, _on_fb_sent, mts_state,
mts_state->ydir)) {
mts_state->fb_transfer_in_progress = 0;
}
- } else {
- /* Framebuffer transfer is completed, and no more updates are pending. */
- mts_state->fb_transfer_in_progress = 0;
}
}
@@ -376,7 +375,8 @@ multitouch_opengles_fb_update(void* context,
_mt_fb_common_update(mts_state, 0, 0, w, h);
}
-void multitouch_refresh_screen(void)
+void
+multitouch_refresh_screen(void)
{
MTSState* const mts_state = &_MTSState;
@@ -393,6 +393,27 @@ void multitouch_refresh_screen(void)
}
void
+multitouch_fb_updated(void)
+{
+ MTSState* const mts_state = &_MTSState;
+
+ /* This concludes framebuffer update. */
+ mts_state->fb_transfer_in_progress = 0;
+
+ /* Lets see if we have accumulated more changes while transmission has been
+ * in progress. */
+ if (mts_state->fb_header.w && mts_state->fb_header.h) {
+ mts_state->fb_transfer_in_progress = 1;
+ /* Send accumulated updates. */
+ if (mts_port_send_frame(mts_state->mtsp, &mts_state->fb_header,
+ mts_state->current_fb, _on_fb_sent, mts_state,
+ mts_state->ydir)) {
+ mts_state->fb_transfer_in_progress = 0;
+ }
+ }
+}
+
+void
multitouch_init(AndroidMTSPort* mtsp)
{
if (!_is_mt_initialized) {
diff --git a/android/multitouch-screen.h b/android/multitouch-screen.h
index 901d76e..baca224 100644
--- a/android/multitouch-screen.h
+++ b/android/multitouch-screen.h
@@ -100,4 +100,7 @@ extern void multitouch_opengles_fb_update(void* context,
*/
extern void multitouch_refresh_screen(void);
+/* Framebuffer update has been handled by the device. */
+extern void multitouch_fb_updated(void);
+
#endif /* ANDROID_MULTITOUCH_SCREEN_H_ */