Implement window rotation 66/175266/4
authorws29.jung <ws29.jung@samsung.com>
Tue, 10 Apr 2018 02:13:36 +0000 (11:13 +0900)
committerws29.jung <ws29.jung@samsung.com>
Tue, 17 Apr 2018 10:36:41 +0000 (19:36 +0900)
When mobile device is rotated, webapp did not follow the rotation.
Now window will properly rotate as mobile device rotates.

Change-Id: I27f45277188d119dc87e5e912607ffec26607373
Signed-off-by: ws29.jung <ws29.jung@samsung.com>
atom/browser/native_window_efl.cc

index af0b862..2f214b7 100644 (file)
@@ -92,6 +92,21 @@ NativeWindowEfl::NativeWindowEfl(
       &HWBackKeyCallback, this);
   eext_object_event_callback_add(web_view_, EEXT_CALLBACK_MORE,
       &HWMoreKeyCallback, this);
+
+  if (elm_win_wm_rotation_supported_get(window_)) {
+    int rots[4] = {0, 90, 180, 270};
+    elm_win_wm_rotation_available_rotations_set(window_,
+        (const int *)(&rots), 4);
+
+    // Registering nullptr as Callback, but window will rotate without error.
+    // Is it right action?
+    evas_object_smart_callback_add(window_,
+                                   "wm,rotation,changed",
+                                   nullptr,
+                                   this);
+  } else {
+    LOG(ERROR) << __func__ << " Window does not support rotation";
+  }
 #endif
 
 #if defined(OS_TIZEN_TV_PRODUCT)