[DEV] update etk null

This commit is contained in:
Edouard DUPIN 2018-06-19 22:13:47 +02:00
parent ce3e28295c
commit 9f5104bedc
18 changed files with 326 additions and 326 deletions

View File

@ -28,7 +28,7 @@ void gale::Thread::start() {
m_state = state::starting;
m_context = &gale::getContext();
m_thread = ememory::makeShared<ethread::Thread>([=](){this->threadCall();}, "galeThread");
if (m_thread == nullptr) {
if (m_thread == null) {
GALE_ERROR("Can not create thread ...");
return;
}
@ -93,7 +93,7 @@ void gale::Thread::threadCall() {
}
}
GALE_DEBUG("THREAD MAIN [STOP]");
gale::setContext(nullptr);
gale::setContext(null);
m_state = state::stopping;
}

View File

@ -53,10 +53,10 @@ class AndroidContext : public gale::Context {
private:
bool safeInitMethodID(jmethodID& _mid, jclass& _cls, const char* _name, const char* _sign) {
_mid = m_JavaVirtualMachinePointer->GetMethodID(_cls, _name, _sign);
if(_mid == nullptr) {
if(_mid == null) {
GALE_ERROR("C->java : Can't find the method " << _name);
/* remove access on the virtual machine : */
m_JavaVirtualMachinePointer = nullptr;
m_JavaVirtualMachinePointer = null;
return false;
}
return true;
@ -65,7 +65,7 @@ class AndroidContext : public gale::Context {
AndroidContext(gale::Application* _application, JNIEnv* _env, jclass _classBase, jobject _objCallback, enum application _typeAPPL) :
gale::Context(_application),
m_javaApplicationType(_typeAPPL),
m_JavaVirtualMachinePointer(nullptr),
m_JavaVirtualMachinePointer(null),
m_javaClassGale(0),
m_javaClassGaleCallback(0),
m_javaObjectGaleCallback(0),
@ -89,21 +89,21 @@ class AndroidContext : public gale::Context {
GALE_DEBUG("*******************************************");
m_JavaVirtualMachinePointer = _env;
// get default needed all time elements :
if (nullptr != m_JavaVirtualMachinePointer) {
if (null != m_JavaVirtualMachinePointer) {
GALE_DEBUG("C->java : try load org/gale/Gale class");
m_javaClassGale = m_JavaVirtualMachinePointer->FindClass("org/gale/Gale" );
if (m_javaClassGale == 0) {
GALE_ERROR("C->java : Can't find org/gale/Gale class");
// remove access on the virtual machine :
m_JavaVirtualMachinePointer = nullptr;
m_JavaVirtualMachinePointer = null;
return;
}
/* The object field extends Activity and implement GaleCallback */
m_javaClassGaleCallback = m_JavaVirtualMachinePointer->GetObjectClass(_objCallback);
if(m_javaClassGaleCallback == nullptr) {
if(m_javaClassGaleCallback == null) {
GALE_ERROR("C->java : Can't find org/gale/GaleCallback class");
// remove access on the virtual machine :
m_JavaVirtualMachinePointer = nullptr;
m_JavaVirtualMachinePointer = null;
return;
}
bool functionCallbackIsMissing = false;
@ -189,7 +189,7 @@ class AndroidContext : public gale::Context {
m_javaObjectGaleCallback = _env->NewGlobalRef(_objCallback);
//javaObjectGaleCallbackAndActivity = objCallback;
if (m_javaObjectGaleCallback == nullptr) {
if (m_javaObjectGaleCallback == null) {
functionCallbackIsMissing = true;
}
@ -197,7 +197,7 @@ class AndroidContext : public gale::Context {
if (m_javaDefaultClassString == 0) {
GALE_ERROR("C->java : Can't find java/lang/String" );
// remove access on the virtual machine :
m_JavaVirtualMachinePointer = nullptr;
m_JavaVirtualMachinePointer = null;
functionCallbackIsMissing = true;
}
if (functionCallbackIsMissing == true) {
@ -212,7 +212,7 @@ class AndroidContext : public gale::Context {
void unInit(JNIEnv* _env) {
_env->DeleteGlobalRef(m_javaObjectGaleCallback);
m_javaObjectGaleCallback = nullptr;
m_javaObjectGaleCallback = null;
}
int32_t run() {
@ -291,9 +291,9 @@ class AndroidContext : public gale::Context {
private:
bool java_attach_current_thread(int *_rstatus) {
GALE_DEBUG("C->java : call java");
if (jvm_basics::getJavaVM() == nullptr) {
if (jvm_basics::getJavaVM() == null) {
GALE_ERROR("C->java : JVM not initialised");
m_JavaVirtualMachinePointer = nullptr;
m_JavaVirtualMachinePointer = null;
return false;
}
*_rstatus = jvm_basics::getJavaVM()->GetEnv((void **) &m_JavaVirtualMachinePointer, JNI_VERSION_1_6);
@ -301,12 +301,12 @@ class AndroidContext : public gale::Context {
JavaVMAttachArgs lJavaVMAttachArgs;
lJavaVMAttachArgs.version = JNI_VERSION_1_6;
lJavaVMAttachArgs.name = "GaleNativeThread";
lJavaVMAttachArgs.group = nullptr;
lJavaVMAttachArgs.group = null;
int status = jvm_basics::getJavaVM()->AttachCurrentThread(&m_JavaVirtualMachinePointer, &lJavaVMAttachArgs);
jvm_basics::checkExceptionJavaVM(m_JavaVirtualMachinePointer);
if (status != JNI_OK) {
GALE_ERROR("C->java : AttachCurrentThread failed : " << status);
m_JavaVirtualMachinePointer = nullptr;
m_JavaVirtualMachinePointer = null;
return false;
}
}
@ -316,7 +316,7 @@ class AndroidContext : public gale::Context {
void java_detach_current_thread(int _status) {
if(_status == JNI_EDETACHED) {
jvm_basics::getJavaVM()->DetachCurrentThread();
m_JavaVirtualMachinePointer = nullptr;
m_JavaVirtualMachinePointer = null;
}
}
@ -398,7 +398,7 @@ class AndroidContext : public gale::Context {
return;
}
GALE_DEBUG("C->java : 222");
if (nullptr == _dataString) {
if (null == _dataString) {
GALE_ERROR("C->java : No data to send ...");
return;
}
@ -507,7 +507,7 @@ extern "C" {
ethread::UniqueLock lock(g_interfaceMutex);
if( _id >= (int32_t)s_listInstance.size()
|| _id<0
|| nullptr == s_listInstance[_id] ) {
|| null == s_listInstance[_id] ) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -522,12 +522,12 @@ extern "C" {
if (isCopy == JNI_TRUE) {
// from here str is reset ...
_env->ReleaseStringUTFChars(_myString, str);
str = nullptr;
str = null;
}
if (isCopy2 == JNI_TRUE) {
// from here str is reset ...
_env->ReleaseStringUTFChars(_applicationName, str2);
str2 = nullptr;
str2 = null;
}
}
@ -541,7 +541,7 @@ extern "C" {
GALE_DEBUG("*******************************************");
GALE_DEBUG("** Creating GALE context **");
GALE_DEBUG("*******************************************");
AndroidContext* tmpContext = nullptr;
AndroidContext* tmpContext = null;
s_applicationInit = NULL;
gale::Application* localApplication = NULL;
// call the basic init of all application (that call us ...)
@ -556,7 +556,7 @@ extern "C" {
GALE_CRITICAL(" try to create an instance with no apply type: " << _typeApplication);
return -1;
}
if (tmpContext == nullptr) {
if (tmpContext == null) {
GALE_ERROR("Can not allocate the main context instance _id=" << (s_listInstance.size()-1));
return -1;
}
@ -576,20 +576,20 @@ extern "C" {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
return;
}
if (s_listInstance[_id] == nullptr) {
if (s_listInstance[_id] == null) {
GALE_ERROR("the requested instance _id=" << (int32_t)_id << " is already removed ...");
return;
}
s_listInstance[_id]->unInit(_env);
ETK_DELETE(AndroidContext, s_listInstance[_id]);
s_listInstance[_id]=nullptr;
s_listInstance[_id]=null;
}
void Java_org_gale_Gale_EWtouchEvent(JNIEnv* _env, jobject _thiz, jint _id) {
ethread::UniqueLock lock(g_interfaceMutex);
GALE_DEBUG(" == > Touch Event");
if( _id >= (int32_t)s_listInstance.size()
|| _id < 0
|| s_listInstance[_id] == nullptr) {
|| s_listInstance[_id] == null) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -604,7 +604,7 @@ extern "C" {
GALE_DEBUG("*******************************************");
if( _id >= (int32_t)s_listInstance.size()
|| _id < 0
|| s_listInstance[_id] == nullptr) {
|| s_listInstance[_id] == null) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -620,7 +620,7 @@ extern "C" {
GALE_DEBUG("*******************************************");
if( _id >= (int32_t)s_listInstance.size()
|| _id < 0
|| s_listInstance[_id]== nullptr) {
|| s_listInstance[_id]== null) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -635,7 +635,7 @@ extern "C" {
GALE_DEBUG("*******************************************");
if( _id >= (int32_t)s_listInstance.size()
|| _id < 0
|| s_listInstance[_id] == nullptr) {
|| s_listInstance[_id] == null) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -649,7 +649,7 @@ extern "C" {
GALE_DEBUG("*******************************************");
if( _id >= (int32_t)s_listInstance.size()
|| _id < 0
|| s_listInstance[_id] == nullptr) {
|| s_listInstance[_id] == null) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -663,7 +663,7 @@ extern "C" {
GALE_DEBUG("*******************************************");
if( _id >= (int32_t)s_listInstance.size()
|| _id < 0
|| s_listInstance[_id] == nullptr) {
|| s_listInstance[_id] == null) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -679,7 +679,7 @@ extern "C" {
GALE_DEBUG("*******************************************");
if( _id >= (int32_t)s_listInstance.size()
|| _id < 0
|| s_listInstance[_id] == nullptr) {
|| s_listInstance[_id] == null) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -693,7 +693,7 @@ extern "C" {
GALE_DEBUG("*******************************************");
if( _id >= (int32_t)s_listInstance.size()
|| _id < 0
|| s_listInstance[_id] == nullptr) {
|| s_listInstance[_id] == null) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -716,7 +716,7 @@ extern "C" {
ethread::UniqueLock lock(g_interfaceMutex);
if( _id >= (int32_t)s_listInstance.size()
|| _id < 0
|| s_listInstance[_id] == nullptr) {
|| s_listInstance[_id] == null) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -737,7 +737,7 @@ extern "C" {
ethread::UniqueLock lock(g_interfaceMutex);
if( _id >= (int32_t)s_listInstance.size()
|| _id < 0
|| s_listInstance[_id] == nullptr ) {
|| s_listInstance[_id] == null ) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -757,7 +757,7 @@ extern "C" {
ethread::UniqueLock lock(g_interfaceMutex);
if( _id >= (int32_t)s_listInstance.size()
|| _id<0
|| nullptr == s_listInstance[_id] ) {
|| null == s_listInstance[_id] ) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -778,7 +778,7 @@ extern "C" {
ethread::UniqueLock lock(g_interfaceMutex);
if( _id >= (int32_t)s_listInstance.size()
|| _id<0
|| nullptr == s_listInstance[_id] ) {
|| null == s_listInstance[_id] ) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -796,7 +796,7 @@ extern "C" {
ethread::UniqueLock lock(g_interfaceMutex);
if( _id >= (int32_t)s_listInstance.size()
|| _id<0
|| nullptr == s_listInstance[_id] ) {
|| null == s_listInstance[_id] ) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -812,7 +812,7 @@ extern "C" {
ethread::UniqueLock lock(g_interfaceMutex);
if( _id >= (int32_t)s_listInstance.size()
|| _id<0
|| nullptr == s_listInstance[_id] ) {
|| null == s_listInstance[_id] ) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -829,7 +829,7 @@ extern "C" {
ethread::UniqueLock lock(g_interfaceMutex);
if( _id >= (int32_t)s_listInstance.size()
|| _id<0
|| nullptr == s_listInstance[_id] ) {
|| null == s_listInstance[_id] ) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -846,7 +846,7 @@ extern "C" {
ethread::UniqueLock lock(g_interfaceMutex);
if( _id >= (int32_t)s_listInstance.size()
|| _id<0
|| nullptr == s_listInstance[_id] ) {
|| null == s_listInstance[_id] ) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -864,7 +864,7 @@ extern "C" {
ethread::UniqueLock lock(g_interfaceMutex);
if( _id >= (int32_t)s_listInstance.size()
|| _id<0
|| nullptr == s_listInstance[_id] ) {
|| null == s_listInstance[_id] ) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return false;
@ -909,7 +909,7 @@ extern "C" {
GALE_VERBOSE("Java_org_gale_Gale_EWrenderInit [BEGIN]");
if( _id >= (int32_t)s_listInstance.size()
|| _id<0
|| nullptr == s_listInstance[_id] ) {
|| null == s_listInstance[_id] ) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -926,7 +926,7 @@ extern "C" {
GALE_VERBOSE("Java_org_gale_Gale_EWrenderResize [BEGIN]");
if( _id >= (int32_t)s_listInstance.size()
|| _id<0
|| nullptr == s_listInstance[_id] ) {
|| null == s_listInstance[_id] ) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
@ -943,7 +943,7 @@ extern "C" {
GALE_VERBOSE("Java_org_gale_Gale_EWrenderDraw [BEGIN]");
if( _id >= (int32_t)s_listInstance.size()
|| _id<0
|| nullptr == s_listInstance[_id] ) {
|| null == s_listInstance[_id] ) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;

View File

@ -45,26 +45,26 @@ static etk::Map<uint64_t, gale::Context*>& getContextList() {
return g_val;
}
static gale::Context* lastContextSet = nullptr;
static gale::Context* lastContextSet = null;
gale::Context& gale::getContext() {
etk::Map<uint64_t, gale::Context*>& list = getContextList();
g_lockContextMap.lock();
etk::Map<uint64_t, gale::Context*>::Iterator it = list.find(ethread::getId());
gale::Context* out = nullptr;
gale::Context* out = null;
if (it != list.end()) {
out = it->second;
}
g_lockContextMap.unLock();
if (out == nullptr) {
if (out == null) {
for (auto &it2 : list) {
if (out == nullptr) {
if (it2.second != nullptr) {
if (out == null) {
if (it2.second != null) {
out = it2.second;
}
} else {
if (it2.second == nullptr) {
if (it2.second == null) {
continue;
} else if (it2.second == out) {
continue;
@ -73,8 +73,8 @@ gale::Context& gale::getContext() {
}
}
}
if (out == nullptr) {
if (lastContextSet != nullptr) {
if (out == null) {
if (lastContextSet != null) {
GALE_ERROR("[CRITICAL] try acces at an empty context interface && fallback on the last context SET ==> you must correct yout implementation");
out = lastContextSet;
} else {
@ -91,7 +91,7 @@ void gale::setContext(gale::Context* _context) {
etk::Map<uint64_t, gale::Context*>& list = getContextList();
//GALE_ERROR("Set context : " << ethread::getId() << " context pointer : " << uint64_t(_context));
g_lockContextMap.lock();
if (_context != nullptr) {
if (_context != null) {
lastContextSet = _context;
}
list.set(ethread::getId(), _context);
@ -99,7 +99,7 @@ void gale::setContext(gale::Context* _context) {
}
void gale::contextRegisterThread(ethread::Thread* _thread) {
if (_thread == nullptr) {
if (_thread == null) {
return;
}
gale::Context* context = &gale::getContext();
@ -111,7 +111,7 @@ void gale::contextRegisterThread(ethread::Thread* _thread) {
}
void gale::contextUnRegisterThread(ethread::Thread* _thread) {
if (_thread == nullptr) {
if (_thread == null) {
return;
}
etk::Map<uint64_t, gale::Context*>& list = getContextList();
@ -134,11 +134,11 @@ void gale::Context::lockContext() {
}
/**
* @brief set the curent interface at nullptr.
* @brief set the curent interface at null.
* @note this un-lock the main mutex
*/
void gale::Context::unLockContext() {
setContext(nullptr);
setContext(null);
mutexInterface().unLock();
}
@ -153,7 +153,7 @@ void gale::Context::processEvents() {
ethread::RecursiveLock lock(m_mutex);
m_msgSystem.wait(func);
}
if (func == nullptr) {
if (func == null) {
continue;
}
func(*this);
@ -203,7 +203,7 @@ namespace gale {
#endif
m_context->processEvents();
// call all the application for periodic request (the application manage multiple instance )...
if (m_context->m_application != nullptr) {
if (m_context->m_application != null) {
m_context->m_application->onPeriod(echrono::Steady::now());
}
#if 0
@ -238,7 +238,7 @@ gale::Context::Context(gale::Application* _application, int32_t _argc, const cha
m_windowsSize(320,480) {
// set a basic
ethread::setName("galeThread");
if (m_application == nullptr) {
if (m_application == null) {
GALE_CRITICAL("Can not start context with no Application ==> rtfm ...");
}
m_commandLine.parse(_argc, _argv);
@ -349,7 +349,7 @@ gale::Context::Context(gale::Application* _application, int32_t _argc, const cha
m_msgSystem.post([](gale::Context& _context){
ememory::SharedPtr<gale::Application> appl = _context.getApplication();
if (appl == nullptr) {
if (appl == null) {
return;
}
appl->onCreate(_context);
@ -466,7 +466,7 @@ void gale::Context::OS_Move(const vec2& _pos) {
GALE_DEBUG("Receive MSG : THREAD_MOVE : " << _context.m_windowsPos << " ==> " << _pos);
_context.m_windowsPos = _pos;
ememory::SharedPtr<gale::Application> appl = _context.getApplication();
if (appl == nullptr) {
if (appl == null) {
return;
}
appl->onMovePosition(_context.m_windowsPos);
@ -501,7 +501,7 @@ void gale::Context::OS_SetInput(enum gale::key::type _type,
ethread::RecursiveLock lock(m_mutex);
m_msgSystem.post([_type, _status, _pointerID, _pos](gale::Context& _context){
ememory::SharedPtr<gale::Application> appl = _context.getApplication();
if (appl == nullptr) {
if (appl == null) {
return;
}
appl->onPointer(_type,
@ -538,7 +538,7 @@ void gale::Context::OS_setKeyboard(const gale::key::Special& _special,
ethread::RecursiveLock lock(m_mutex);
m_msgSystem.post([_special, _type, _state, _char](gale::Context& _context){
ememory::SharedPtr<gale::Application> appl = _context.getApplication();
if (appl == nullptr) {
if (appl == null) {
return;
}
appl->onKeyboard(_special,
@ -557,7 +557,7 @@ void gale::Context::OS_Hide() {
m_msgSystem.post([](gale::Context& _context){
/*
ememory::SharedPtr<gale::Application> appl = _context.getApplication();
if (appl == nullptr) {
if (appl == null) {
return;
}
appl->onKeyboard(_special,
@ -577,7 +577,7 @@ void gale::Context::OS_Show() {
m_msgSystem.post([](gale::Context& _context){
/*
ememory::SharedPtr<gale::Application> appl = _context.getApplication();
if (appl == nullptr) {
if (appl == null) {
return;
}
appl->onKeyboard(_special,
@ -600,7 +600,7 @@ void gale::Context::OS_ClipBoardArrive(enum gale::context::clipBoard::clipboardL
ethread::RecursiveLock lock(m_mutex);
m_msgSystem.post([_clipboardID](gale::Context& _context){
ememory::SharedPtr<gale::Application> appl = _context.getApplication();
if (appl != nullptr) {
if (appl != null) {
appl->onClipboardEvent(_clipboardID);
}
});
@ -665,7 +665,7 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
Release the event processing
*/
if (m_application != nullptr) {
if (m_application != null) {
// Redraw all needed elements
//GALE_DEBUG("Regenerate Display");
m_application->onRegenerateDisplay(*this);
@ -700,7 +700,7 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
m_FpsSystemContext.toc();
m_FpsSystem.tic();
}
if (m_application != nullptr) {
if (m_application != null) {
if( needRedraw == true
|| _displayEveryTime == true) {
m_FpsSystem.incrementCounter();
@ -763,7 +763,7 @@ void gale::Context::OS_OpenGlContextDestroy() {
}
void gale::Context::forceRedrawAll() {
if (m_application == nullptr) {
if (m_application == null) {
return;
}
m_application->onResize(m_windowsSize);
@ -773,7 +773,7 @@ void gale::Context::OS_Stop() {
// set the curent interface :
lockContext();
GALE_INFO("OS_Stop...");
if (m_application == nullptr) {
if (m_application == null) {
stop();
return;
}
@ -788,7 +788,7 @@ void gale::Context::OS_Suspend() {
GALE_INFO("OS_Suspend...");
m_previousDisplayTime = echrono::Steady();
#if 0
if (m_windowsCurrent != nullptr) {
if (m_windowsCurrent != null) {
m_windowsCurrent->onStateSuspend();
}
#endif
@ -803,7 +803,7 @@ void gale::Context::OS_Resume() {
m_previousDisplayTime = echrono::Steady::now();
// TODO : m_objectManager.timeCallResume(m_previousDisplayTime);
#if 0
if (m_windowsCurrent != nullptr) {
if (m_windowsCurrent != null) {
m_windowsCurrent->onStateResume();
}
#endif
@ -815,7 +815,7 @@ void gale::Context::OS_Foreground() {
lockContext();
GALE_INFO("OS_Foreground...");
#if 0
if (m_windowsCurrent != nullptr) {
if (m_windowsCurrent != null) {
m_windowsCurrent->onStateForeground();
}
#endif
@ -828,7 +828,7 @@ void gale::Context::OS_Background() {
lockContext();
GALE_INFO("OS_Background...");
#if 0
if (m_windowsCurrent != nullptr) {
if (m_windowsCurrent != null) {
m_windowsCurrent->onStateBackground();
}
#endif
@ -900,7 +900,7 @@ int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
// get the environement variable:
char * basicEnv = getenv("GALE_BACKEND");
if (nullptr != basicEnv) {
if (null != basicEnv) {
etk::String tmpVal = basicEnv;
//TODO : Check if it leak ...
#if defined(__TARGET_OS__Linux)
@ -1150,7 +1150,7 @@ int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
}
#endif
if (context == nullptr) {
if (context == null) {
GALE_ERROR("Can not allocate the interface of the GUI ...");
return -1;
}

View File

@ -52,7 +52,7 @@ namespace gale {
return m_resourceManager;
};
public:
Context(gale::Application* _application, int32_t _argc=0, const char* _argv[]=nullptr);
Context(gale::Application* _application, int32_t _argc=0, const char* _argv[]=null);
virtual ~Context();
/**
* @brief StartProcessing (2nd thread).
@ -66,7 +66,7 @@ namespace gale {
*/
void lockContext();
/**
* @brief set the curent interface at nullptr.
* @brief set the curent interface at null.
* @note this un-lock the main mutex
*/
void unLockContext();
@ -90,7 +90,7 @@ namespace gale {
void postAction(etk::Function<void(gale::Context& _context)> _action);
public:
virtual void setArchiveDir(int _mode, const char* _str, const char* _applName=nullptr);
virtual void setArchiveDir(int _mode, const char* _str, const char* _applName=null);
virtual void OS_SetInput(enum gale::key::type _type,
enum gale::key::status _status,

View File

@ -130,19 +130,19 @@ public:
};
MacOSInterface* interface = nullptr;
MacOSInterface* interface = null;
bool IOs::draw(bool _displayEveryTime) {
if (interface == nullptr) {
if (interface == null) {
return false;
}
return interface->MAC_Draw(_displayEveryTime);
}
void IOs::resize(float _x, float _y) {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->MAC_Resize(_x, _y);
@ -150,82 +150,82 @@ void IOs::resize(float _x, float _y) {
void IOs::setMouseState(int32_t _id, bool _isDown, float _x, float _y) {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->MAC_SetMouseState(_id, _isDown, _x, _y);
}
void IOs::setMouseMotion(int32_t _id, float _x, float _y) {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->MAC_SetMouseMotion(_id, _x, _y);
}
void IOs::setInputState(int32_t _id, bool _isDown, float _x, float _y) {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->MAC_SetInputState(_id, _isDown, _x, _y);
}
void IOs::setInputMotion(int32_t _id, float _x, float _y) {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->MAC_SetInputMotion(_id, _x, _y);
}
void IOs::setKeyboard(gale::key::Special _special, int32_t _unichar, bool _isDown, bool _isARepeateKey) {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->MAC_SetKeyboard(_special, _unichar, _isDown, _isARepeateKey);
}
void IOs::setKeyboardMove(gale::key::Special& _special, enum gale::key::keyboard _move, bool _isDown) {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->MAC_SetKeyboardMove(_special, _move, _isDown);
}
void IOs::start() {
if (interface == nullptr) {
if (interface == null) {
return;
}
//interface->OS_Start();
}
void IOs::resume() {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->OS_Resume();
}
void IOs::suspend() {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->OS_Suspend();
}
void IOs::stop() {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->OS_Stop();
}
void IOs::background() {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->OS_Background();
}
void IOs::foreground() {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->OS_Foreground();
@ -233,7 +233,7 @@ void IOs::foreground() {
static int l_argc = 0;
static const char **l_argv = nullptr;
static const char **l_argv = null;
static gale::Application* l_application;
/**
* @brief Main of the program
@ -252,19 +252,19 @@ void IOs::createInterface() {
etk::init(l_argc, l_argv);
GALE_INFO("Create new interface");
interface = ETK_NEW(MacOSInterface, l_application, l_argc, l_argv);
l_application = nullptr;
if (interface == nullptr) {
l_application = null;
if (interface == null) {
GALE_CRITICAL("Can not create the X11 interface ... MEMORY allocation error");
return;
}
}
void IOs::releaseInterface() {
if (interface != nullptr) {
if (interface != null) {
GALE_INFO("Remove interface");
}
ETK_DELETE(MacOSInterface, interface);
interface = nullptr;
interface = null;
}

View File

@ -37,7 +37,7 @@ bool gale::context::InputManager::localEventInput(enum gale::key::type _type,
int32_t _IdInput,
enum gale::key::status _status,
vec2 _pos) {
if (nullptr != _destApplication) {
if (null != _destApplication) {
if (_type == gale::key::typeMouse || _type == gale::key::typeFinger) {
// create the system Event :
gale::event::InputSystem tmpEventSystem(_type, _status, _IdInput, _pos, _destApplication, 0, m_specialKey); // TODO : set the real ID ...
@ -53,7 +53,7 @@ bool gale::context::InputManager::localEventInput(enum gale::key::type _type,
void gale::context::InputManager::abortElement(InputPoperty *_eventTable,
int32_t _idInput,
enum gale::key::type _type) {
if (nullptr == _eventTable) {
if (null == _eventTable) {
return;
}
if (_eventTable[_idInput].isUsed == true) {
@ -67,7 +67,7 @@ void gale::context::InputManager::abortElement(InputPoperty *_eventTable,
void gale::context::InputManager::cleanElement(InputPoperty *_eventTable,
int32_t _idInput) {
if (nullptr == _eventTable) {
if (null == _eventTable) {
return;
}
//GALE_INFO("CleanElement[" << idInput << "] = @" << (int64_t)eventTable);
@ -131,7 +131,7 @@ void gale::context::InputManager::motion(enum gale::key::type _type,
// reject pointer == > out of IDs...
return;
}
InputPoperty *eventTable = nullptr;
InputPoperty *eventTable = null;
if (_type == gale::key::typeMouse) {
eventTable = m_eventMouseSaved;
} else if (_type == gale::key::typeFinger) {
@ -151,11 +151,11 @@ void gale::context::InputManager::motion(enum gale::key::type _type,
// this event is all time on the good Application ... and manage the enter and leave ...
// NOTE : the "layer Application" force us to get the Application at the specific position all the time :
ememory::SharedPtr<gale::Application> tmpApplication;
if (m_grabApplication.lock() != nullptr) {
if (m_grabApplication.lock() != null) {
// grab all events ...
tmpApplication = m_grabApplication.lock();
} else {
if (nullptr != tmpWindows) {
if (null != tmpWindows) {
tmpApplication = tmpWindows->getApplicationAtPos(_pos);
}
}
@ -179,7 +179,7 @@ void gale::context::InputManager::motion(enum gale::key::type _type,
eventTable[_pointerID].isInside = true;
// get destination Application :
eventTable[_pointerID].curentApplicationEvent = tmpApplication;
if (tmpApplication == nullptr) {
if (tmpApplication == null) {
eventTable[_pointerID].isInside = false;
} else {
eventTable[_pointerID].origin = tmpApplication->getOrigin();
@ -262,7 +262,7 @@ void gale::context::InputManager::state(enum gale::key::type _type,
}
EVENT_DEBUG("event pointerId=" << _pointerID);
// convert position in open-GL coordonates ...
InputPoperty *eventTable = nullptr;
InputPoperty *eventTable = null;
InputLimit localLimit;
if (_type == gale::key::typeMouse) {
eventTable = m_eventMouseSaved;
@ -320,8 +320,8 @@ void gale::context::InputManager::state(enum gale::key::type _type,
eventTable[_pointerID].isInside = true;
ememory::SharedPtr<gale::Application> tmpApplication = m_grabApplication.lock();
// get destination Application :
if(nullptr != tmpWindows) {
if ( tmpApplication != nullptr
if(null != tmpWindows) {
if ( tmpApplication != null
&& _type == gale::key::typeMouse) {
eventTable[_pointerID].curentApplicationEvent = tmpApplication;
} else {
@ -331,7 +331,7 @@ void gale::context::InputManager::state(enum gale::key::type _type,
eventTable[_pointerID].curentApplicationEvent.reset();
}
tmpApplication = eventTable[_pointerID].curentApplicationEvent.lock();
if (tmpApplication != nullptr) {
if (tmpApplication != null) {
eventTable[_pointerID].origin = tmpApplication->getOrigin();
eventTable[_pointerID].size = tmpApplication->getSize();
eventTable[_pointerID].destinationInputId = localGetDestinationId(_type, tmpApplication, _pointerID);
@ -381,14 +381,14 @@ void gale::context::InputManager::state(enum gale::key::type _type,
// save start time
eventTable[_pointerID].lastTimeEvent = currentTime;
int32_t nbClickMax = 0;
if(tmpApplication != nullptr) {
if(tmpApplication != null) {
nbClickMax = tmpApplication->getMouseLimit();
if (nbClickMax>5) {
nbClickMax = 5;
}
}
// in grab mode the single to quinte event are not generated ....
if( ( m_grabApplication.lock() == nullptr
if( ( m_grabApplication.lock() == null
|| _type != gale::key::typeMouse )
&& eventTable[_pointerID].nbClickEvent < nbClickMax) {
// generate event SINGLE :

View File

@ -143,20 +143,20 @@ class MacOSInterface : public gale::Context {
};
MacOSInterface* interface = nullptr;
MacOSInterface* interface = null;
bool MacOs::draw(bool _displayEveryTime) {
GALE_VERBOSE("draw request " << uint64_t(interface) << " " << _displayEveryTime);
if (interface == nullptr) {
if (interface == null) {
return false;
}
return interface->MAC_Draw(_displayEveryTime);
}
void MacOs::resize(float _x, float _y) {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->MAC_Resize(_x, _y);
@ -164,42 +164,42 @@ void MacOs::resize(float _x, float _y) {
void MacOs::setMouseState(int32_t _id, bool _isDown, float _x, float _y) {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->MAC_SetMouseState(_id, _isDown, _x, _y);
}
void MacOs::setMouseMotion(int32_t _id, float _x, float _y) {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->MAC_SetMouseMotion(_id, _x, _y);
}
void MacOs::setKeyboard(gale::key::Special _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey) {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->MAC_SetKeyboard(_keyboardMode, _unichar, _isDown, _isAReapeateKey);
}
void MacOs::setKeyboardMove(gale::key::Special& _keyboardMode, enum gale::key::keyboard _move, bool _isDown, bool _isAReapeateKey) {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->MAC_SetKeyboardMove(_keyboardMode, _move, _isDown, _isAReapeateKey);
}
void MacOs::stopRequested() {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->MAC_Stop();
}
/*
void MacOs::setRedrawCallback(const etk::Function<void()>& _func) {
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->getWidgetManager().setCallbackonRedrawNeeded(_func);

View File

@ -268,7 +268,7 @@ class GLUTInterface : public gale::Context {
}
};
GLUTInterface* g_interface = nullptr;
GLUTInterface* g_interface = null;
static void gale_glut_idle() {
glutPostRedisplay();

View File

@ -29,7 +29,7 @@ static etk::String GetLastErrorAsString() {
if(errorMessageID == 0) {
return etk::String(); //No error message has been recorded
}
LPSTR messageBuffer = nullptr;
LPSTR messageBuffer = null;
size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL);
etk::String message(messageBuffer, size);
@ -40,7 +40,7 @@ static etk::String GetLastErrorAsString() {
class WindowsContext;
// This is a bad hook to get the wurrent windows pointer (it is unique ...):
static WindowsContext * galeWindowsContext = nullptr;
static WindowsContext * galeWindowsContext = null;
// Window Procedure
static LRESULT CALLBACK WndProc(HWND _hWnd, UINT _message, WPARAM _wParam, LPARAM _lParam);
@ -62,7 +62,7 @@ class WindowsContext : public gale::Context {
gale::Context(_application, _argc, _argv),
m_run(true),
m_clipBoardOwnerStd(false),
m_hInstance(GetModuleHandle(nullptr)),
m_hInstance(GetModuleHandle(null)),
m_hWnd(0),
m_hDC(0),
m_hRC(0) {
@ -75,7 +75,7 @@ class WindowsContext : public gale::Context {
}
~WindowsContext() {
galeWindowsContext = nullptr;
galeWindowsContext = null;
release();
}
@ -118,12 +118,12 @@ class WindowsContext : public gale::Context {
, // The style of the window being created.
10, 10, // start position
800, 600, // start size
nullptr, // A handle to the parent or owner window of the window being created
nullptr, // A handle to a menu, or specifies a child-window identifier, depending on the window style
null, // A handle to the parent or owner window of the window being created
null, // A handle to a menu, or specifies a child-window identifier, depending on the window style
m_hInstance, // A handle to the instance of the module to be associated with the window.
nullptr //A pointer to a value to be passed to the window through the CREATESTRUCT structure
null //A pointer to a value to be passed to the window through the CREATESTRUCT structure
);
if(m_hWnd == nullptr) {
if(m_hWnd == null) {
GALE_ERROR("Can not create windows '" << GetLastErrorAsString() << "'" );
MessageBox(m_hWnd, "Error creating window\n(gale internal error #45211)", "Error", MB_ICONEXCLAMATION);
PostQuitMessage(0);
@ -177,7 +177,7 @@ class WindowsContext : public gale::Context {
// program main loop
while(m_run == true) {
// check for messages
if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
if (PeekMessage(&msg, null, 0, 0, PM_REMOVE)) {
// handle or dispatch messages
if (msg.message == WM_QUIT) {
m_run = false;
@ -233,7 +233,7 @@ class WindowsContext : public gale::Context {
case gale::context::clipBoard::clipboardStd:
// TODO : never done reset at false ...
if (m_clipBoardOwnerStd == false) {
char* buffer = nullptr;
char* buffer = null;
if(OpenClipboard(m_hWnd)) {
buffer = (char*)GetClipboardData(CF_TEXT);
etk::String tmpppp((char*)buffer);
@ -304,7 +304,7 @@ class WindowsContext : public gale::Context {
// create and enable the render context(RC)
*_hRC = wglCreateContext(*_hDC);
wglMakeCurrent(*_hDC, *_hRC);
if (wglGetCurrentContext() == nullptr) {
if (wglGetCurrentContext() == null) {
GALE_ERROR("can not create OPEN gL context...");
MessageBox(_hWnd, "Error initilizing open GL\n openGL context creation error...\n(gale internal error #3526)", "Error", MB_ICONEXCLAMATION);
PostQuitMessage(0);
@ -314,7 +314,7 @@ class WindowsContext : public gale::Context {
// disable openGL (fisnish application ...
void disableOpenGL(HWND _hWnd, HDC _hDC, HGLRC _hRC) {
wglMakeCurrent(nullptr, nullptr);
wglMakeCurrent(null, null);
wglDeleteContext(_hRC);
ReleaseDC(_hWnd, _hDC);
}
@ -359,7 +359,7 @@ class WindowsContext : public gale::Context {
*/
case WM_WINDOWPOSCHANGING: {
WINDOWPOS* tmpVal = (WINDOWPOS*)_lParam;
if (tmpVal == nullptr) {
if (tmpVal == null) {
break;
}
GALE_VERBOSE("WM_WINDOWPOSCHANGING : : (" << tmpVal->x << "," << tmpVal->y << ") ( " << tmpVal->cx << "," << tmpVal->cy << ")");
@ -620,7 +620,7 @@ class WindowsContext : public gale::Context {
static LRESULT CALLBACK WndProc(HWND _hWnd, UINT _message, WPARAM _wParam, LPARAM _lParam) {
// TODO : set this function really work...
if (galeWindowsContext == nullptr) {
if (galeWindowsContext == null) {
return 0;
}
return galeWindowsContext->WndProcReal(_hWnd, _message, _wParam, _lParam);

View File

@ -270,11 +270,11 @@ class X11Interface : public gale::Context {
{
XSelectionRequestEvent *req=&(event.xselectionrequest);
if (req->property == 0) {
GALE_ERROR("Get nullptr ATOM ... property");
GALE_ERROR("Get null ATOM ... property");
break;
}
if (req->target == 0) {
GALE_ERROR("Get nullptr ATOM ... target");
GALE_ERROR("Get null ATOM ... target");
break;
}
char * atomNameProperty = XGetAtomName(m_display, req->property);
@ -339,15 +339,15 @@ class X11Interface : public gale::Context {
#ifdef DEBUG_X11_EVENT
{
if (req->property == NULL) {
GALE_ERROR("Get nullptr ATOM ... property");
GALE_ERROR("Get null ATOM ... property");
break;
}
if (req->selection == NULL) {
GALE_ERROR("Get nullptr ATOM ... selection");
GALE_ERROR("Get null ATOM ... selection");
break;
}
if (req->target == NULL) {
GALE_ERROR("Get nullptr ATOM ... target");
GALE_ERROR("Get null ATOM ... target");
break;
}
char * atomNameProperty = XGetAtomName(m_display, req->property);
@ -1342,7 +1342,7 @@ class X11Interface : public gale::Context {
}
if ( m_display == NULL
|| m_visual == NULL) {
GALE_ERROR("X11 Can not create Image Icon ==> nullptr on m_display or m_visual");
GALE_ERROR("X11 Can not create Image Icon ==> null on m_display or m_visual");
return;
}
XImage* myImage = XCreateImage(m_display,
@ -1419,7 +1419,7 @@ class X11Interface : public gale::Context {
// Note when we free the pixmap ... the icon is removed ... == > this is a real memory leek ...
//XFreePixmap(m_display, tmpPixmap);
myImage->data = nullptr;
myImage->data = null;
XDestroyImage(myImage);
#endif
}

View File

@ -50,7 +50,7 @@ int64_t guiInterface::getTime() {
int ret = clock_gettime(CLOCK_REALTIME, &now);
if (ret != 0) {
// Error to get the time ...
now.tv_sec = time(nullptr);
now.tv_sec = time(null);
now.tv_nsec = 0;
}
//GALE_VERBOSE("current time : " << now.tv_sec << "s " << now.tv_usec << "us");
@ -66,16 +66,16 @@ bool m_grabAllEvent = false;
// the super interface
IDirectFB *dfb = nullptr;
IDirectFB *dfb = null;
// the primary surface (surface of primary layer)
IDirectFBSurface *primary = nullptr;
IDirectFBSurface *primary = null;
// the GL context
IDirectFBGL *primary_gl = nullptr;
IDirectFBGL *primary_gl = null;
// event buffer
IDirectFBEventBuffer *events = nullptr;
IDirectFBEventBuffer *events = null;
static int screen_width =800;
static int screen_height = 600;
@ -147,7 +147,7 @@ void DirectFB_Init(int argc, const char *argv[]) {
primary->setDstBlendFunction(primary, DSBF_SRCALPHA);
primary->setDrawingFlags(primary, DSDRAW_BLEND);
primary->Blit(primary, primary, nullptr, 0, 0);
primary->Blit(primary, primary, null, 0, 0);
GALE_INFO("call getSize");
@ -170,7 +170,7 @@ void DirectFB_Init(int argc, const char *argv[]) {
}
GALE_INFO("call Flip");
primary->Flip(primary, nullptr, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC);
primary->Flip(primary, null, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC);
// NOTE : we need to force it on X11 display ...
GALE_INFO("call getGL");
@ -207,7 +207,7 @@ void DirectFB_Run() {
primary->FillRectangle(primary, 0, 0, screen_width, screen_height);
primary->setColor (primary, 0xFF, (uint8_t)position, 0x00, 0xFF);
primary->FillRectangle(primary, position, position, 300, 300);
primary->Flip(primary, nullptr, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC);
primary->Flip(primary, null, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC);
position++;
if (position>600) {
position = 0;
@ -229,7 +229,7 @@ void DirectFB_Run() {
GALE_ERROR("primary_gl->Unlock");
DirectFBErrorFatal("primary_gl->Unlock", err);
}
primary->Flip(primary, nullptr, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC);
primary->Flip(primary, null, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC);
}
while (events->getEvent(events, DFB_EVENT(&evt)) == DFB_OK) {

View File

@ -179,7 +179,7 @@ static void data_offer_destroy(struct data_offer* _offer) {
}
wl_array_release(&_offer->types);
free(_offer);
_offer = nullptr;
_offer = null;
}
}
@ -270,33 +270,33 @@ class WAYLANDInterface : public gale::Context {
m_opaque(false),
m_cursorCurrent(gale::context::cursor::leftArrow),
m_lastKeyPressed(0),
m_display(nullptr),
m_registry(nullptr),
m_compositor(nullptr),
m_shell(nullptr),
m_seat(nullptr),
m_pointer(nullptr),
m_keyboard(nullptr),
m_shm(nullptr),
m_cursorTheme(nullptr),
m_cursorDefault(nullptr),
m_cursorSurface(nullptr),
m_eglWindow(nullptr),
m_surface(nullptr),
m_shellSurface(nullptr),
m_callback(nullptr),
m_dataDeviceManager(nullptr),
m_display(null),
m_registry(null),
m_compositor(null),
m_shell(null),
m_seat(null),
m_pointer(null),
m_keyboard(null),
m_shm(null),
m_cursorTheme(null),
m_cursorDefault(null),
m_cursorSurface(null),
m_eglWindow(null),
m_surface(null),
m_shellSurface(null),
m_callback(null),
m_dataDeviceManager(null),
m_dataDeviceManagerVersion(0),
m_dataDevice(nullptr),
m_dataDevice(null),
m_serial(0),
m_offerIsInside(false),
m_offerInternalCopy(false),
m_offerCopy(nullptr),
m_dataSource(nullptr)
m_offerCopy(null),
m_dataSource(null)
#ifdef GALE_XKB_WRAPPER_INPUT
,m_XKBContext(nullptr),
m_XKBKeymap(nullptr),
m_XKBState(nullptr)
,m_XKBContext(null),
m_XKBKeymap(null),
m_XKBState(null)
#endif
{
// in case ...
@ -307,11 +307,11 @@ class WAYLANDInterface : public gale::Context {
int i, ret = 0;
#ifdef GALE_XKB_WRAPPER_INPUT
m_XKBContext = xkb_context_new(XKB_CONTEXT_NO_DEFAULT_INCLUDES);
if (m_XKBContext == nullptr) {
if (m_XKBContext == null) {
GALE_CRITICAL("Couldn't create xkb context");
}
#endif
m_display = wl_display_connect(nullptr);
m_display = wl_display_connect(null);
assert(m_display);
m_registry = wl_display_get_registry(m_display);
@ -335,46 +335,46 @@ class WAYLANDInterface : public gale::Context {
~WAYLANDInterface() {
#ifdef GALE_XKB_WRAPPER_INPUT
if (m_XKBState != nullptr) {
if (m_XKBState != null) {
xkb_state_unref(m_XKBState);
m_XKBState = nullptr;
m_XKBState = null;
}
if (m_XKBKeymap != nullptr) {
if (m_XKBKeymap != null) {
xkb_keymap_unref(m_XKBKeymap);
m_XKBKeymap = nullptr;
m_XKBKeymap = null;
}
if (m_XKBContext != nullptr) {
if (m_XKBContext != null) {
xkb_context_unref(m_XKBContext);
m_XKBContext = nullptr;
m_XKBContext = null;
}
#endif
destroySurface();
unInitEgl();
wl_surface_destroy(m_cursorSurface);
if (m_cursorTheme != nullptr) {
if (m_cursorTheme != null) {
wl_cursor_theme_destroy(m_cursorTheme);
m_cursorTheme = nullptr;
m_cursorTheme = null;
}
if (m_shell != nullptr) {
if (m_shell != null) {
wl_shell_destroy(m_shell);
m_shell = nullptr;
m_shell = null;
}
if (m_compositor != nullptr) {
if (m_compositor != null) {
wl_compositor_destroy(m_compositor);
m_compositor = nullptr;
m_compositor = null;
}
if (m_dataDeviceManager != nullptr) {
if (m_dataDeviceManager != null) {
wl_data_device_manager_destroy(m_dataDeviceManager);
m_dataDeviceManager = nullptr;
m_dataDeviceManager = null;
}
if (m_registry != nullptr) {
if (m_registry != null) {
wl_registry_destroy(m_registry);
m_registry = nullptr;
m_registry = null;
}
if (m_display != nullptr) {
if (m_display != null) {
wl_display_flush(m_display);
wl_display_disconnect(m_display);
m_display = nullptr;
m_display = null;
}
}
/****************************************************************************************/
@ -423,7 +423,7 @@ class WAYLANDInterface : public gale::Context {
EGLBoolean ret = eglChooseConfig(m_eglDisplay, config_attribs, &m_eglConfig, 1, &nnn);
/*
EGLint count = 0;
eglGetConfigs(m_egl_display, nullptr, 0, &count);
eglGetConfigs(m_egl_display, null, 0, &count);
GALE_INFO("EGL has " << count << " configs");
EGLConfig* configs = (EGLConfig*)calloc(count, sizeof *configs);
GALE_INFO("Display all configs:");
@ -459,7 +459,7 @@ class WAYLANDInterface : public gale::Context {
m_shellSurface = wl_shell_get_shell_surface(m_shell, m_surface);
wl_shell_surface_add_listener(m_shellSurface, &shell_surface_listener, this);
m_eglWindow = wl_egl_window_create(m_surface, m_size.x(), m_size.y());
m_eglSurface = eglCreateWindowSurface(m_eglDisplay, m_eglConfig, m_eglWindow, nullptr);
m_eglSurface = eglCreateWindowSurface(m_eglDisplay, m_eglConfig, m_eglWindow, null);
wl_shell_surface_set_title(m_shellSurface, m_uniqueWindowsName.c_str());
ret = eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
assert(ret == EGL_TRUE);
@ -482,7 +482,7 @@ class WAYLANDInterface : public gale::Context {
GALE_INFO("toggleFullscreen [START]");
m_configured = false;
if (m_fullscreen) {
wl_shell_surface_set_fullscreen(m_shellSurface, WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, nullptr);
wl_shell_surface_set_fullscreen(m_shellSurface, WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 0, null);
} else {
wl_shell_surface_set_toplevel(m_shellSurface);
handleConfigure(m_shellSurface, 0, m_size);
@ -504,7 +504,7 @@ class WAYLANDInterface : public gale::Context {
} else if (strcmp(_interface, "wl_seat") == 0) {
m_seat = (struct wl_seat*)wl_registry_bind(_registry, _id, &wl_seat_interface, 1);
wl_seat_add_listener(m_seat, &seat_listener, this);
if (m_dataDeviceManager != nullptr) {
if (m_dataDeviceManager != null) {
m_dataDevice = wl_data_device_manager_get_data_device(m_dataDeviceManager, m_seat);
wl_data_device_add_listener(m_dataDevice, &data_device_listener, this);
m_dataSource = wl_data_device_manager_create_data_source(m_dataDeviceManager);
@ -512,8 +512,8 @@ class WAYLANDInterface : public gale::Context {
}
} else if (strcmp(_interface, "wl_shm") == 0) {
m_shm = (struct wl_shm*)wl_registry_bind(_registry, _id, &wl_shm_interface, 1);
m_cursorTheme = wl_cursor_theme_load(nullptr, 32, m_shm);
if (m_cursorTheme != nullptr) {
m_cursorTheme = wl_cursor_theme_load(null, 32, m_shm);
if (m_cursorTheme != null) {
m_cursorDefault = wl_cursor_theme_get_cursor(m_cursorTheme, "left_ptr");
} else {
GALE_WARNING("Can not get the generic theme");
@ -541,7 +541,7 @@ class WAYLANDInterface : public gale::Context {
} else if (!(_caps & WL_SEAT_CAPABILITY_POINTER) && m_pointer) {
GALE_DEBUG("Display has No more pointer");
wl_pointer_destroy(m_pointer);
m_pointer = nullptr;
m_pointer = null;
}
if ((_caps & WL_SEAT_CAPABILITY_KEYBOARD) && !m_keyboard) {
GALE_DEBUG("Display has a keyboard");
@ -549,15 +549,15 @@ class WAYLANDInterface : public gale::Context {
wl_keyboard_add_listener(m_keyboard, &keyboard_listener, this);
} else if (!(_caps & WL_SEAT_CAPABILITY_KEYBOARD) && m_keyboard) {
wl_keyboard_destroy(m_keyboard);
m_keyboard = nullptr;
m_keyboard = null;
#ifdef GALE_XKB_WRAPPER_INPUT
if (m_XKBState != nullptr) {
if (m_XKBState != null) {
xkb_state_unref(m_XKBState);
m_XKBState = nullptr;
m_XKBState = null;
}
if (m_XKBKeymap != nullptr) {
if (m_XKBKeymap != null) {
xkb_keymap_unref(m_XKBKeymap);
m_XKBKeymap = nullptr;
m_XKBKeymap = null;
}
#endif
}
@ -577,7 +577,7 @@ class WAYLANDInterface : public gale::Context {
struct wl_cursor_image *image;
if (m_fullscreen == true) {
wl_pointer_set_cursor(_pointer, _serial, nullptr, 0, 0);
wl_pointer_set_cursor(_pointer, _serial, null, 0, 0);
} else if (cursor) {
image = m_cursorDefault->images[0];
buffer = wl_cursor_image_get_buffer(image);
@ -668,7 +668,7 @@ class WAYLANDInterface : public gale::Context {
void redraw(struct wl_callback* _callback, uint32_t _time) {
assert(m_callback == _callback);
m_callback = nullptr;
m_callback = null;
if (_callback) {
wl_callback_destroy(_callback);
}
@ -684,7 +684,7 @@ class WAYLANDInterface : public gale::Context {
wl_surface_set_opaque_region(m_surface, region);
wl_region_destroy(region);
} else {
wl_surface_set_opaque_region(m_surface, nullptr);
wl_surface_set_opaque_region(m_surface, null);
}
m_callback = wl_surface_frame(m_surface);
wl_callback_add_listener(m_callback, &frame_listener, this);
@ -694,9 +694,9 @@ class WAYLANDInterface : public gale::Context {
void configureCallback(struct wl_callback* _callback, uint32_t _time) {
wl_callback_destroy(_callback);
m_configured = true;
if (m_callback == nullptr) {
GALE_ERROR(" ==> nullptr");
redraw(nullptr, _time);
if (m_callback == null) {
GALE_ERROR(" ==> null");
redraw(null, _time);
}
}
@ -708,7 +708,7 @@ class WAYLANDInterface : public gale::Context {
void handleConfigure(struct wl_shell_surface* _shell_surface, uint32_t _edges, ivec2 _size) {
GALE_WARNING("configure surface : _edges=" << _edges << " size=" << _size);
if (m_eglWindow != nullptr) {
if (m_eglWindow != null) {
wl_egl_window_resize(m_eglWindow, _size.x(), _size.y(), 0, 0);
}
m_size = _size;
@ -730,7 +730,7 @@ class WAYLANDInterface : public gale::Context {
}
#ifdef GALE_XKB_WRAPPER_INPUT
void *buf;
buf = mmap(nullptr, _size, PROT_READ, MAP_SHARED, _fd, 0);
buf = mmap(null, _size, PROT_READ, MAP_SHARED, _fd, 0);
if (buf == MAP_FAILED) {
GALE_ERROR("Failed to mmap keymap: " << errno);
close(_fd);
@ -822,7 +822,7 @@ class WAYLANDInterface : public gale::Context {
void keyboardKey(struct wl_keyboard* _keyboard, uint32_t _serial, uint32_t _time, uint32_t _key, bool _isDown) {
#if 0
if (_isDown == true) {
test_print_keycode_state(m_XKBState, nullptr, _key + 8, XKB_CONSUMED_MODE_GTK);
test_print_keycode_state(m_XKBState, null, _key + 8, XKB_CONSUMED_MODE_GTK);
/* Exit on ESC. */
if (xkb_state_key_get_one_sym(m_XKBState, _key + 8) == XKB_KEY_Escape) {
m_run = false;
@ -1052,13 +1052,13 @@ class WAYLANDInterface : public gale::Context {
} else {
m_offerInternalCopy = false;
}
if (m_offerCopy != nullptr) {
if (m_offerCopy != null) {
//data_offer_destroy(m_offerCopy);
wl_data_offer_destroy(m_offerCopy);
m_offerCopy = nullptr;
m_offerCopy = null;
}
if (_offer == nullptr) {
GALE_ERROR(" nullptr offer");
if (_offer == null) {
GALE_ERROR(" null offer");
} else {
m_offerCopy = _offer;
wl_data_offer_add_listener(_offer, &data_offer_listener, this);
@ -1085,7 +1085,7 @@ class WAYLANDInterface : public gale::Context {
if (offer) {
input->drag_offer = wl_data_offer_get_user_data(offer);
p = wl_array_add(&input->drag_offer->types, sizeof *p);
*p = nullptr;
*p = null;
types_data = input->drag_offer->types.data;
if (input->display->data_device_manager_version >= WL_DATA_OFFER_SET_ACTIONS_SINCE_VERSION) {
wl_data_offer_set_actions(offer,
@ -1094,8 +1094,8 @@ class WAYLANDInterface : public gale::Context {
WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE);
}
} else {
input->drag_offer = nullptr;
types_data = nullptr;
input->drag_offer = null;
types_data = null;
}
if (window->data_handler) {
window->data_handler(window, input, x, y, types_data, window->user_data);
@ -1109,7 +1109,7 @@ class WAYLANDInterface : public gale::Context {
struct input *input = data;
if (input->drag_offer) {
data_offer_destroy(input->drag_offer);
input->drag_offer = nullptr;
input->drag_offer = null;
}
*/
}
@ -1127,7 +1127,7 @@ class WAYLANDInterface : public gale::Context {
if (input->drag_offer) {
types_data = input->drag_offer->types.data;
} else {
types_data = nullptr;
types_data = null;
}
if (window->data_handler) {
window->data_handler(window, input, x, y, types_data, window->user_data);
@ -1262,7 +1262,7 @@ class WAYLANDInterface : public gale::Context {
return;
}
m_cursorCurrent = _newCursor;
if (m_cursorTheme == nullptr) {
if (m_cursorTheme == null) {
GALE_WARNING("WAYLAND-API: set New Cursor : " << _newCursor << " missing acces on theme ...");
return;
}
@ -1500,7 +1500,7 @@ class WAYLANDInterface : public gale::Context {
}
// allocate a WM hints structure.
XWMHints* win_hints = XAllocWMHints();
if (win_hints == nullptr) {
if (win_hints == null) {
GALE_ERROR("XAllocWMHints - out of memory");
return;
}
@ -1517,7 +1517,7 @@ class WAYLANDInterface : public gale::Context {
// Note when we free the pixmap ... the icon is removed ... == > this is a real memory leek ...
//XFreePixmap(m_display, tmpPixmap);
myImage->data = nullptr;
myImage->data = null;
XDestroyImage(myImage);
#endif
*/
@ -1526,7 +1526,7 @@ class WAYLANDInterface : public gale::Context {
void setTitle(const etk::String& _title) {
WAYLAND_INFO("WAYLAND: set Title (START)");
m_uniqueWindowsName = _title;
if (m_shellSurface == nullptr) {
if (m_shellSurface == null) {
GALE_ERROR("WAYLAND: set Title (END) ==> missing surface pointer");
return;
}
@ -1541,7 +1541,7 @@ class WAYLANDInterface : public gale::Context {
}
bool dataPaste() {
GALE_VERBOSE("Request PAST ...");
if(m_offerCopy == nullptr) {
if(m_offerCopy == null) {
return false;
}
GALE_VERBOSE("Request PAST .2.");
@ -1622,13 +1622,13 @@ class WAYLANDInterface : public gale::Context {
// Request the clipBoard:
GALE_VERBOSE("Request copy ...");
// Destroy any existing data source
if (m_dataSource != nullptr) {
if (m_dataSource != null) {
wl_data_source_destroy(m_dataSource);
m_dataSource = nullptr;
m_dataSource = null;
}
// try to create a new data source
m_dataSource = wl_data_device_manager_create_data_source(m_dataDeviceManager);
if (m_dataSource == nullptr) {
if (m_dataSource == null) {
GALE_ERROR("Can not create the data source interface");
return;
}
@ -1654,8 +1654,8 @@ class WAYLANDInterface : public gale::Context {
static void global_registry_handler(void* _data, struct wl_registry* _registry, uint32_t _id, const char* _interface, uint32_t _version) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
GALE_ERROR(" ==> nullptr");
if (interface == null) {
GALE_ERROR(" ==> null");
return;
}
interface->registryHandler(_registry, _id, _interface, _version);
@ -1663,8 +1663,8 @@ static void global_registry_handler(void* _data, struct wl_registry* _registry,
static void global_registry_remover(void* _data, struct wl_registry* _registry, uint32_t _id) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
GALE_ERROR(" ==> nullptr");
if (interface == null) {
GALE_ERROR(" ==> null");
return;
}
interface->registryRemover(_registry, _id);
@ -1672,8 +1672,8 @@ static void global_registry_remover(void* _data, struct wl_registry* _registry,
static void seat_handle_capabilities(void* _data, struct wl_seat* _seat, uint32_t _caps) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
GALE_ERROR(" ==> nullptr");
if (interface == null) {
GALE_ERROR(" ==> null");
return;
}
interface->seatHandleCapabilities(_seat, (enum wl_seat_capability)_caps);
@ -1681,8 +1681,8 @@ static void seat_handle_capabilities(void* _data, struct wl_seat* _seat, uint32_
static void pointer_handle_enter(void* _data, struct wl_pointer* _pointer, uint32_t _serial, struct wl_surface* _surface, wl_fixed_t _sx, wl_fixed_t _sy) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
GALE_ERROR(" ==> nullptr");
if (interface == null) {
GALE_ERROR(" ==> null");
return;
}
interface->pointerHandleEnter(_pointer, _serial, _surface, ivec2(_sx, _sy));
@ -1690,8 +1690,8 @@ static void pointer_handle_enter(void* _data, struct wl_pointer* _pointer, uint3
static void pointer_handle_leave(void* _data, struct wl_pointer* _pointer, uint32_t _serial, struct wl_surface* _surface) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
GALE_ERROR(" ==> nullptr");
if (interface == null) {
GALE_ERROR(" ==> null");
return;
}
interface->pointerHandleLeave(_pointer, _serial, _surface);
@ -1699,8 +1699,8 @@ static void pointer_handle_leave(void* _data, struct wl_pointer* _pointer, uint3
static void pointer_handle_motion(void* _data, struct wl_pointer* _pointer, uint32_t _time, wl_fixed_t _sx, wl_fixed_t _sy) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
GALE_ERROR(" ==> nullptr");
if (interface == null) {
GALE_ERROR(" ==> null");
return;
}
interface->pointerHandleMotion(_pointer, _time, ivec2(_sx/256, _sy/256));
@ -1708,8 +1708,8 @@ static void pointer_handle_motion(void* _data, struct wl_pointer* _pointer, uint
static void pointer_handle_button(void* _data, struct wl_pointer* _pointer, uint32_t _serial, uint32_t _time, uint32_t _button, uint32_t _state) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
GALE_ERROR(" ==> nullptr");
if (interface == null) {
GALE_ERROR(" ==> null");
return;
}
interface->pointerHandleButton(_pointer,
@ -1721,8 +1721,8 @@ static void pointer_handle_button(void* _data, struct wl_pointer* _pointer, uint
static void pointer_handle_axis(void* _data, struct wl_pointer* _pointer, uint32_t _time, uint32_t _axis, wl_fixed_t _value) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
GALE_ERROR(" ==> nullptr");
if (interface == null) {
GALE_ERROR(" ==> null");
return;
}
interface->pointerHandleAxis(_pointer, _time, _axis, _value);
@ -1730,8 +1730,8 @@ static void pointer_handle_axis(void* _data, struct wl_pointer* _pointer, uint32
static void redraw(void* _data, struct wl_callback* _callback, uint32_t _time) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
GALE_ERROR(" ==> nullptr");
if (interface == null) {
GALE_ERROR(" ==> null");
return;
}
interface->redraw(_callback, _time);
@ -1739,8 +1739,8 @@ static void redraw(void* _data, struct wl_callback* _callback, uint32_t _time) {
static void configure_callback(void* _data, struct wl_callback* _callback, uint32_t _time) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
GALE_ERROR(" ==> nullptr");
if (interface == null) {
GALE_ERROR(" ==> null");
return;
}
interface->configureCallback(_callback, _time);
@ -1748,8 +1748,8 @@ static void configure_callback(void* _data, struct wl_callback* _callback, uint3
static void handle_ping(void* _data, struct wl_shell_surface* _shellSurface, uint32_t _serial) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
GALE_ERROR(" ==> nullptr");
if (interface == null) {
GALE_ERROR(" ==> null");
return;
}
interface->handlePing(_shellSurface, _serial);
@ -1757,8 +1757,8 @@ static void handle_ping(void* _data, struct wl_shell_surface* _shellSurface, uin
static void handle_configure(void* _data, struct wl_shell_surface* _shellSurface, uint32_t _edges, int32_t _width, int32_t _height) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
GALE_ERROR(" ==> nullptr");
if (interface == null) {
GALE_ERROR(" ==> null");
return;
}
interface->handleConfigure(_shellSurface, _edges, ivec2(_width-1, _height));
@ -1766,7 +1766,7 @@ static void handle_configure(void* _data, struct wl_shell_surface* _shellSurface
static void handle_popup_done(void* _data, struct wl_shell_surface* _shellSurface) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->handlePopupDone(_shellSurface);
@ -1774,7 +1774,7 @@ static void handle_popup_done(void* _data, struct wl_shell_surface* _shellSurfac
static void keyboard_handle_keymap(void* _data, struct wl_keyboard* _keyboard, uint32_t _format, int _fd, uint32_t _size) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->keyboardKeymap(_keyboard, (enum wl_keyboard_keymap_format)_format, _fd, _size);
@ -1782,7 +1782,7 @@ static void keyboard_handle_keymap(void* _data, struct wl_keyboard* _keyboard, u
static void keyboard_handle_enter(void* _data, struct wl_keyboard* _keyboard, uint32_t _serial, struct wl_surface* _surface, struct wl_array* _keys) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->keyboardEnter(_keyboard, _serial, _surface, _keys);
@ -1790,7 +1790,7 @@ static void keyboard_handle_enter(void* _data, struct wl_keyboard* _keyboard, ui
static void keyboard_handle_leave(void* _data, struct wl_keyboard* _keyboard, uint32_t _serial, struct wl_surface* _surface) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->keyboardLeave(_keyboard, _serial, _surface);
@ -1798,7 +1798,7 @@ static void keyboard_handle_leave(void* _data, struct wl_keyboard* _keyboard, ui
static void keyboard_handle_key(void* _data, struct wl_keyboard* _keyboard, uint32_t _serial, uint32_t _time, uint32_t _key, uint32_t _state) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->keyboardKey(_keyboard,
@ -1810,7 +1810,7 @@ static void keyboard_handle_key(void* _data, struct wl_keyboard* _keyboard, uint
static void keyboard_handle_modifiers(void* _data, struct wl_keyboard* _keyboard, uint32_t _serial, uint32_t _modsDepressed, uint32_t _modsLatched, uint32_t _modsLocked, uint32_t _group) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->keyboardModifiers(_keyboard, _serial, _modsDepressed, _modsLatched, _modsLocked, _group);
@ -1818,7 +1818,7 @@ static void keyboard_handle_modifiers(void* _data, struct wl_keyboard* _keyboard
static void data_device_data_offer(void* _data, struct wl_data_device* _data_device, struct wl_data_offer* _offer) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->dataDeviceDataOffer(_data_device, _offer);
@ -1826,7 +1826,7 @@ static void data_device_data_offer(void* _data, struct wl_data_device* _data_dev
static void data_device_enter(void* _data, struct wl_data_device* _data_device, uint32_t _serial, struct wl_surface* _surface, wl_fixed_t _x_w, wl_fixed_t _y_w, struct wl_data_offer* _offer) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->dataDeviceEnter(_data_device, _serial, _surface, vec2(_x_w,_y_w), _offer);
@ -1834,7 +1834,7 @@ static void data_device_enter(void* _data, struct wl_data_device* _data_device,
static void data_device_leave(void* _data, struct wl_data_device* _data_device) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->dataDeviceLeave(_data_device);
@ -1842,7 +1842,7 @@ static void data_device_leave(void* _data, struct wl_data_device* _data_device)
static void data_device_motion(void* _data, struct wl_data_device* _data_device, uint32_t _time, wl_fixed_t _x_w, wl_fixed_t _y_w) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->dataDeviceMotion(_data_device, _time, vec2(_x_w,_y_w));
@ -1850,7 +1850,7 @@ static void data_device_motion(void* _data, struct wl_data_device* _data_device,
static void data_device_drop(void* _data, struct wl_data_device* _data_device) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->dataDeviceDrop(_data_device);
@ -1858,7 +1858,7 @@ static void data_device_drop(void* _data, struct wl_data_device* _data_device) {
static void data_device_selection(void* _data, struct wl_data_device* _wl_data_device, struct wl_data_offer* _offer) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->dataDeviceSelection(_wl_data_device, _offer);
@ -1866,21 +1866,21 @@ static void data_device_selection(void* _data, struct wl_data_device* _wl_data_d
static void data_source_target(void* _data, struct wl_data_source* _wl_data_source, const char* _mime_type) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->dataSourceTarget(_wl_data_source, _mime_type);
}
static void data_source_send(void* _data, struct wl_data_source* _wl_data_source, const char* _mime_type, int _fd) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->dataSourceSend(_wl_data_source, _mime_type, _fd);
}
static void data_source_cancelled(void* _data, struct wl_data_source* _wl_data_source) {
WAYLANDInterface* interface = (WAYLANDInterface*)_data;
if (interface == nullptr) {
if (interface == null) {
return;
}
interface->dataSourceCancelled(_wl_data_source);

View File

@ -21,7 +21,7 @@ namespace gale {
* @param[in] _argv Standard argv
* @return normal error int for the application error management
*/
int32_t run(gale::Application* _application, int32_t _argc = 0, const char* _argv[] = nullptr);
int32_t run(gale::Application* _application, int32_t _argc = 0, const char* _argv[] = null);
/**
* @brief get GALE version
* @return The string that describe gale version

View File

@ -45,7 +45,7 @@ void gale::resource::Manager::unInit() {
auto it(m_resourceList.begin());
while(it != m_resourceList.end()) {
ememory::SharedPtr<gale::Resource> tmpRessource = (*it).lock();
if (tmpRessource != nullptr) {
if (tmpRessource != null) {
GALE_WARNING("Find a resource that is not removed : [" << tmpRessource->getId() << "]"
<< "=\"" << tmpRessource->getName() << "\" "
<< tmpRessource.useCount() << " elements");
@ -62,7 +62,7 @@ void gale::resource::Manager::display() {
ethread::RecursiveLock lock(m_mutex);
for (auto &it : m_resourceList) {
ememory::SharedPtr<gale::Resource> tmpRessource = it.lock();
if (tmpRessource != nullptr) {
if (tmpRessource != null) {
GALE_INFO(" [" << tmpRessource->getId() << "]"
<< tmpRessource->getType()
<< "=\"" << tmpRessource->getName() << "\" "
@ -81,7 +81,7 @@ void gale::resource::Manager::reLoadResources() {
GALE_INFO(" Reload level : " << jjj << "/" << (MAX_RESOURCE_LEVEL-1));
for (auto &it : m_resourceList) {
ememory::SharedPtr<gale::Resource> tmpRessource = it.lock();
if(tmpRessource != nullptr) {
if(tmpRessource != null) {
if (jjj == tmpRessource->getResourceLevel()) {
tmpRessource->reload();
GALE_INFO(" [" << tmpRessource->getId() << "]="<< tmpRessource->getType());
@ -99,7 +99,7 @@ void gale::resource::Manager::update(const ememory::SharedPtr<gale::Resource>& _
// chek if not added before
ethread::RecursiveLock lock(m_mutex);
for (auto &it : m_resourceListToUpdate) {
if ( it != nullptr
if ( it != null
&& it == _object) {
// just prevent some double add ...
return;
@ -131,7 +131,7 @@ void gale::resource::Manager::updateContext() {
GALE_VERBOSE(" updateContext level (D) : " << jjj << "/" << (MAX_RESOURCE_LEVEL-1));
for (auto &it : resourceList) {
ememory::SharedPtr<gale::Resource> tmpRessource = it.lock();
if( tmpRessource != nullptr
if( tmpRessource != null
&& jjj == tmpRessource->getResourceLevel()) {
//GALE_DEBUG("Update context named : " << l_resourceList[iii]->getName());
if (tmpRessource->updateContext() == false) {
@ -155,7 +155,7 @@ void gale::resource::Manager::updateContext() {
for (size_t jjj=0; jjj<MAX_RESOURCE_LEVEL; jjj++) {
GALE_VERBOSE(" updateContext level (U) : " << jjj << "/" << (MAX_RESOURCE_LEVEL-1));
for (auto &it : resourceListToUpdate) {
if ( it != nullptr
if ( it != null
&& jjj == it->getResourceLevel()) {
if (it->updateContext() == false) {
ethread::RecursiveLock lock(m_mutex);
@ -174,7 +174,7 @@ void gale::resource::Manager::contextHasBeenDestroyed() {
ethread::RecursiveLock lock(m_mutex);
for (auto &it : m_resourceList) {
ememory::SharedPtr<gale::Resource> tmpRessource = it.lock();
if (tmpRessource != nullptr) {
if (tmpRessource != null) {
tmpRessource->removeContextToLate();
}
}
@ -193,13 +193,13 @@ ememory::SharedPtr<gale::Resource> gale::resource::Manager::localKeep(const etk:
GALE_VERBOSE("KEEP (DEFAULT) : file : '" << _filename << "' in " << m_resourceList.size() << " resources");
for (auto &it : m_resourceList) {
ememory::SharedPtr<gale::Resource> tmpRessource = it.lock();
if (tmpRessource != nullptr) {
if (tmpRessource != null) {
if (tmpRessource->getName() == _filename) {
return tmpRessource;
}
}
}
return nullptr;
return null;
}
// internal generic keeper ...
@ -208,7 +208,7 @@ void gale::resource::Manager::localAdd(const ememory::SharedPtr<gale::Resource>&
//Add ... find empty slot
for (auto &it : m_resourceList) {
ememory::SharedPtr<gale::Resource> tmpRessource = it.lock();
if (tmpRessource == nullptr) {
if (tmpRessource == null) {
it = _object;
return;
}

View File

@ -40,7 +40,7 @@ void gale::resource::Program::init(const etk::String& _filename) {
// remove extention ...
tmpFilename.erase(tmpFilename.size()-4, 4);
ememory::SharedPtr<gale::resource::Shader> tmpShader = gale::resource::Shader::create(tmpFilename+"vert");
if (tmpShader == nullptr) {
if (tmpShader == null) {
GALE_ERROR("Error while getting a specific shader filename : " << tmpFilename);
return;
} else {
@ -48,7 +48,7 @@ void gale::resource::Program::init(const etk::String& _filename) {
m_shaderList.pushBack(tmpShader);
}
tmpShader = gale::resource::Shader::create(tmpFilename+"frag");
if (tmpShader == nullptr) {
if (tmpShader == null) {
GALE_ERROR("Error while getting a specific shader filename : " << tmpFilename);
return;
} else {
@ -67,7 +67,7 @@ void gale::resource::Program::init(const etk::String& _filename) {
}
#define MAX_LINE_SIZE (2048)
char tmpData[MAX_LINE_SIZE];
while (file.fileGets(tmpData, MAX_LINE_SIZE) != nullptr) {
while (file.fileGets(tmpData, MAX_LINE_SIZE) != null) {
int32_t len = strlen(tmpData);
if( tmpData[len-1] == '\n'
|| tmpData[len-1] == '\r') {
@ -84,7 +84,7 @@ void gale::resource::Program::init(const etk::String& _filename) {
// get it with relative position :
etk::String tmpFilename = file.getRelativeFolder() + tmpData;
ememory::SharedPtr<gale::resource::Shader> tmpShader = gale::resource::Shader::create(tmpFilename);
if (tmpShader == nullptr) {
if (tmpShader == null) {
GALE_ERROR("Error while getting a specific shader filename : " << tmpFilename);
} else {
GALE_DEBUG("Add shader on program : "<< tmpFilename);
@ -255,14 +255,14 @@ bool gale::resource::Program::updateContext() {
}
// first attach vertex shader, and after fragment shader
for (size_t iii=0; iii<m_shaderList.size(); iii++) {
if (m_shaderList[iii] != nullptr) {
if (m_shaderList[iii] != null) {
if (m_shaderList[iii]->getShaderType() == gale::openGL::shader::type::vertex) {
gale::openGL::program::attach(m_program, m_shaderList[iii]->getGL_ID());
}
}
}
for (size_t iii=0; iii<m_shaderList.size(); iii++) {
if (m_shaderList[iii] != nullptr) {
if (m_shaderList[iii] != null) {
if (m_shaderList[iii]->getShaderType() == gale::openGL::shader::type::fragment) {
gale::openGL::program::attach(m_program, m_shaderList[iii]->getGL_ID());
}
@ -340,13 +340,13 @@ void gale::resource::Program::reload() {
return;
}
// remove previous data ...
if (m_fileData != nullptr) {
if (m_fileData != null) {
del ete[] m_fileData;
m_fileData = 0;
}
// allocate data
m_fileData = ne w char[fileSize+5];
if (m_fileData == nullptr) {
if (m_fileData == null) {
GALE_ERROR("Error Memory allocation size=" << fileSize);
return;
}
@ -606,8 +606,8 @@ void gale::resource::Program::uniform1fv(int32_t _idElem, int32_t _nbElement, co
GALE_ERROR("No element to send at open GL ...");
return;
}
if (_value == nullptr) {
GALE_ERROR("nullptr Input pointer to send at open GL ...");
if (_value == null) {
GALE_ERROR("null Input pointer to send at open GL ...");
return;
}
glUniform1fv(m_elementList[_idElem].m_elementId, _nbElement, _value);
@ -630,8 +630,8 @@ void gale::resource::Program::uniform2fv(int32_t _idElem, int32_t _nbElement, co
GALE_ERROR("No element to send at open GL ...");
return;
}
if (_value == nullptr) {
GALE_ERROR("nullptr Input pointer to send at open GL ...");
if (_value == null) {
GALE_ERROR("null Input pointer to send at open GL ...");
return;
}
glUniform2fv(m_elementList[_idElem].m_elementId, _nbElement, _value);
@ -654,8 +654,8 @@ void gale::resource::Program::uniform3fv(int32_t _idElem, int32_t _nbElement, co
GALE_ERROR("No element to send at open GL ...");
return;
}
if (_value == nullptr) {
GALE_ERROR("nullptr Input pointer to send at open GL ...");
if (_value == null) {
GALE_ERROR("null Input pointer to send at open GL ...");
return;
}
GALE_VERBOSE("[" << m_elementList[_idElem].m_name << "] send " << _nbElement << " vec3");
@ -679,8 +679,8 @@ void gale::resource::Program::uniform4fv(int32_t _idElem, int32_t _nbElement, co
GALE_ERROR("No element to send at open GL ...");
return;
}
if (_value == nullptr) {
GALE_ERROR("nullptr Input pointer to send at open GL ...");
if (_value == null) {
GALE_ERROR("null Input pointer to send at open GL ...");
return;
}
GALE_VERBOSE("[" << m_elementList[_idElem].m_name << "] send " << _nbElement << " vec4");
@ -707,8 +707,8 @@ void gale::resource::Program::uniform1iv(int32_t _idElem, int32_t _nbElement, co
GALE_ERROR("No element to send at open GL ...");
return;
}
if (_value == nullptr) {
GALE_ERROR("nullptr Input pointer to send at open GL ...");
if (_value == null) {
GALE_ERROR("null Input pointer to send at open GL ...");
return;
}
glUniform1iv(m_elementList[_idElem].m_elementId, _nbElement, _value);
@ -731,8 +731,8 @@ void gale::resource::Program::uniform2iv(int32_t _idElem, int32_t _nbElement, co
GALE_ERROR("No element to send at open GL ...");
return;
}
if (_value == nullptr) {
GALE_ERROR("nullptr Input pointer to send at open GL ...");
if (_value == null) {
GALE_ERROR("null Input pointer to send at open GL ...");
return;
}
glUniform2iv(m_elementList[_idElem].m_elementId, _nbElement, _value);
@ -755,8 +755,8 @@ void gale::resource::Program::uniform3iv(int32_t _idElem, int32_t _nbElement, co
GALE_ERROR("No element to send at open GL ...");
return;
}
if (_value == nullptr) {
GALE_ERROR("nullptr Input pointer to send at open GL ...");
if (_value == null) {
GALE_ERROR("null Input pointer to send at open GL ...");
return;
}
glUniform3iv(m_elementList[_idElem].m_elementId, _nbElement, _value);
@ -779,8 +779,8 @@ void gale::resource::Program::uniform4iv(int32_t _idElem, int32_t _nbElement, co
GALE_ERROR("No element to send at open GL ...");
return;
}
if (_value == nullptr) {
GALE_ERROR("nullptr Input pointer to send at open GL ...");
if (_value == null) {
GALE_ERROR("null Input pointer to send at open GL ...");
return;
}
glUniform4iv(m_elementList[_idElem].m_elementId, _nbElement, _value);

View File

@ -40,7 +40,7 @@ const char * const gale::Resource::getType() {
}
void gale::Resource::addResourceType(const char* _type) {
if (_type == nullptr) {
if (_type == null) {
GALE_ERROR(" try to add a type with no value...");
return;
}

View File

@ -16,9 +16,9 @@
#define DECLARE_RESOURCE_FACTORY(className) \
template<typename ... GALE_TYPE> static ememory::SharedPtr<className> create( GALE_TYPE&& ... _all ) { \
ememory::SharedPtr<className> resource(ETK_NEW(className)); \
if (resource == nullptr) { \
if (resource == null) { \
GALE_ERROR("Factory resource error"); \
return nullptr; \
return null; \
} \
resource->init(etk::forward<GALE_TYPE>(_all)... ); \
if (resource->resourceHasBeenCorectlyInit() == false) { \
@ -35,18 +35,18 @@
if (_name != "" && _name != "---") { \
resource2 = getManager().localKeep(_name); \
} \
if (resource2 != nullptr) { \
if (resource2 != null) { \
resource = ememory::dynamicPointerCast<className>(resource2); \
if (resource == nullptr) { \
if (resource == null) { \
GALE_CRITICAL("Request resource file : '" << _name << "' With the wrong type (dynamic cast error)"); \
return nullptr; \
return null; \
} \
return resource; \
} \
resource = ememory::SharedPtr<className>(ETK_NEW(className)); \
if (resource == nullptr) { \
if (resource == null) { \
GALE_ERROR("allocation error of a resource : " << _name); \
return nullptr; \
return null; \
} \
resource->init(_name, etk::forward<GALE_TYPE>(_all)... ); \
if (resource->resourceHasBeenCorectlyInit() == false) { \
@ -60,20 +60,20 @@
template<typename ... GALE_TYPE> static ememory::SharedPtr<className> create(GALE_TYPE&& ... _all ) { \
ememory::SharedPtr<className> resource; \
ememory::SharedPtr<gale::Resource> resource2 = getManager().localKeep(uniqueName); \
if (resource2 != nullptr) { \
if (resource2 != null) { \
resource = ememory::dynamicPointerCast<className>(resource2); \
if (resource == nullptr) { \
if (resource == null) { \
GALE_CRITICAL("Request resource file : '" << uniqueName << "' With the wrong type (dynamic cast error)"); \
return nullptr; \
return null; \
} \
} \
if (resource != nullptr) { \
if (resource != null) { \
return resource; \
} \
resource = ememory::SharedPtr<className>(ETK_NEW(className)); \
if (resource == nullptr) { \
if (resource == null) { \
GALE_ERROR("allocation error of a resource : " << uniqueName); \
return nullptr; \
return null; \
} \
resource->init(uniqueName, etk::forward<GALE_TYPE>(_all)... ); \
if (resource->resourceHasBeenCorectlyInit() == false) { \

View File

@ -32,14 +32,14 @@ namespace appl {
setSize(vec2(800, 600));
m_angle = 0.0f;
m_GLprogram = gale::resource::Program::create("DATA:basic.prog");
if (m_GLprogram != nullptr) {
if (m_GLprogram != null) {
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
m_GLColor = m_GLprogram->getAttribute("EW_color");
m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation");
}
// this is the properties of the buffer requested : "r"/"w" + "-" + buffer type "f"=flaot "i"=integer
m_verticesVBO = gale::resource::VirtualBufferObject::create(5);
if (m_verticesVBO == nullptr) {
if (m_verticesVBO == null) {
TEST_ERROR("can not instanciate VBO ...");
return;
}
@ -87,7 +87,7 @@ namespace appl {
etk::color::blue
};
#endif
if (m_GLprogram == nullptr) {
if (m_GLprogram == null) {
TEST_INFO("No shader ...");
return;
}