[DEV] enable suspend mode in periodic call
This commit is contained in:
parent
be8264edf9
commit
d010c5ec2d
@ -203,8 +203,8 @@ public abstract class EwolWallpaper extends WallpaperService implements EwolCall
|
||||
// no title in the wallpaper ...
|
||||
Log.d("EwolCallback", "SET TITLE is not implemented ...");
|
||||
}
|
||||
public void Stop()
|
||||
public void stop()
|
||||
{
|
||||
Log.d("EwolCallback", "STOP is not implemented ...");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -565,6 +565,7 @@ extern "C"
|
||||
// TODO : Generate error in java to stop the current instance
|
||||
return;
|
||||
}
|
||||
s_listInstance[_id]->OS_Resume();
|
||||
}
|
||||
void Java_org_ewol_Ewol_EWonPause(JNIEnv* _env, jobject _thiz, jint _id)
|
||||
{
|
||||
@ -580,6 +581,7 @@ extern "C"
|
||||
}
|
||||
// All the openGl has been destroyed ...
|
||||
s_listInstance[_id]->GetResourcesManager().ContextHasBeenDestroyed();
|
||||
s_listInstance[_id]->OS_Suspend();
|
||||
}
|
||||
void Java_org_ewol_Ewol_EWonStop(JNIEnv* _env, jobject _thiz, jint _id)
|
||||
{
|
||||
@ -593,6 +595,7 @@ extern "C"
|
||||
// TODO : Generate error in java to stop the current instance
|
||||
return;
|
||||
}
|
||||
s_listInstance[_id]->OS_Stop();
|
||||
}
|
||||
void Java_org_ewol_Ewol_EWonDestroy(JNIEnv* _env, jobject _thiz, jint _id)
|
||||
{
|
||||
|
@ -440,6 +440,7 @@ bool ewol::eContext::OS_Draw(bool _displayEveryTime)
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_previousDisplayTime = currentTime;
|
||||
|
||||
// process the events
|
||||
@ -557,3 +558,13 @@ void ewol::eContext::OS_Stop(void)
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::eContext::OS_Suspend(void)
|
||||
{
|
||||
m_previousDisplayTime = -1;
|
||||
}
|
||||
|
||||
void ewol::eContext::OS_Resume(void)
|
||||
{
|
||||
m_previousDisplayTime = ewol::GetTime();
|
||||
m_widgetManager.PeriodicCallResume(m_previousDisplayTime);
|
||||
}
|
||||
|
@ -150,6 +150,14 @@ namespace ewol
|
||||
ewol::keyEvent::keyboard_te _move,
|
||||
bool _isDown,
|
||||
bool _isARepeateKey=false);
|
||||
/**
|
||||
* @brief The current context is suspended
|
||||
*/
|
||||
virtual void OS_Suspend(void);
|
||||
/**
|
||||
* @brief The current context is Resumed
|
||||
*/
|
||||
virtual void OS_Resume(void);
|
||||
|
||||
//virtual void OS_SetClipBoard(ewol::clipBoard::clipboardListe_te _clipboardID);
|
||||
|
||||
|
@ -70,27 +70,27 @@ ewol::WidgetManager::~WidgetManager(void)
|
||||
m_creatorList.Clear();
|
||||
}
|
||||
|
||||
void ewol::WidgetManager::Rm(ewol::Widget * newWidget)
|
||||
void ewol::WidgetManager::Rm(ewol::Widget* _newWidget)
|
||||
{
|
||||
PeriodicCallRm(newWidget);
|
||||
FocusRemoveIfRemove(newWidget);
|
||||
PeriodicCallRm(_newWidget);
|
||||
FocusRemoveIfRemove(_newWidget);
|
||||
}
|
||||
|
||||
/* *************************************************************************
|
||||
* Focus Area :
|
||||
* *************************************************************************/
|
||||
|
||||
void ewol::WidgetManager::FocusKeep(ewol::Widget * newWidget)
|
||||
void ewol::WidgetManager::FocusKeep(ewol::Widget* _newWidget)
|
||||
{
|
||||
if (NULL == newWidget) {
|
||||
if (NULL == _newWidget) {
|
||||
// nothing to do ...
|
||||
return;
|
||||
}
|
||||
if (false == newWidget->CanHaveFocus()) {
|
||||
if (false == _newWidget->CanHaveFocus()) {
|
||||
EWOL_VERBOSE("Widget can not have Focus, id=" << 9999999999.999);
|
||||
return;
|
||||
}
|
||||
if (newWidget == m_focusWidgetCurrent) {
|
||||
if (_newWidget == m_focusWidgetCurrent) {
|
||||
// nothing to do ...
|
||||
return;
|
||||
}
|
||||
@ -98,7 +98,7 @@ void ewol::WidgetManager::FocusKeep(ewol::Widget * newWidget)
|
||||
EWOL_DEBUG("Rm Focus on WidgetID=" << m_focusWidgetCurrent->GetId() );
|
||||
m_focusWidgetCurrent->RmFocus();
|
||||
}
|
||||
m_focusWidgetCurrent = newWidget;
|
||||
m_focusWidgetCurrent = _newWidget;
|
||||
if (NULL != m_focusWidgetCurrent) {
|
||||
EWOL_DEBUG("Set Focus on WidgetID=" << m_focusWidgetCurrent->GetId() );
|
||||
m_focusWidgetCurrent->SetFocus();
|
||||
@ -106,10 +106,11 @@ void ewol::WidgetManager::FocusKeep(ewol::Widget * newWidget)
|
||||
}
|
||||
|
||||
|
||||
void ewol::WidgetManager::FocusSetDefault(ewol::Widget * newWidget)
|
||||
void ewol::WidgetManager::FocusSetDefault(ewol::Widget * _newWidget)
|
||||
{
|
||||
if (NULL != newWidget && false == newWidget->CanHaveFocus()) {
|
||||
EWOL_VERBOSE("Widget can not have Focus, id=" << newWidget->GetId() );
|
||||
if( NULL != _newWidget
|
||||
&& false == _newWidget->CanHaveFocus() ) {
|
||||
EWOL_VERBOSE("Widget can not have Focus, id=" << _newWidget->GetId() );
|
||||
return;
|
||||
}
|
||||
if (m_focusWidgetDefault == m_focusWidgetCurrent) {
|
||||
@ -117,13 +118,13 @@ void ewol::WidgetManager::FocusSetDefault(ewol::Widget * newWidget)
|
||||
EWOL_DEBUG("Rm Focus on WidgetID=" << m_focusWidgetCurrent->GetId() );
|
||||
m_focusWidgetCurrent->RmFocus();
|
||||
}
|
||||
m_focusWidgetCurrent = newWidget;
|
||||
m_focusWidgetCurrent = _newWidget;
|
||||
if (NULL != m_focusWidgetCurrent) {
|
||||
EWOL_DEBUG("Set Focus on WidgetID=" << m_focusWidgetCurrent->GetId() );
|
||||
m_focusWidgetCurrent->SetFocus();
|
||||
}
|
||||
}
|
||||
m_focusWidgetDefault = newWidget;
|
||||
m_focusWidgetDefault = _newWidget;
|
||||
}
|
||||
|
||||
|
||||
@ -150,13 +151,13 @@ ewol::Widget * ewol::WidgetManager::FocusGet(void)
|
||||
return m_focusWidgetCurrent;
|
||||
}
|
||||
|
||||
void ewol::WidgetManager::FocusRemoveIfRemove(ewol::Widget * newWidget)
|
||||
void ewol::WidgetManager::FocusRemoveIfRemove(ewol::Widget* _newWidget)
|
||||
{
|
||||
if (m_focusWidgetCurrent == newWidget) {
|
||||
if (m_focusWidgetCurrent == _newWidget) {
|
||||
EWOL_WARNING("Release Focus when remove widget");
|
||||
FocusRelease();
|
||||
}
|
||||
if (m_focusWidgetDefault == newWidget) {
|
||||
if (m_focusWidgetDefault == _newWidget) {
|
||||
EWOL_WARNING("Release default Focus when remove widget");
|
||||
FocusSetDefault(NULL);
|
||||
}
|
||||
@ -164,28 +165,28 @@ void ewol::WidgetManager::FocusRemoveIfRemove(ewol::Widget * newWidget)
|
||||
|
||||
|
||||
|
||||
void ewol::WidgetManager::PeriodicCallAdd(ewol::Widget * pWidget)
|
||||
void ewol::WidgetManager::PeriodicCallAdd(ewol::Widget* _pWidget)
|
||||
{
|
||||
for (int32_t iii=0; iii < m_listOfPeriodicWidget.Size(); iii++) {
|
||||
if (m_listOfPeriodicWidget[iii] == pWidget) {
|
||||
if (m_listOfPeriodicWidget[iii] == _pWidget) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (int32_t iii=0; iii < m_listOfPeriodicWidget.Size(); iii++) {
|
||||
if (NULL == m_listOfPeriodicWidget[iii]) {
|
||||
m_listOfPeriodicWidget[iii] = pWidget;
|
||||
m_listOfPeriodicWidget[iii] = _pWidget;
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_listOfPeriodicWidget.PushBack(pWidget);
|
||||
m_listOfPeriodicWidget.PushBack(_pWidget);
|
||||
m_havePeriodic = true;
|
||||
}
|
||||
|
||||
void ewol::WidgetManager::PeriodicCallRm(ewol::Widget * pWidget)
|
||||
void ewol::WidgetManager::PeriodicCallRm(ewol::Widget * _pWidget)
|
||||
{
|
||||
int32_t nbElement = 0;
|
||||
for (int32_t iii=m_listOfPeriodicWidget.Size()-1; iii>=0 ; iii--) {
|
||||
if (m_listOfPeriodicWidget[iii] == pWidget) {
|
||||
if (m_listOfPeriodicWidget[iii] == _pWidget) {
|
||||
m_listOfPeriodicWidget[iii] = NULL;
|
||||
} else {
|
||||
nbElement++;
|
||||
@ -196,6 +197,11 @@ void ewol::WidgetManager::PeriodicCallRm(ewol::Widget * pWidget)
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::WidgetManager::PeriodicCallResume(int64_t _localTime)
|
||||
{
|
||||
m_lastPeriodicCallTime = _localTime;
|
||||
}
|
||||
|
||||
void ewol::WidgetManager::PeriodicCall(int64_t _localTime)
|
||||
{
|
||||
int64_t previousTime = m_lastPeriodicCallTime;
|
||||
|
@ -23,8 +23,8 @@ namespace ewol
|
||||
typedef ewol::Widget* (*creator_tf)(void);
|
||||
private:
|
||||
// For the focus Management
|
||||
ewol::Widget * m_focusWidgetDefault;
|
||||
ewol::Widget * m_focusWidgetCurrent;
|
||||
ewol::Widget* m_focusWidgetDefault;
|
||||
ewol::Widget* m_focusWidgetCurrent;
|
||||
etk::Vector<ewol::Widget*> m_listOfPeriodicWidget;
|
||||
bool m_havePeriodic;
|
||||
bool m_haveRedraw;
|
||||
@ -35,17 +35,18 @@ namespace ewol
|
||||
WidgetManager(void);
|
||||
~WidgetManager(void);
|
||||
// need to call when remove a widget to clear all dependency of the focus system
|
||||
void Rm(ewol::Widget * newWidget);
|
||||
void Rm(ewol::Widget* _newWidget);
|
||||
|
||||
void FocusKeep(ewol::Widget * newWidget); // set the focus at the specific widget
|
||||
void FocusSetDefault(ewol::Widget * newWidget); // select the default focus getter
|
||||
void FocusKeep(ewol::Widget* _newWidget); // set the focus at the specific widget
|
||||
void FocusSetDefault(ewol::Widget* _newWidget); // select the default focus getter
|
||||
void FocusRelease(void); // Release focus from the current widget to the default
|
||||
ewol::Widget* FocusGet(void);
|
||||
void FocusRemoveIfRemove(ewol::Widget * newWidget);
|
||||
void FocusRemoveIfRemove(ewol::Widget* _newWidget);
|
||||
|
||||
void PeriodicCallAdd(ewol::Widget* pWidget);
|
||||
void PeriodicCallRm(ewol::Widget* pWidget);
|
||||
void PeriodicCall(int64_t localTime);
|
||||
void PeriodicCallAdd(ewol::Widget* _pWidget);
|
||||
void PeriodicCallRm(ewol::Widget* _pWidget);
|
||||
void PeriodicCall(int64_t _localTime);
|
||||
void PeriodicCallResume(int64_t _localTime);
|
||||
bool PeriodicCallHave(void);
|
||||
|
||||
void MarkDrawingIsNeeded(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user