2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/adaptor/tizen-wayland/tizen-wearable/watch-application-impl.h>
22 #include <dali/internal/adaptor/common/adaptor-impl.h>
23 #include <dali/internal/system/common/environment-variables.h>
33 unsigned int GetEnvWatchRenderRefreshRate()
35 const char* envVariable = std::getenv(DALI_WATCH_REFRESH_RATE);
37 return envVariable ? std::atoi(envVariable) : 2u; // Default 30 fps
40 } // unnamed namespace
42 WatchApplicationPtr WatchApplication::New(
45 const std::string& stylesheet,
46 Dali::WatchApplication::WINDOW_MODE windowMode)
48 WatchApplicationPtr watch(new WatchApplication(argc, argv, stylesheet, windowMode));
52 WatchApplication::WatchApplication(int* argc, char** argv[], const std::string& stylesheet, Dali::Application::WINDOW_MODE windowMode)
53 : Application(argc, argv, stylesheet, windowMode, PositionSize(), Framework::WATCH, WindowType::NORMAL),
58 WatchApplication::~WatchApplication()
62 void WatchApplication::OnInit()
64 Application::OnInit();
66 Dali::Adaptor::Get().SetRenderRefreshRate(GetEnvWatchRenderRefreshRate());
71 void WatchApplication::OnTerminate()
73 Application::OnTerminate();
78 void WatchApplication::OnResume()
80 Application::OnResume();
85 void WatchApplication::OnPause()
87 Application::OnPause();
92 void WatchApplication::OnTimeTick(WatchTime& time)
94 Dali::WatchApplication watch(this);
95 mTickSignal.Emit(watch, time);
99 // This is a pre-resume scenario. All rendering engine of tizen SHOULD forcely update once at this time.
100 Internal::Adaptor::Adaptor::GetImplementation(GetAdaptor()).RequestUpdateOnce();
103 // A watch application will queue messages to update the UI in the signal emitted above
104 // Process these immediately to avoid a blinking issue where the old time is briefly visible
105 CoreEventInterface& eventInterface = Internal::Adaptor::Adaptor::GetImplementation(GetAdaptor());
106 eventInterface.ProcessCoreEvents();
109 void WatchApplication::OnAmbientTick(WatchTime& time)
111 Dali::WatchApplication watch(this);
112 mAmbientTickSignal.Emit(watch, time);
114 // A watch application will queue messages to update the UI in the signal emitted above
115 // Process these immediately to avoid a blinking issue where the old time is briefly visible
116 CoreEventInterface& eventInterface = Internal::Adaptor::Adaptor::GetImplementation(GetAdaptor());
117 eventInterface.ProcessCoreEvents();
120 void WatchApplication::OnAmbientChanged(bool ambient)
122 Dali::WatchApplication watch(this);
123 mAmbientChangeSignal.Emit(watch, ambient);
126 } // namespace Adaptor
128 } // namespace Internal