set internal mutex for the display
This commit is contained in:
parent
18099cf376
commit
be4a593346
@ -220,7 +220,9 @@ static bool needRedraw = true;
|
|||||||
void ewol::widgetManager::DoubleBufferLock(void)
|
void ewol::widgetManager::DoubleBufferLock(void)
|
||||||
{
|
{
|
||||||
if (IsInit) {
|
if (IsInit) {
|
||||||
|
EWOL_DEBUG("DoubleBuffer-Lock");
|
||||||
pthread_mutex_lock(&localMutex);
|
pthread_mutex_lock(&localMutex);
|
||||||
|
EWOL_DEBUG("DoubleBuffer-Lock (DONE)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +243,9 @@ bool ewol::widgetManager::GetDoubleBufferNeedDraw(void)
|
|||||||
void ewol::widgetManager::DoubleBufferUnLock(void)
|
void ewol::widgetManager::DoubleBufferUnLock(void)
|
||||||
{
|
{
|
||||||
if (IsInit) {
|
if (IsInit) {
|
||||||
|
EWOL_DEBUG("DoubleBuffer-UnLock");
|
||||||
pthread_mutex_unlock(&localMutex);
|
pthread_mutex_unlock(&localMutex);
|
||||||
|
EWOL_DEBUG("DoubleBuffer-UnLock (DONE)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,10 +265,11 @@ void EWOL_SystemStart(void)
|
|||||||
// init the thread :
|
// init the thread :
|
||||||
EWOL_DEBUG("Create the thread");
|
EWOL_DEBUG("Create the thread");
|
||||||
pthread_attr_init(&androidJniThreadAttr);
|
pthread_attr_init(&androidJniThreadAttr);
|
||||||
//pthread_attr_setdetachstate(&androidJniThreadAttr, PTHREAD_CREATE_JOINABLE);
|
pthread_attr_setdetachstate(&androidJniThreadAttr, PTHREAD_CREATE_JOINABLE);
|
||||||
pthread_attr_setdetachstate(&androidJniThreadAttr, PTHREAD_CREATE_DETACHED);
|
//pthread_attr_setdetachstate(&androidJniThreadAttr, PTHREAD_CREATE_DETACHED);
|
||||||
//pthread_attr_setscope( &androidJniThreadAttr, PTHREAD_SCOPE_SYSTEM);
|
//pthread_attr_setscope( &androidJniThreadAttr, PTHREAD_SCOPE_SYSTEM);
|
||||||
// note android does not permit to change the thread priority ...
|
// note android does not permit to change the thread priority ...
|
||||||
|
/*
|
||||||
#ifdef __PLATFORM__Linux
|
#ifdef __PLATFORM__Linux
|
||||||
// try to set prio :
|
// try to set prio :
|
||||||
struct sched_param pr;
|
struct sched_param pr;
|
||||||
@ -296,8 +297,10 @@ void EWOL_SystemStart(void)
|
|||||||
pthread_attr_setschedpolicy(&androidJniThreadAttr, policy);
|
pthread_attr_setschedpolicy(&androidJniThreadAttr, policy);
|
||||||
pthread_attr_setschedparam(&androidJniThreadAttr, &pr);
|
pthread_attr_setschedparam(&androidJniThreadAttr, &pr);
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
pthread_setname_np(androidJniThread, "ewol_basic_thread");
|
pthread_setname_np(androidJniThread, "ewol_basic_thread");
|
||||||
pthread_create(&androidJniThread, &androidJniThreadAttr, BaseAppEntry, NULL);
|
pthread_create(&androidJniThread, &androidJniThreadAttr, BaseAppEntry, NULL);
|
||||||
|
/*
|
||||||
#ifdef __PLATFORM__Linux
|
#ifdef __PLATFORM__Linux
|
||||||
pthread_setschedparam(androidJniThread, SCHED_RR, &pr);
|
pthread_setschedparam(androidJniThread, SCHED_RR, &pr);
|
||||||
pthread_getschedparam(androidJniThread, &policy, &pr);
|
pthread_getschedparam(androidJniThread, &policy, &pr);
|
||||||
@ -312,6 +315,7 @@ void EWOL_SystemStart(void)
|
|||||||
EWOL_INFO("Thread <BASIC> policy: ???");
|
EWOL_INFO("Thread <BASIC> policy: ???");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
//pthread_create(&androidJniThread, NULL, BaseAppEntry, NULL);
|
//pthread_create(&androidJniThread, NULL, BaseAppEntry, NULL);
|
||||||
isGlobalSystemInit = true;
|
isGlobalSystemInit = true;
|
||||||
EWOL_DEBUG("Send Init message to the thread");
|
EWOL_DEBUG("Send Init message to the thread");
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
|
|
||||||
//#define DEBUG_X11_EVENT
|
#define DEBUG_X11_EVENT
|
||||||
|
|
||||||
int64_t GetCurrentTime(void)
|
int64_t GetCurrentTime(void)
|
||||||
{
|
{
|
||||||
@ -123,6 +123,26 @@ int32_t separateClickTime = 300000;
|
|||||||
int32_t offsetMoveClicked = 10000;
|
int32_t offsetMoveClicked = 10000;
|
||||||
int32_t offsetMoveClickedDouble = 20000;
|
int32_t offsetMoveClickedDouble = 20000;
|
||||||
|
|
||||||
|
// specific for the Multithread management :
|
||||||
|
// Note we did not use the internal XLockDisplay(m_display); because we have real time disfunctionnement
|
||||||
|
#define PTHREAD_GUI_LOCK_MULTITHREAD
|
||||||
|
#ifdef PTHREAD_GUI_LOCK_MULTITHREAD
|
||||||
|
static pthread_mutex_t l_mutex;
|
||||||
|
#define GUI_LOCK() do { \
|
||||||
|
EWOL_DEBUG("GUI-Lock"); \
|
||||||
|
pthread_mutex_lock(&l_mutex); \
|
||||||
|
EWOL_DEBUG("GUI-Lock (done)"); \
|
||||||
|
}while(0)
|
||||||
|
#define GUI_UNLOCK() do { \
|
||||||
|
EWOL_DEBUG("GUI-UnLock"); \
|
||||||
|
pthread_mutex_unlock(&l_mutex); \
|
||||||
|
EWOL_DEBUG("GUI-UnLock (done)"); \
|
||||||
|
}while(0)
|
||||||
|
#else
|
||||||
|
#define GUI_LOCK() XLockDisplay(m_display)
|
||||||
|
#define GUI_UNLOCK() XUnlockDisplay(m_display)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
bool inputIsPressed[20];
|
bool inputIsPressed[20];
|
||||||
|
|
||||||
@ -160,12 +180,13 @@ bool CreateX11Context(void)
|
|||||||
// basic title of the windows ...
|
// basic title of the windows ...
|
||||||
static char *title = (char*)"Ewol";
|
static char *title = (char*)"Ewol";
|
||||||
|
|
||||||
|
#ifndef PTHREAD_GUI_LOCK_MULTITHREAD
|
||||||
// start multiple connection on the display for multiple threading :
|
// start multiple connection on the display for multiple threading :
|
||||||
Status retStat = XInitThreads();
|
Status retStat = XInitThreads();
|
||||||
if (0!=retStat) {
|
if (0!=retStat) {
|
||||||
EWOL_ERROR("While XInitThreads() ==> can have some problem sometimes : " << retStat);
|
EWOL_ERROR("While XInitThreads() ==> can have some problem sometimes : " << retStat);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// Connect to the X server
|
// Connect to the X server
|
||||||
m_display = XOpenDisplay(NULL);
|
m_display = XOpenDisplay(NULL);
|
||||||
if(NULL == m_display) {
|
if(NULL == m_display) {
|
||||||
@ -279,7 +300,7 @@ void ewol::SetTitle(etk::UString title)
|
|||||||
#ifdef DEBUG_X11_EVENT
|
#ifdef DEBUG_X11_EVENT
|
||||||
EWOL_INFO("X11: Set Title (START)");
|
EWOL_INFO("X11: Set Title (START)");
|
||||||
#endif
|
#endif
|
||||||
XLockDisplay(m_display);
|
GUI_LOCK();
|
||||||
XTextProperty tp;
|
XTextProperty tp;
|
||||||
tp.value = (unsigned char *)title.Utf8Data();
|
tp.value = (unsigned char *)title.Utf8Data();
|
||||||
tp.encoding = XA_WM_NAME;
|
tp.encoding = XA_WM_NAME;
|
||||||
@ -289,7 +310,7 @@ void ewol::SetTitle(etk::UString title)
|
|||||||
XStoreName(m_display, WindowHandle, (const char*)tp.value);
|
XStoreName(m_display, WindowHandle, (const char*)tp.value);
|
||||||
XSetIconName(m_display, WindowHandle, (const char*)tp.value);
|
XSetIconName(m_display, WindowHandle, (const char*)tp.value);
|
||||||
XSetWMIconName(m_display, WindowHandle, &tp);
|
XSetWMIconName(m_display, WindowHandle, &tp);
|
||||||
XUnlockDisplay(m_display);
|
GUI_UNLOCK();
|
||||||
#ifdef DEBUG_X11_EVENT
|
#ifdef DEBUG_X11_EVENT
|
||||||
EWOL_INFO("X11: Set Title (END)");
|
EWOL_INFO("X11: Set Title (END)");
|
||||||
#endif
|
#endif
|
||||||
@ -310,7 +331,7 @@ void SetIcon(etk::File bitmapFile)
|
|||||||
} else {
|
} else {
|
||||||
etk::UString fileExtention = bitmapFile.GetExtention();
|
etk::UString fileExtention = bitmapFile.GetExtention();
|
||||||
if (fileExtention == "bmp") {
|
if (fileExtention == "bmp") {
|
||||||
XLockDisplay(m_display);
|
GUI_LOCK();
|
||||||
// pointer to the WM hints structure.
|
// pointer to the WM hints structure.
|
||||||
XWMHints* win_hints;
|
XWMHints* win_hints;
|
||||||
|
|
||||||
@ -324,15 +345,15 @@ void SetIcon(etk::File bitmapFile)
|
|||||||
switch (rc) {
|
switch (rc) {
|
||||||
case BitmapOpenFailed:
|
case BitmapOpenFailed:
|
||||||
EWOL_ERROR("XReadBitmapFile - could not open file ");
|
EWOL_ERROR("XReadBitmapFile - could not open file ");
|
||||||
XUnlockDisplay(m_display);
|
GUI_UNLOCK();
|
||||||
return;
|
return;
|
||||||
case BitmapFileInvalid:
|
case BitmapFileInvalid:
|
||||||
EWOL_ERROR("XReadBitmapFile - file doesn't contain a valid bitmap.");
|
EWOL_ERROR("XReadBitmapFile - file doesn't contain a valid bitmap.");
|
||||||
XUnlockDisplay(m_display);
|
GUI_UNLOCK();
|
||||||
return;
|
return;
|
||||||
case BitmapNoMemory:
|
case BitmapNoMemory:
|
||||||
EWOL_ERROR("XReadBitmapFile - not enough memory.");
|
EWOL_ERROR("XReadBitmapFile - not enough memory.");
|
||||||
XUnlockDisplay(m_display);
|
GUI_UNLOCK();
|
||||||
return;
|
return;
|
||||||
case BitmapSuccess:
|
case BitmapSuccess:
|
||||||
/* bitmap loaded successfully - do something with it... */
|
/* bitmap loaded successfully - do something with it... */
|
||||||
@ -343,7 +364,7 @@ void SetIcon(etk::File bitmapFile)
|
|||||||
win_hints = XAllocWMHints();
|
win_hints = XAllocWMHints();
|
||||||
if (!win_hints) {
|
if (!win_hints) {
|
||||||
EWOL_ERROR("XAllocWMHints - out of memory");
|
EWOL_ERROR("XAllocWMHints - out of memory");
|
||||||
XUnlockDisplay(m_display);
|
GUI_UNLOCK();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// initialize the structure appropriately. first, specify which size hints we want to fill in. in our case - setting the icon's pixmap.
|
// initialize the structure appropriately. first, specify which size hints we want to fill in. in our case - setting the icon's pixmap.
|
||||||
@ -355,7 +376,7 @@ void SetIcon(etk::File bitmapFile)
|
|||||||
EWOL_INFO(" ==> might be done ");
|
EWOL_INFO(" ==> might be done ");
|
||||||
// finally, we can free the WM hints structure.
|
// finally, we can free the WM hints structure.
|
||||||
XFree(win_hints);
|
XFree(win_hints);
|
||||||
XUnlockDisplay(m_display);
|
GUI_UNLOCK();
|
||||||
} else {
|
} else {
|
||||||
EWOL_ERROR("X11 Icon Extention not managed " << bitmapFile << " Sopported extention : .bmp ");
|
EWOL_ERROR("X11 Icon Extention not managed " << bitmapFile << " Sopported extention : .bmp ");
|
||||||
}
|
}
|
||||||
@ -368,7 +389,7 @@ void RemoveDecoration(void)
|
|||||||
#ifdef DEBUG_X11_EVENT
|
#ifdef DEBUG_X11_EVENT
|
||||||
EWOL_INFO("X11:RemoveDecoration");
|
EWOL_INFO("X11:RemoveDecoration");
|
||||||
#endif
|
#endif
|
||||||
XLockDisplay(m_display);
|
GUI_LOCK();
|
||||||
Hints hints;
|
Hints hints;
|
||||||
Atom property;
|
Atom property;
|
||||||
hints.flags = 2;// Specify that we're changing the window decorations.
|
hints.flags = 2;// Specify that we're changing the window decorations.
|
||||||
@ -380,7 +401,7 @@ void RemoveDecoration(void)
|
|||||||
} else {
|
} else {
|
||||||
EWOL_ERROR("Can not get the property for the rmoving decoration of the X11 system ....");
|
EWOL_ERROR("Can not get the property for the rmoving decoration of the X11 system ....");
|
||||||
}
|
}
|
||||||
XUnlockDisplay(m_display);
|
GUI_UNLOCK();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddDecoration(void)
|
void AddDecoration(void)
|
||||||
@ -388,7 +409,7 @@ void AddDecoration(void)
|
|||||||
#ifdef DEBUG_X11_EVENT
|
#ifdef DEBUG_X11_EVENT
|
||||||
EWOL_INFO("X11:AddDecoration");
|
EWOL_INFO("X11:AddDecoration");
|
||||||
#endif
|
#endif
|
||||||
XLockDisplay(m_display);
|
GUI_LOCK();
|
||||||
Hints hints;
|
Hints hints;
|
||||||
Atom property;
|
Atom property;
|
||||||
hints.flags = 2;// Specify that we're changing the window decorations.
|
hints.flags = 2;// Specify that we're changing the window decorations.
|
||||||
@ -400,7 +421,7 @@ void AddDecoration(void)
|
|||||||
} else {
|
} else {
|
||||||
EWOL_ERROR("Can not get the property for the rmoving decoration of the X11 system ....");
|
EWOL_ERROR("Can not get the property for the rmoving decoration of the X11 system ....");
|
||||||
}
|
}
|
||||||
XUnlockDisplay(m_display);
|
GUI_UNLOCK();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CreateOGlContext(void)
|
bool CreateOGlContext(void)
|
||||||
@ -408,7 +429,7 @@ bool CreateOGlContext(void)
|
|||||||
#ifdef DEBUG_X11_EVENT
|
#ifdef DEBUG_X11_EVENT
|
||||||
EWOL_INFO("X11:CreateOGlContext");
|
EWOL_INFO("X11:CreateOGlContext");
|
||||||
#endif
|
#endif
|
||||||
XLockDisplay(m_display);
|
GUI_LOCK();
|
||||||
/* create a GLX context */
|
/* create a GLX context */
|
||||||
GLXContext RenderContext = glXCreateContext(m_display, m_visual, 0, GL_TRUE);
|
GLXContext RenderContext = glXCreateContext(m_display, m_visual, 0, GL_TRUE);
|
||||||
/* connect the glx-context to the window */
|
/* connect the glx-context to the window */
|
||||||
@ -418,7 +439,7 @@ bool CreateOGlContext(void)
|
|||||||
} else {
|
} else {
|
||||||
EWOL_INFO("XF86 DRI NOT available\n");
|
EWOL_INFO("XF86 DRI NOT available\n");
|
||||||
}
|
}
|
||||||
XUnlockDisplay(m_display);
|
GUI_UNLOCK();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -571,6 +592,7 @@ void X11_Run(void)
|
|||||||
Atom type;
|
Atom type;
|
||||||
int format;
|
int format;
|
||||||
unsigned long nitems, bytes;
|
unsigned long nitems, bytes;
|
||||||
|
GUI_LOCK();
|
||||||
XGetWindowProperty(m_display,
|
XGetWindowProperty(m_display,
|
||||||
WindowHandle,
|
WindowHandle,
|
||||||
event.xselection.property,
|
event.xselection.property,
|
||||||
@ -584,6 +606,7 @@ void X11_Run(void)
|
|||||||
&bytes, // *bytes_after_return
|
&bytes, // *bytes_after_return
|
||||||
&buf// **prop_return);
|
&buf// **prop_return);
|
||||||
);
|
);
|
||||||
|
GUI_UNLOCK();
|
||||||
if (true == l_clipBoardRequestPrimary) {
|
if (true == l_clipBoardRequestPrimary) {
|
||||||
l_clipBoardPrimary = (char*)buf;
|
l_clipBoardPrimary = (char*)buf;
|
||||||
// inform that we have receive the data
|
// inform that we have receive the data
|
||||||
@ -623,7 +646,7 @@ void X11_Run(void)
|
|||||||
} else {
|
} else {
|
||||||
magatTextToSend = "";
|
magatTextToSend = "";
|
||||||
}
|
}
|
||||||
XLockDisplay(m_display);
|
GUI_LOCK();
|
||||||
Atom listOfAtom[4];
|
Atom listOfAtom[4];
|
||||||
if(strlen(magatTextToSend) == 0 ) {
|
if(strlen(magatTextToSend) == 0 ) {
|
||||||
respond.xselection.property= None;
|
respond.xselection.property= None;
|
||||||
@ -669,7 +692,6 @@ void X11_Run(void)
|
|||||||
} else {
|
} else {
|
||||||
respond.xselection.property= None;
|
respond.xselection.property= None;
|
||||||
}
|
}
|
||||||
XUnlockDisplay(m_display);
|
|
||||||
respond.xselection.type= SelectionNotify;
|
respond.xselection.type= SelectionNotify;
|
||||||
respond.xselection.display= req->display;
|
respond.xselection.display= req->display;
|
||||||
respond.xselection.requestor= req->requestor;
|
respond.xselection.requestor= req->requestor;
|
||||||
@ -679,6 +701,7 @@ void X11_Run(void)
|
|||||||
XSendEvent (m_display, req->requestor,0,0,&respond);
|
XSendEvent (m_display, req->requestor,0,0,&respond);
|
||||||
// Flush the message on the pipe ...
|
// Flush the message on the pipe ...
|
||||||
XFlush (m_display);
|
XFlush (m_display);
|
||||||
|
GUI_UNLOCK();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -1025,9 +1048,9 @@ void X11_Run(void)
|
|||||||
#ifdef DEBUG_X11_EVENT
|
#ifdef DEBUG_X11_EVENT
|
||||||
EWOL_INFO("X11 Render...");
|
EWOL_INFO("X11 Render...");
|
||||||
#endif
|
#endif
|
||||||
XLockDisplay(m_display);
|
GUI_LOCK();
|
||||||
EWOL_NativeRender();
|
EWOL_NativeRender();
|
||||||
XUnlockDisplay(m_display);
|
GUI_UNLOCK();
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_X11_EVENT
|
#ifdef DEBUG_X11_EVENT
|
||||||
EWOL_INFO("X11 endEvent --- ");
|
EWOL_INFO("X11 endEvent --- ");
|
||||||
@ -1040,9 +1063,9 @@ void X11_ChangeSize(int32_t w, int32_t h)
|
|||||||
#ifdef DEBUG_X11_EVENT
|
#ifdef DEBUG_X11_EVENT
|
||||||
EWOL_INFO("X11: X11_ChangeSize");
|
EWOL_INFO("X11: X11_ChangeSize");
|
||||||
#endif
|
#endif
|
||||||
XLockDisplay(m_display);
|
GUI_LOCK();
|
||||||
XResizeWindow(m_display, WindowHandle, w, h);
|
XResizeWindow(m_display, WindowHandle, w, h);
|
||||||
XUnlockDisplay(m_display);
|
GUI_UNLOCK();
|
||||||
};
|
};
|
||||||
|
|
||||||
void X11_ChangePos(int32_t x, int32_t y)
|
void X11_ChangePos(int32_t x, int32_t y)
|
||||||
@ -1050,9 +1073,9 @@ void X11_ChangePos(int32_t x, int32_t y)
|
|||||||
#ifdef DEBUG_X11_EVENT
|
#ifdef DEBUG_X11_EVENT
|
||||||
EWOL_INFO("X11: X11_ChangePos");
|
EWOL_INFO("X11: X11_ChangePos");
|
||||||
#endif
|
#endif
|
||||||
XLockDisplay(m_display);
|
GUI_LOCK();
|
||||||
XMoveWindow(m_display, WindowHandle, x, y);
|
XMoveWindow(m_display, WindowHandle, x, y);
|
||||||
XUnlockDisplay(m_display);
|
GUI_UNLOCK();
|
||||||
};
|
};
|
||||||
|
|
||||||
void X11_GetAbsPos(int32_t & x, int32_t & y)
|
void X11_GetAbsPos(int32_t & x, int32_t & y)
|
||||||
@ -1063,9 +1086,9 @@ void X11_GetAbsPos(int32_t & x, int32_t & y)
|
|||||||
int tmp;
|
int tmp;
|
||||||
unsigned int tmp2;
|
unsigned int tmp2;
|
||||||
Window fromroot, tmpwin;
|
Window fromroot, tmpwin;
|
||||||
XLockDisplay(m_display);
|
GUI_LOCK();
|
||||||
XQueryPointer(m_display, WindowHandle, &fromroot, &tmpwin, &x, &y, &tmp, &tmp, &tmp2);
|
XQueryPointer(m_display, WindowHandle, &fromroot, &tmpwin, &x, &y, &tmp, &tmp, &tmp2);
|
||||||
XUnlockDisplay(m_display);
|
GUI_UNLOCK();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1086,14 +1109,14 @@ void guiAbstraction::ClipBoardGet(etk::UString &newData, clipBoardMode_te mode)
|
|||||||
// clear old request ..
|
// clear old request ..
|
||||||
ewol::simpleMsg::Clear(l_clipboardMessage);
|
ewol::simpleMsg::Clear(l_clipboardMessage);
|
||||||
// Generate a request on X11
|
// Generate a request on X11
|
||||||
XLockDisplay(m_display);
|
GUI_LOCK();
|
||||||
XConvertSelection(m_display,
|
XConvertSelection(m_display,
|
||||||
XAtomeSelection,// atom,
|
XAtomeSelection,// atom,
|
||||||
XAtomeTargetStringUTF8, // type?
|
XAtomeTargetStringUTF8, // type?
|
||||||
XAtomeEWOL, // prop,
|
XAtomeEWOL, // prop,
|
||||||
WindowHandle,
|
WindowHandle,
|
||||||
CurrentTime);
|
CurrentTime);
|
||||||
XUnlockDisplay(m_display);
|
GUI_UNLOCK();
|
||||||
// wait the event ...
|
// wait the event ...
|
||||||
int32_t waitTmp = ewol::simpleMsg::WaitingMessage(l_clipboardMessage, 5000);
|
int32_t waitTmp = ewol::simpleMsg::WaitingMessage(l_clipboardMessage, 5000);
|
||||||
if (waitTmp == 0) {
|
if (waitTmp == 0) {
|
||||||
@ -1109,14 +1132,14 @@ void guiAbstraction::ClipBoardGet(etk::UString &newData, clipBoardMode_te mode)
|
|||||||
// clear old request ..
|
// clear old request ..
|
||||||
ewol::simpleMsg::Clear(l_clipboardMessage);
|
ewol::simpleMsg::Clear(l_clipboardMessage);
|
||||||
// Generate a request on X11
|
// Generate a request on X11
|
||||||
XLockDisplay(m_display);
|
GUI_LOCK();
|
||||||
XConvertSelection(m_display,
|
XConvertSelection(m_display,
|
||||||
XAtomeClipBoard,// atom,
|
XAtomeClipBoard,// atom,
|
||||||
XAtomeTargetStringUTF8, // type?
|
XAtomeTargetStringUTF8, // type?
|
||||||
XAtomeEWOL, // prop,
|
XAtomeEWOL, // prop,
|
||||||
WindowHandle,
|
WindowHandle,
|
||||||
CurrentTime);
|
CurrentTime);
|
||||||
XUnlockDisplay(m_display);
|
GUI_UNLOCK();
|
||||||
// wait the event ...
|
// wait the event ...
|
||||||
int32_t waitTmp = ewol::simpleMsg::WaitingMessage(l_clipboardMessage, 5000);
|
int32_t waitTmp = ewol::simpleMsg::WaitingMessage(l_clipboardMessage, 5000);
|
||||||
if (waitTmp == 0) {
|
if (waitTmp == 0) {
|
||||||
@ -1145,9 +1168,9 @@ void guiAbstraction::ClipBoardSet(etk::UString &newData, clipBoardMode_te mode)
|
|||||||
l_clipBoardPrimary = newData;
|
l_clipBoardPrimary = newData;
|
||||||
// Request the selection :
|
// Request the selection :
|
||||||
if (false == l_clipBoardOwnerPrimary) {
|
if (false == l_clipBoardOwnerPrimary) {
|
||||||
XLockDisplay(m_display);
|
GUI_LOCK();
|
||||||
XSetSelectionOwner(m_display, XAtomeSelection, WindowHandle, CurrentTime);
|
XSetSelectionOwner(m_display, XAtomeSelection, WindowHandle, CurrentTime);
|
||||||
XUnlockDisplay(m_display);
|
GUI_UNLOCK();
|
||||||
l_clipBoardOwnerPrimary = true;
|
l_clipBoardOwnerPrimary = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1158,9 +1181,9 @@ void guiAbstraction::ClipBoardSet(etk::UString &newData, clipBoardMode_te mode)
|
|||||||
l_clipBoardStd = newData;
|
l_clipBoardStd = newData;
|
||||||
// Request the clipBoard :
|
// Request the clipBoard :
|
||||||
if (false == l_clipBoardOwnerStd) {
|
if (false == l_clipBoardOwnerStd) {
|
||||||
XLockDisplay(m_display);
|
GUI_LOCK();
|
||||||
XSetSelectionOwner(m_display, XAtomeClipBoard, WindowHandle, CurrentTime);
|
XSetSelectionOwner(m_display, XAtomeClipBoard, WindowHandle, CurrentTime);
|
||||||
XUnlockDisplay(m_display);
|
GUI_UNLOCK();
|
||||||
l_clipBoardOwnerStd = true;
|
l_clipBoardOwnerStd = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1249,6 +1272,12 @@ etk::File APP_Icon(void);
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
#ifdef PTHREAD_GUI_LOCK_MULTITHREAD
|
||||||
|
// create interface mutex :
|
||||||
|
int ret = pthread_mutex_init(&l_mutex, NULL);
|
||||||
|
EWOL_ASSERT(ret == 0, "Error creating Mutex ...");
|
||||||
|
#endif
|
||||||
|
|
||||||
for( int32_t i=1 ; i<argc; i++) {
|
for( int32_t i=1 ; i<argc; i++) {
|
||||||
EWOL_INFO("CmdLine : \"" << argv[i] << "\"" );
|
EWOL_INFO("CmdLine : \"" << argv[i] << "\"" );
|
||||||
if (0==strncmp("-l0", argv[i], 256)) {
|
if (0==strncmp("-l0", argv[i], 256)) {
|
||||||
@ -1294,6 +1323,10 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
listArgs.Clear();
|
listArgs.Clear();
|
||||||
|
#ifdef PTHREAD_GUI_LOCK_MULTITHREAD
|
||||||
|
ret = pthread_mutex_destroy(&l_mutex);
|
||||||
|
EWOL_ASSERT(ret == 0, "Error destroying Mutex ...");
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user