nullptr);
}
+int WRTNativeWindowTV::GetScreenOrientation() {
+ auto* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(top_window_));
+ int degree = ecore_evas_rotation_get(ee);
+ LOG(INFO) << "GetScreenOrientation degree:" << degree;
+ return degree;
+}
+
+bool WRTNativeWindowTV::SetScreenOrientation(const std::string& degree) {
+ LOG(INFO) << "SetScreenOrientation degree: " << degree;
+ if (degree.empty())
+ return false;
+
+ int screen_degree = 0;
+ base::StringToInt(degree, &screen_degree);
+ if (screen_degree < 0 || screen_degree % 90 != 0)
+ return false;
+
+ int screen_width = 1920, screen_height = 1080;
+ GetScreenResolution(screen_width, screen_height);
+ elm_win_rotation_set(top_window_, screen_degree);
+ if (screen_degree == 90 || screen_degree == 270) {
+ evas_object_resize(top_window_, screen_height, screen_width);
+ evas_object_resize(view_evas(), screen_height, screen_width);
+ } else {
+ evas_object_resize(top_window_, screen_width, screen_height);
+ evas_object_resize(view_evas(), screen_width, screen_height);
+ }
+ return true;
+}
+
} // namespace wrt
return "failed";
} else if (type == "tizen://getGlobalResourceId") {
return std::to_string(WRTNativeWindowTV::GetGlobalResourceId());
+ } else if (type == "tizen://getScreenOrientation") {
+ if (auto native_window_tv = wrt::WRTNativeWindowTV::GetMainNativeWindow())
+ return std::to_string(native_window_tv->GetScreenOrientation());
+ return "failed";
+ } else if (type == "tizen://setScreenOrientation") {
+ auto native_window_tv = wrt::WRTNativeWindowTV::GetMainNativeWindow();
+ return (native_window_tv && native_window_tv->SetScreenOrientation(value))
+ ? "success"
+ : "failed";
} else {
return XWalkExtensionManager::HandleRuntimeMessageInternal(type, value);
}
return parseInt(sendRuntimeSyncMessage("tizen://getGlobalResourceId"), 10);
};
+Widget.prototype.getScreenOrientation = function() {
+ return parseInt(sendRuntimeSyncMessage("tizen://getScreenOrientation"), 10);
+}
+
+Widget.prototype.setScreenOrientation = function(orientation) {
+ return sendRuntimeSyncMessage("tizen://setScreenOrientation", orientation);
+}
+
var MDE = function() {};
var localPortCallbackId = null;