Revert "Revert "Fix touch issue on mobile simulator/target."" 90/274290/2
authorhuayong.xu <huayong.xu@samsung.com>
Tue, 26 Apr 2022 02:27:07 +0000 (10:27 +0800)
committerhuayong.xu <huayong.xu@samsung.com>
Tue, 26 Apr 2022 03:32:57 +0000 (11:32 +0800)
This reverts commit fb865a7d6b23a1eb883c6c8546a212f1808b4ec7.

Change-Id: I234ebe1cf4f8f52c2ab1bcb6a83d3ac8d01eda1f

dali-extension/web-engine-chromium/tizen-web-engine-chromium.cpp
packaging/dali-extension.spec

index 0540435..9fe7256 100755 (executable)
@@ -622,59 +622,11 @@ public:
 
   bool SendTouchEvent(const TouchEvent& touch)
   {
-    Ewk_Mouse_Button_Type type = (Ewk_Mouse_Button_Type)0;
-    switch (touch.GetMouseButton(0))
-    {
-      case MouseButton::PRIMARY:
-      {
-        type = EWK_Mouse_Button_Left;
-        break;
-      }
-      case MouseButton::TERTIARY:
-      {
-        type = EWK_Mouse_Button_Middle;
-        break;
-      }
-      case MouseButton::SECONDARY:
-      {
-        type = EWK_Mouse_Button_Right;
-        break;
-      }
-      default:
-      {
-        break;
-      }
-    }
-
-    switch (touch.GetState(0))
-    {
-      case PointState::DOWN:
-      {
-        float x = touch.GetScreenPosition(0).x;
-        float y = touch.GetScreenPosition(0).y;
-        ewk_view_feed_mouse_down(mWebView, type, x, y);
-        break;
-      }
-      case PointState::UP:
-      {
-        float x = touch.GetScreenPosition(0).x;
-        float y = touch.GetScreenPosition(0).y;
-        ewk_view_feed_mouse_up(mWebView, type, x, y);
-        break;
-      }
-      case PointState::MOTION:
-      {
-        float x = touch.GetScreenPosition(0).x;
-        float y = touch.GetScreenPosition(0).y;
-        ewk_view_feed_mouse_move(mWebView, x, y);
-        break;
-      }
-      default:
-      {
-        break;
-      }
-    }
-    return false;
+#if defined(OS_TIZEN_TV)
+    return FeedMouseEvent(touch);
+#else
+    return FeedTouchEvent(touch);
+#endif
   }
 
   bool SendKeyEvent(const Dali::KeyEvent& keyEvent)
@@ -1107,6 +1059,112 @@ private:
     client->HitTestCreated(std::move(webHitTest));
   }
 
+  bool FeedTouchEvent(const TouchEvent& touch)
+  {
+    Ewk_Touch_Event_Type type = EWK_TOUCH_START;
+    Evas_Touch_Point_State state = EVAS_TOUCH_POINT_DOWN;
+    switch (touch.GetState(0))
+    {
+      case PointState::DOWN:
+      {
+        type = EWK_TOUCH_START;
+        state = EVAS_TOUCH_POINT_DOWN;
+        break;
+      }
+      case PointState::UP:
+      {
+        type = EWK_TOUCH_END;
+        state = EVAS_TOUCH_POINT_UP;
+        break;
+      }
+      case PointState::MOTION:
+      {
+        type = EWK_TOUCH_MOVE;
+        state = EVAS_TOUCH_POINT_MOVE;
+        break;
+      }
+      case PointState::INTERRUPTED:
+      {
+        type = EWK_TOUCH_CANCEL;
+        state = EVAS_TOUCH_POINT_CANCEL;
+        break;
+      }
+      default:
+      {
+        break;
+      }
+    }
+
+    Eina_List* pointList = 0;
+    Ewk_Touch_Point point;
+    point.id = 0;
+    point.x = touch.GetScreenPosition(0).x;
+    point.y = touch.GetScreenPosition(0).y;
+    point.state = state;
+    pointList = eina_list_append(pointList, &point);
+
+    ewk_view_feed_touch_event(mWebView, type, pointList, 0);
+    eina_list_free(pointList);
+    return false;
+  }
+
+  bool FeedMouseEvent(const TouchEvent& touch)
+  {
+    Ewk_Mouse_Button_Type type = (Ewk_Mouse_Button_Type)0;
+    switch (touch.GetMouseButton(0))
+    {
+      case MouseButton::PRIMARY:
+      {
+        type = EWK_Mouse_Button_Left;
+        break;
+      }
+      case MouseButton::TERTIARY:
+      {
+        type = EWK_Mouse_Button_Middle;
+        break;
+      }
+      case MouseButton::SECONDARY:
+      {
+        type = EWK_Mouse_Button_Right;
+        break;
+      }
+      default:
+      {
+        break;
+      }
+    }
+
+    switch (touch.GetState(0))
+    {
+      case PointState::DOWN:
+      {
+        float x = touch.GetScreenPosition(0).x;
+        float y = touch.GetScreenPosition(0).y;
+        ewk_view_feed_mouse_down(mWebView, type, x, y);
+        break;
+      }
+      case PointState::UP:
+      {
+        float x = touch.GetScreenPosition(0).x;
+        float y = touch.GetScreenPosition(0).y;
+        ewk_view_feed_mouse_up(mWebView, type, x, y);
+        break;
+      }
+      case PointState::MOTION:
+      {
+        float x = touch.GetScreenPosition(0).x;
+        float y = touch.GetScreenPosition(0).y;
+        ewk_view_feed_mouse_move(mWebView, x, y);
+        break;
+      }
+      default:
+      {
+        break;
+      }
+    }
+    return false;
+  }
+
 private:
   Evas_Object*            mWebView;
   WebViewContainerClient& mClient;
index 1ae475f..18f4214 100755 (executable)
@@ -240,6 +240,11 @@ CXXFLAGS+=" -DECORE_WL2 -DEFL_BETA_API_SUPPORT"
 configure_flags="--enable-ecore-wl2"
 %endif
 
+%if "%{?profile}" == "tv"
+CFLAGS+=" -DOS_TIZEN_TV"
+CXXFLAGS+=" -DOS_TIZEN_TV"
+%endif
+
 libtoolize --force
 cd %{_builddir}/%{name}-%{version}/build/tizen
 autoreconf --install