add manual rotation feature to avoid rotation flickering issue
authorCho Woong Suk <ws77.cho@samsung.com>
Wed, 6 Jul 2016 07:21:02 +0000 (16:21 +0900)
committerCho Woong Suk <ws77.cho@samsung.com>
Wed, 6 Jul 2016 08:19:56 +0000 (17:19 +0900)
packaging/crosswalk-tizen.spec
runtime/browser/native_window.cc
runtime/browser/native_window.h
runtime/browser/web_application.cc
runtime/browser/web_application.h
runtime/browser/web_view.h
runtime/browser/web_view_impl.cc
runtime/runtime.gyp

index 03a58a231079d3998861651c8230a363825fe8b6..2889a4bdd74451b4df2713baf597fe89abd812b2 100755 (executable)
@@ -51,18 +51,21 @@ BuildRequires: pkgconfig(jsoncpp)
 %define tizen_feature_rotary_event_support     0
 %define tizen_feature_web_ime_support          0
 %define tizen_feature_watch_face_support       0
+%define tizen_feature_manual_rotate_support    1
 %endif
 
 %if "%{?profile}" == "wearable"
 %define tizen_feature_rotary_event_support     1
 %define tizen_feature_web_ime_support          1
 %define tizen_feature_watch_face_support       1
+%define tizen_feature_manual_rotate_support    0
 %endif
 
 %if "%{?profile}" == "tv"
 %define tizen_feature_rotary_event_support     0
 %define tizen_feature_web_ime_support          1
 %define tizen_feature_watch_face_support       0
+%define tizen_feature_manual_rotate_support    0
 %endif
 
 %if 0%{?tizen_feature_web_ime_support}
@@ -101,6 +104,7 @@ GYP_OPTIONS="$GYP_OPTIONS -Dbuild_type=Release"
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_rotary_event_support=%{?tizen_feature_rotary_event_support}"
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_web_ime_support=%{?tizen_feature_web_ime_support}"
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_watch_face_support=%{?tizen_feature_watch_face_support}"
+GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_manual_rotate_support=%{?tizen_feature_manual_rotate_support}"
 
 # Extension Path
 GYP_OPTIONS="$GYP_OPTIONS -Dextension_path=%{extension_path}"
index 85091b79a2e84ffe8494d3c7e8106c985e395186..d332dd84cca8289ff3d69f55c184a41b39f844cf 100755 (executable)
@@ -260,4 +260,17 @@ void NativeWindow::FullScreen(bool enable) {
       enable ? ELM_WIN_INDICATOR_TRANSPARENT : ELM_WIN_INDICATOR_OPAQUE);
 }
 
+#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
+void NativeWindow::EnableManualRotation(bool enable) {
+  LOGGER(DEBUG) << "set manual rotation : " << (enable ? "enabled" : "disabled");
+  elm_win_wm_rotation_manual_rotation_done_set(window_, enable ? EINA_TRUE : EINA_FALSE);
+}
+
+void NativeWindow::ManualRotationDone() {
+  if (EINA_TRUE == elm_win_wm_rotation_manual_rotation_done_get(window_)) {
+    elm_win_wm_rotation_manual_rotation_done(window_);
+  }
+}
+#endif  // MANUAL_ROTATE_FEATURE_SUPPORT
+
 }  // namespace runtime
index 279ac2caa7b7f8d649ab3c7cc0cc68ac27a38e33..4be175353ec5f0d857ccd4ea407c6b7ec35c0ad2 100755 (executable)
@@ -59,6 +59,10 @@ class NativeWindow {
   void FullScreen(bool enable);
   ScreenOrientation natural_orientation() const { return natural_orientation_;}
   Type type() const { return window_type_;}
+#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
+  void EnableManualRotation(bool enable);
+  void ManualRotationDone();
+#endif  // MANUAL_ROTATE_FEATURE_SUPPORT
 
  protected:
   virtual Evas_Object* CreateWindowInternal() = 0;
index cbd4c45fd56b3e1da736e78421db1510c34bbade..52c34e84015a538ea48cbb0c859757b1d9ed41d6 100644 (file)
@@ -388,6 +388,11 @@ bool WebApplication::Initialize() {
     security_model_version_ = 1;
   }
 
+#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
+  // Set manual rotation
+  window_->EnableManualRotation(true);
+#endif  // MANUAL_ROTATE_FEATURE_SUPPORT
+
   return true;
 }
 
