From 5be89ead0193f17238a058e6b02e46c83b35ca26 Mon Sep 17 00:00:00 2001
From: ckanru <ckanru@code.google.com>
Date: Sat, 23 Jul 2011 18:22:11 +0200
Subject: Fixes running vncserver on beagleboard/0xdroid and possibly any
 device without a touch screen. Because fake touch screen always report zero
 when query device information, coordinates transformation is not needed.

Signed-off-by: Christian Beier <dontmind@freeshell.org>
---
 examples/android/jni/fbvncserver.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/examples/android/jni/fbvncserver.c b/examples/android/jni/fbvncserver.c
index dea4d85..694209c 100644
--- a/examples/android/jni/fbvncserver.c
+++ b/examples/android/jni/fbvncserver.c
@@ -309,8 +309,12 @@ void injectTouchEvent(int down, int x, int y)
     struct input_event ev;
     
     // Calculate the final x and y
-    x = xmin + (x * (xmax - xmin)) / (scrinfo.xres);
-    y = ymin + (y * (ymax - ymin)) / (scrinfo.yres);
+    /* Fake touch screen always reports zero */
+    if (xmin != 0 && xmax != 0 && ymin != 0 && ymax != 0)
+    {
+        x = xmin + (x * (xmax - xmin)) / (scrinfo.xres);
+        y = ymin + (y * (ymax - ymin)) / (scrinfo.yres);
+    }
     
     memset(&ev, 0, sizeof(ev));
 
-- 
cgit v1.2.3

