touch: release the touch event automatically
authorGiWoong Kim <giwoong.kim@samsung.com>
Mon, 23 Sep 2013 11:32:04 +0000 (20:32 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Mon, 23 Sep 2013 11:32:04 +0000 (20:32 +0900)
release the touch event automatically when
display is switched off

Change-Id: Icf1c8660f96206492a7a553e950e11da9ceee972
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSdlSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShmSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java
tizen/src/skin/maruskin_operation.c

index 3cc30e3d245b81e29e43a3cb5673bc6c7092a725..0d90b3003203ddf05295c40686f229f442d9e3fe 100644 (file)
@@ -34,7 +34,6 @@ import java.util.logging.Logger;
 
 import org.eclipse.swt.SWT;
 import org.tizen.emulator.skin.config.EmulatorConfig;
-import org.tizen.emulator.skin.config.EmulatorConfig.ArgsConstants;
 import org.tizen.emulator.skin.exception.ScreenShotException;
 import org.tizen.emulator.skin.image.ImageRegistry.IconName;
 import org.tizen.emulator.skin.info.SkinInformation;
@@ -121,16 +120,12 @@ public class EmulatorSdlSkin extends EmulatorSkin {
 
        @Override
        public void displayOn() {
-               logger.info("display on");
-               if (super.config.getArgBoolean(ArgsConstants.INPUT_MOUSE, false) == true)
-                       super.isDisplayOn = true;
+               super.displayOn();
        }
 
        @Override
        public void displayOff() {
-               logger.info("display off");
-               if (super.config.getArgBoolean(ArgsConstants.INPUT_MOUSE, false) == true)
-                       super.isDisplayOn = false;
+               super.displayOff();
        }
 
        @Override
index fb77287210ca74f68d02c658ec9fcccd7e1ea390..8ad232d3b0da738950a0ed255cfbac564062c501 100644 (file)
@@ -392,35 +392,23 @@ public class EmulatorShmSkin extends EmulatorSkin {
 
        @Override
        public void displayOn() {
-               logger.info("display on");
-               if (super.config.getArgBoolean(ArgsConstants.INPUT_MOUSE, false) == true)
-                       super.isDisplayOn = true;
-
-//             if (pollThread.isAlive()) {
-//                     pollThread.setWaitIntervalTime(30);
-//
-//                     synchronized(pollThread) {
-//                             pollThread.notify();
-//                     }
-//             }
+               super.displayOn();
        }
 
        @Override
        public void displayOff() {
-               logger.info("display off");
-               if (super.config.getArgBoolean(ArgsConstants.INPUT_MOUSE, false) == true)
-                       super.isDisplayOn = false;
-
-//             if (pollThread.isAlive()) {
-//                     pollThread.setWaitIntervalTime(0);
-//
-//                     shell.getDisplay().asyncExec(new Runnable() {
-//                             @Override
-//                             public void run() {
-//                                     lcdCanvas.redraw();
-//                             }
-//                     });
-//             }
+               super.displayOff();
+
+               /*if (pollThread.isAlive()) {
+                       pollThread.setWaitIntervalTime(0);
+
+                       shell.getDisplay().asyncExec(new Runnable() {
+                               @Override
+                               public void run() {
+                                       lcdCanvas.redraw();
+                               }
+                       });
+               }*/
        }
 
        /* mouse event */
index d4290b4a72c9e4da762d01d9bf311839941c8de8..4a7e86c364bb69e9ff35ca981db2551999dbe2ba 100755 (executable)
@@ -166,8 +166,8 @@ public class EmulatorSkin {
 
        protected EmulatorSkinState currentState;
 
-       private boolean isDisplayDragging;
-       private boolean isShutdownRequested;
+       protected boolean isDisplayDragging;
+       protected boolean isShutdownRequested;
        private boolean isAboutToReopen;
        public boolean isOnTop;
        public boolean isKeyWindow;
@@ -1260,11 +1260,29 @@ public class EmulatorSkin {
        }
 
        protected void displayOn() {
-               /* abstract */
+               logger.info("display on");
+
+               if (config.getArgBoolean(ArgsConstants.INPUT_MOUSE, false) == true) {
+                       isDisplayOn = true;
+               }
        }
 
        protected void displayOff() {
-               /* abstract */
+               logger.info("display off");
+
+               if (config.getArgBoolean(ArgsConstants.INPUT_MOUSE, false) == true) {
+                       isDisplayOn = false;
+               }
+
+               if (isDisplayDragging == true) {
+                       logger.info("auto release : mouseEvent");
+                       MouseEventData mouseEventData = new MouseEventData(
+                                       0, MouseEventType.RELEASE.value(),
+                                       0, 0, 0, 0, 0);
+
+                       communicator.sendToQEMU(
+                                       SendCommand.SEND_MOUSE_EVENT, mouseEventData, false);
+               }
        }
 
        /* for popup menu */
index 6c6dae698f630c2db2c88107e647b0f6b8341bfa..d8cd39eae19937296741f3a60155e7e62530d660 100644 (file)
@@ -98,12 +98,21 @@ void do_mouse_event(int button_type, int event_type,
     int origin_x, int origin_y, int x, int y, int z)
 {
     if (brightness_off) {
-        TRACE("reject mouse touch in lcd off = button:%d, type:%d, x:%d, y:%d, z:%d\n",
-            button_type, event_type, x, y, z);
-        return;
+        if (button_type == 0) {
+            INFO("auto mouse release\n");
+            kbd_mouse_event(0, 0, 0, 0);
+
+            return;
+        } else {
+            TRACE("reject mouse touch in display off : "
+                    "button=%d, type=%d, x=%d, y=%d, z=%d\n",
+                    button_type, event_type, x, y, z);
+            return;
+        }
     }
 
-    TRACE("mouse_event button:%d, type:%d, host:(%d, %d), x:%d, y:%d, z:%d\n",
+    TRACE("mouse event : button=%d, type=%d, "
+        "host=(%d, %d), x=%d, y=%d, z=%d\n",
         button_type, event_type, origin_x, origin_y, x, y, z);
 
 #ifndef CONFIG_USE_SHM
@@ -127,8 +136,7 @@ void do_mouse_event(int button_type, int event_type,
             pressing_origin_y = origin_y;
 
             kbd_mouse_event(x, y, z, 1);
-            TRACE("mouse_event event_type:%d, origin:(%d, %d), x:%d, y:%d, z:%d\n\n",
-            event_type, origin_x, origin_y, x, y, z);
+
             break;
         case MOUSE_UP:
             guest_x = x;
@@ -137,8 +145,7 @@ void do_mouse_event(int button_type, int event_type,
             pressing_origin_x = pressing_origin_y = -1;
 
             kbd_mouse_event(x, y, z, 0);
-            TRACE("mouse_event event_type:%d, origin:(%d, %d), x:%d, y:%d, z:%d\n\n",
-            event_type, origin_x, origin_y, x, y, z);
+
             break;
         case MOUSE_WHEELUP:
         case MOUSE_WHEELDOWN:
@@ -153,16 +160,14 @@ void do_mouse_event(int button_type, int event_type,
             }
 
             kbd_mouse_event(x, y, -z, event_type);
-            TRACE("mouse_event event_type:%d, origin:(%d, %d), x:%d, y:%d, z:%d\n\n",
-            event_type, origin_x, origin_y, x, y, z);
+
             break;
         case MOUSE_MOVE:
             guest_x = x;
             guest_y = y;
 
             kbd_mouse_event(x, y, z, event_type);
-            TRACE("mouse_event event_type:%d, origin:(%d, %d), x:%d, y:%d, z:%d\n\n",
-            event_type, origin_x, origin_y, x, y, z);
+
             break;
         default:
             ERR("undefined mouse event type passed:%d\n", event_type);