Build efl_webview_app and mini_browser with tizen 2.3
authorArnaud Renevier <a.renevier@samsung.com>
Wed, 1 Oct 2014 17:55:39 +0000 (10:55 -0700)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
This patch modifies app.c and mini_browser.c so that they can build with
tizen2.3. The modifications are related to the api of haptic being
different

Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=5477

Change-Id: I38e50b4caf8ed0b472f879b5a9f4c2b2b5bab91f
Signed-off-by: Arnaud Renevier <a.renevier@samsung.com>
tizen_src/ewk/efl_webview_app/app.c
tizen_src/ewk/efl_webview_app/mini_browser.c

index 2b13adf..35189b5 100644 (file)
 #include <Elementary.h>
 
 #if defined(OS_TIZEN_MOBILE)
+#ifndef TIZEN_LEGACY_V_2_2_1
+#include <device/haptic.h>
+#else
 #include <haptic/haptic.h>
 #endif
+#endif
 
 #include <unistd.h>
 #include <stdlib.h>
@@ -1208,8 +1212,13 @@ Eina_Bool __vibration_timeout_cb(void *data)
 {
   g_haptic_timer_id = NULL;
   if (g_haptic_handle) {
+#ifndef TIZEN_LEGACY_V_2_2_1
+    device_haptic_stop(g_haptic_handle, g_haptic_effect);
+    device_haptic_close(g_haptic_handle);
+#else
     haptic_stop_effect(g_haptic_handle, g_haptic_effect);
     haptic_close(g_haptic_handle);
+#endif
     g_haptic_handle = NULL;
   }
 
@@ -1229,17 +1238,31 @@ void __vibration_on_cb(uint64_t vibration_time, void *data)
     }
 
     if (g_haptic_handle) {
+#ifndef TIZEN_LEGACY_V_2_2_1
+      device_haptic_stop(g_haptic_handle, g_haptic_effect);
+      device_haptic_close(g_haptic_handle);
+#else
       haptic_stop_effect(g_haptic_handle, g_haptic_effect);
       haptic_close(g_haptic_handle);
+#endif
       g_haptic_handle = NULL;
     }
 
+#ifndef TIZEN_LEGACY_V_2_2_1
+    if (device_haptic_open(0, &g_haptic_handle) != DEVICE_ERROR_NONE) {
+      printf("__vibration_on_cb:device_haptic_open failed");
+#else
     if (haptic_open(HAPTIC_DEVICE_0, &g_haptic_handle) != HAPTIC_ERROR_NONE) {
       printf("__vibration_on_cb:haptic_open failed");
+#endif
       return;
     }
 
+#ifndef TIZEN_LEGACY_V_2_2_1
+    device_haptic_vibrate(g_haptic_handle, duration, 100, &g_haptic_effect);
+#else
     haptic_vibrate_monotone(g_haptic_handle, duration, &g_haptic_effect);
+#endif
     double in = (double)((double)(duration) / (double)(1000));
     printf("__vibration_on_cb:duration=%f", in);
 
@@ -1257,8 +1280,13 @@ void __vibration_off_cb(void *data)
     }
 
     if (g_haptic_handle) {
+#ifndef TIZEN_LEGACY_V_2_2_1
+      device_haptic_stop(g_haptic_handle, g_haptic_effect);
+      device_haptic_close(g_haptic_handle);
+#else
       haptic_stop_effect(g_haptic_handle, g_haptic_effect);
       haptic_close(g_haptic_handle);
+#endif
       g_haptic_handle = NULL;
     }
   #endif
index 3f0d0ca..71f84eb 100755 (executable)
 #include <string.h>
 
 #if defined(OS_TIZEN_MOBILE)
+#ifndef TIZEN_LEGACY_V_2_2_1
+#include <device/haptic.h>
+#else
 #include <haptic/haptic.h>
 #endif
+#endif
 
 #include "public/ewk_context.h"
 #include "public/ewk_context_menu.h"
@@ -1356,8 +1360,13 @@ Eina_Bool __vibration_timeout_cb(void *data)
 {
   s_haptic_timer_id = NULL;
   if (s_haptic_handle) {
+#ifndef TIZEN_LEGACY_V_2_2_1
+    device_haptic_stop(s_haptic_handle, s_haptic_effect);
+    device_haptic_close(s_haptic_handle);
+#else
     haptic_stop_effect(s_haptic_handle, s_haptic_effect);
     haptic_close(s_haptic_handle);
+#endif
     s_haptic_handle = NULL;
   }
 
@@ -1377,17 +1386,31 @@ void __vibration_on_cb(uint64_t vibration_time, void *data)
   }
 
   if (s_haptic_handle) {
+#ifndef TIZEN_LEGACY_V_2_2_1
+    device_haptic_stop(s_haptic_handle, s_haptic_effect);
+    device_haptic_close(s_haptic_handle);
+#else
     haptic_stop_effect(s_haptic_handle, s_haptic_effect);
     haptic_close(s_haptic_handle);
+#endif
     s_haptic_handle = NULL;
   }
 
+#ifndef TIZEN_LEGACY_V_2_2_1
+  if (device_haptic_open(0, &s_haptic_handle) != DEVICE_ERROR_NONE) {
+    printf("[%s][%d][%s] ERROR: __vibration_on_cb:device_haptic_open failed\n", __FUNCTION__, __LINE__, "vibration");
+#else
   if (haptic_open(HAPTIC_DEVICE_0, &s_haptic_handle) != HAPTIC_ERROR_NONE) {
     printf("[%s][%d][%s] ERROR: __vibration_on_cb:haptic_open failed\n", __FUNCTION__, __LINE__, "vibration");
+#endif
     return;
   }
 
+#ifndef TIZEN_LEGACY_V_2_2_1
+  device_haptic_vibrate(s_haptic_handle, duration, 100, &s_haptic_effect);
+#else
   haptic_vibrate_monotone(s_haptic_handle, duration, &s_haptic_effect);
+#endif
   double in = (double)((double)(duration) / (double)(1000));
   printf("[%s][%d][%s] __vibration_on_cb:duration=%f\n", __FUNCTION__, __LINE__, "vibration", in);
 
@@ -1405,8 +1428,13 @@ void __vibration_off_cb(void *data)
   }
 
   if (s_haptic_handle) {
+#ifndef TIZEN_LEGACY_V_2_2_1
+    device_haptic_stop(s_haptic_handle, s_haptic_effect);
+    device_haptic_close(s_haptic_handle);
+#else
     haptic_stop_effect(s_haptic_handle, s_haptic_effect);
     haptic_close(s_haptic_handle);
+#endif
     s_haptic_handle = NULL;
   }
 }