@@ -841,6 +846,12 @@ void WebApplication::OnRendered(WebView* /*view*/) {
   window_->Active();
 }
 
+#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
+void WebApplication::OnRotatePrepared(WebView* /*view*/) {
+  window_->ManualRotationDone();
+}
+#endif  // MANUAL_ROTATE_FEATURE_SUPPORT
+
 void WebApplication::LaunchInspector(common::AppControl* appcontrol) {
   unsigned int port = ewk_context_inspector_server_start(ewk_context_, 0);
   std::stringstream ss;
index 47104253311a8cc6fb944397dab9c50208a433aa..02ca64b3e67a495e1403d9f25c4e1cca6680c4aa 100755 (executable)
@@ -101,6 +101,9 @@ class WebApplication : public WebView::EventListener {
   virtual void OnRotaryEvent(
       WebView* view, RotaryEventType type);
 #endif  // ROTARY_EVENT_FEATURE_SUPPORT
+#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
+  virtual void OnRotatePrepared(WebView* view);
+#endif // MANUAL_ROTATE_FEATURE_SUPPORT
 
  private:
   bool Initialize();
index e225ec92b7df6c8b15fdb156eeae05a5f09b56bf..216dd5ec2f5aae8ca73b52d70de043e2daa68962 100644 (file)
@@ -107,6 +107,9 @@ class WebView {
         WebView* /*view*/,
         RotaryEventType /*type*/) {}
 #endif  // ROTARY_EVENT_FEATURE_SUPPORT
+#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
+    virtual void OnRotatePrepared(WebView* /*view*/) {}
+#endif // MANUAL_ROTATE_FEATURE_SUPPORT
   };
 
   WebView(NativeWindow* window, Ewk_Context* context);
index 14c527e49894c897d82c4ffa8ef5e0f9e7a11e5d..6c262161a6ff299fcf99de91bf005c70a7d4d769 100644 (file)
@@ -342,6 +342,22 @@ void WebViewImpl::InitLoaderCallback() {
   smart_callbacks_["load,finished"] = loadfinished_callback;
   smart_callbacks_["load,progress"] = loadprogress_callback;
   smart_callbacks_["frame,rendered"] = rendered_callback;
+
+#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
+  // rotate prepared callback
+  auto rotateprepared_callback = [](void* user_data,
+                              Evas_Object*,
+                              void*) {
+    WebViewImpl* self = static_cast<WebViewImpl*>(user_data);
+    if (self->listener_)
+      self->listener_->OnRotatePrepared(self->view_);
+  };
+  evas_object_smart_callback_add(ewk_view_,
+                                 "rotate,prepared",
+                                 rotateprepared_callback,
+                                 this);
+  smart_callbacks_["rotate,prepared"] = rotateprepared_callback;
+#endif  // MANUAL_ROTATE_FEATURE_SUPPORT
 }
 
 void WebViewImpl::InitPolicyDecideCallback() {
@@ -802,12 +818,18 @@ void WebViewImpl::InitPopupWaitCallback() {
       [](void* user_data, Evas_Object* /*obj*/, void*) {
         WebViewImpl* self = static_cast<WebViewImpl*>(user_data);
         self->internal_popup_opened_ = true;
+#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
+        self->window_->EnableManualRotation(false);
+#endif  // MANUAL_ROTATE_FEATURE_SUPPORT
       }, this);
   evas_object_smart_callback_add(ewk_view_,
       "popup,reply,wait,finish",
       [](void* user_data, Evas_Object* /*obj*/, void*) {
         WebViewImpl* self = static_cast<WebViewImpl*>(user_data);
         self->internal_popup_opened_ = false;
+#ifdef MANUAL_ROTATE_FEATURE_SUPPORT
+        self->window_->EnableManualRotation(true);
+#endif  // MANUAL_ROTATE_FEATURE_SUPPORT
       }, this);
 }
 
index b0b5baede03c112723ba21e92ef13e58fb14e88e..2e0f476bbd0ffc5b783908dd0f94802a980ab15c 100755 (executable)
             ],
           },
         }],
+        ['tizen_feature_manual_rotate_support == 1', {
+          'defines': ['MANUAL_ROTATE_FEATURE_SUPPORT'],
+        }],
       ],
     }, # end of target 'xwalk_runtime'
     {