2 * Copyright (c) 2016 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>
37 unsigned int GetEnvWatchRenderRefreshRate()
39 const char* envVariable = std::getenv( DALI_WATCH_REFRESH_RATE );
41 return envVariable ? std::atoi( envVariable ) : 2u; // Default 30 fps
44 } // unnamed namespace
46 WatchApplicationPtr WatchApplication::New(
49 const std::string& stylesheet,
50 Dali::WatchApplication::WINDOW_MODE windowMode)
52 WatchApplicationPtr watch ( new WatchApplication (argc, argv, stylesheet, windowMode ) );
56 WatchApplication::WatchApplication( int* argc, char** argv[], const std::string& stylesheet, Dali::Application::WINDOW_MODE windowMode )
57 : Application(argc, argv, stylesheet, windowMode, PositionSize(), Framework::WATCH),
58 mState( UNINITIALIZED )
62 WatchApplication::~WatchApplication()
66 void WatchApplication::OnInit()
68 Application::OnInit();
70 Dali::Adaptor::Get().SetRenderRefreshRate( GetEnvWatchRenderRefreshRate() );
75 void WatchApplication::OnTerminate()
77 Application::OnTerminate();
82 void WatchApplication::OnResume()
84 Application::OnResume();
89 void WatchApplication::OnPause()
91 Application::OnPause();
96 void WatchApplication::OnTimeTick(WatchTime& time)
98 Dali::WatchApplication watch(this);
99 mTickSignal.Emit( watch, time );
103 // This is a pre-resume scenario. All rendering engine of tizen SHOULD forcely update once at this time.
104 Internal::Adaptor::Adaptor::GetImplementation( GetAdaptor() ).RequestUpdateOnce();
107 // A watch application will queue messages to update the UI in the signal emitted above
108 // Process these immediately to avoid a blinking issue where the old time is briefly visible
109 CoreEventInterface& eventInterface = Internal::Adaptor::Adaptor::GetImplementation( GetAdaptor() );
110 eventInterface.ProcessCoreEvents();
113 void WatchApplication::OnAmbientTick(WatchTime& time)
115 Dali::WatchApplication watch(this);
116 mAmbientTickSignal.Emit( watch, time );
118 // A watch application will queue messages to update the UI in the signal emitted above
119 // Process these immediately to avoid a blinking issue where the old time is briefly visible
120 CoreEventInterface& eventInterface = Internal::Adaptor::Adaptor::GetImplementation( GetAdaptor() );
121 eventInterface.ProcessCoreEvents();
124 void WatchApplication::OnAmbientChanged(bool ambient)
126 Dali::WatchApplication watch(this);
127 mAmbientChangeSignal.Emit( watch, ambient );
130 } // namespace Adaptor
132 } // namespace Internal