static int app_argc = 0;
static char** app_argv = NULL;
+// orientation
const int WIN_ORIENTATION_PORTRAIT_PRIMARY_ANGLE = 0;
const int WIN_ORIENTATION_LANDSCAPE_PRIMARY_ANGLE = 270;
const int W3C_ORIENTATION_PORTRAIT_PRIMARY_ANGLE = 0;
const int W3C_ORIENTATION_LANDSCAPE_PRIMARY_ANGLE = 90;
+// env
+const char* const HOME = "HOME";
+const char* const APP_HOME_PATH = "/opt/home/app";
+
WrtClient::WrtClient(int argc, char **argv) :
Application(argc, argv, "wrt-client", false),
DPL::TaskDecl<WrtClient>(this),
languageChangedCallback, this);
ADD_PROFILING_POINT("CreateWindow", "start");
- if (s_preparedWindowData == NULL)
- {
+ if (s_preparedWindowData == NULL) {
m_windowData.reset(new WindowData(static_cast<unsigned long>(getpid()), true));
- }
- else
- {
+ } else {
m_windowData.reset(s_preparedWindowData);
s_preparedWindowData = NULL;
}
ADD_PROFILING_POINT("CreateWindow", "stop");
+ evas_object_show(m_windowData->m_win);
+ // rotate window to initial value
+ setOrientationWindow();
WRT::UserDelegatesPtr cbs(new WRT::UserDelegates);
ADD_PROFILING_POINT("Create splash screen", "start");
NextStepEvent());
return;
}
+ // send rotate information to ewk
+ setOrientationEwk();
+
//you can't show window with splash screen before PrepareView
//ewk_view_add_with_context() in viewLogic breaks window
name = DPL::ToUTF8String(*(localizedInfo.name));
}
elm_win_title_set(m_windowData->m_win, name.c_str());
- evas_object_show(m_windowData->m_win);
+
initializeWindowModes();
connectElmCallback();
return 0;
}
-void WrtClient::connectElmCallback()
+void WrtClient::setOrientationWindow(void)
{
Assert(m_windowData);
Assert(m_dao);
- if (m_dao->getWidgetType().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
- WidgetSettings widgetSettings;
- m_dao->getWidgetSettings(widgetSettings);
- WidgetSettingList settings(widgetSettings);
- if (settings.getBackButtonPresence() == BackButton_Enable) {
- m_windowData->addFloatBackButtonCallback(
- "clicked",
- &WrtClient::backButtonCallback,
- this);
- }
- WidgetSettingScreenLock rotationValue = settings.getRotationValue();
- if (rotationValue == Screen_Portrait) {
- elm_win_wm_rotation_preferred_rotation_set(
- m_windowData->m_win,
- WIN_ORIENTATION_PORTRAIT_PRIMARY_ANGLE);
- ewk_view_orientation_send(
- m_widget->GetCurrentWebview(),
- W3C_ORIENTATION_PORTRAIT_PRIMARY_ANGLE);
- } else if (rotationValue == Screen_Landscape) {
- elm_win_wm_rotation_preferred_rotation_set(
- m_windowData->m_win,
- WIN_ORIENTATION_LANDSCAPE_PRIMARY_ANGLE);
- ewk_view_orientation_send(
- m_widget->GetCurrentWebview(),
- W3C_ORIENTATION_LANDSCAPE_PRIMARY_ANGLE);
- } else {
- elm_win_wm_rotation_preferred_rotation_set(
- m_windowData->m_win,
- WIN_ORIENTATION_PORTRAIT_PRIMARY_ANGLE);
- ewk_view_orientation_send(
- m_widget->GetCurrentWebview(),
- W3C_ORIENTATION_PORTRAIT_PRIMARY_ANGLE);
- }
+ WidgetSettings widgetSettings;
+ m_dao->getWidgetSettings(widgetSettings);
+ WidgetSettingList settings(widgetSettings);
+ WidgetSettingScreenLock rotationValue = settings.getRotationValue();
+ if (rotationValue == Screen_Portrait) {
+ elm_win_wm_rotation_preferred_rotation_set(
+ m_windowData->m_win,
+ WIN_ORIENTATION_PORTRAIT_PRIMARY_ANGLE);
+ } else if (rotationValue == Screen_Landscape) {
+ elm_win_wm_rotation_preferred_rotation_set(
+ m_windowData->m_win,
+ WIN_ORIENTATION_LANDSCAPE_PRIMARY_ANGLE);
+ } else {
+ elm_win_wm_rotation_preferred_rotation_set(
+ m_windowData->m_win,
+ WIN_ORIENTATION_PORTRAIT_PRIMARY_ANGLE);
+ }
+}
+
+void WrtClient::setOrientationEwk(void)
+{
+ Assert(m_widget);
+ Assert(m_dao);
+
+ WidgetSettings widgetSettings;
+ m_dao->getWidgetSettings(widgetSettings);
+ WidgetSettingList settings(widgetSettings);
+ WidgetSettingScreenLock rotationValue = settings.getRotationValue();
+ if (rotationValue == Screen_Portrait) {
+ ewk_view_orientation_send(
+ m_widget->GetCurrentWebview(),
+ W3C_ORIENTATION_PORTRAIT_PRIMARY_ANGLE);
+ } else if (rotationValue == Screen_Landscape) {
+ ewk_view_orientation_send(
+ m_widget->GetCurrentWebview(),
+ W3C_ORIENTATION_LANDSCAPE_PRIMARY_ANGLE);
+ } else {
+ ewk_view_orientation_send(
+ m_widget->GetCurrentWebview(),
+ W3C_ORIENTATION_PORTRAIT_PRIMARY_ANGLE);
+ }
+}
+
+void WrtClient::connectElmCallback()
+{
+ Assert(m_windowData);
+ Assert(m_dao);
+ WidgetSettings widgetSettings;
+ m_dao->getWidgetSettings(widgetSettings);
+ WidgetSettingList settings(widgetSettings);
+ if (settings.getBackButtonPresence() == BackButton_Enable) {
+ m_windowData->addFloatBackButtonCallback(
+ "clicked",
+ &WrtClient::backButtonCallback,
+ this);
}
}
}
LogInfo("Prepare window_data");
+ // Temporarily change HOME path to app
+ // This change is needed for getting elementary profile
+ // /opt/home/app/.elementary/config/mobile/base.cfg
+ const char* backupEnv = getenv(HOME);
+ setenv(HOME, APP_HOME_PATH, 1);
LogInfo("elm_init()");
elm_init(argc, argv);
+ setenv(HOME, backupEnv, 1);
+
LogInfo("WindowData()");
s_preparedWindowData = new WindowData(static_cast<unsigned long>(getpid()));