Debug state of the X11 tread problem
This commit is contained in:
parent
bf41251241
commit
7afeb4aa80
@ -37,6 +37,9 @@
|
|||||||
#include <ewol/ShortCutManager.h>
|
#include <ewol/ShortCutManager.h>
|
||||||
#include <ewol/base/eventInputManagement.h>
|
#include <ewol/base/eventInputManagement.h>
|
||||||
|
|
||||||
|
#ifdef __PLATFORM__Linux
|
||||||
|
# include <sched.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static ewol::threadMsg::threadMsg_ts androidJniMsg;
|
static ewol::threadMsg::threadMsg_ts androidJniMsg;
|
||||||
@ -262,19 +265,53 @@ 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 ...
|
||||||
// try to set prio :
|
#ifdef __PLATFORM__Linux
|
||||||
struct sched_param pr;
|
// try to set prio :
|
||||||
pr.sched_priority = 10;
|
struct sched_param pr;
|
||||||
pthread_attr_setschedpolicy(&androidJniThreadAttr, SCHED_RR);
|
int policy;
|
||||||
pthread_attr_setschedparam(&androidJniThreadAttr, &pr);
|
pr.sched_priority = 20;
|
||||||
*/
|
sched_setscheduler(getpid(), SCHED_RR, &pr);
|
||||||
|
|
||||||
|
pthread_setschedparam(pthread_self(), SCHED_RR, &pr);
|
||||||
|
|
||||||
|
|
||||||
|
pthread_getschedparam(pthread_self(), &policy, &pr);
|
||||||
|
EWOL_INFO("Thread <GUI> priority : " << pr.sched_priority);
|
||||||
|
if (policy == SCHED_RR) {
|
||||||
|
EWOL_INFO("Thread <GUI> policy: SCHED_RR");
|
||||||
|
} else if (policy == SCHED_FIFO) {
|
||||||
|
EWOL_INFO("Thread <GUI> policy: SCHED_FIFO");
|
||||||
|
} else if (policy == SCHED_OTHER) {
|
||||||
|
EWOL_INFO("Thread <GUI> policy: SCHED_OTHER");
|
||||||
|
} else {
|
||||||
|
EWOL_INFO("Thread <GUI> policy: ???");
|
||||||
|
}
|
||||||
|
|
||||||
|
pr.sched_priority +=5;
|
||||||
|
EWOL_INFO("Thread <BASIC> priority : " << pr.sched_priority << " (try to set)");
|
||||||
|
pthread_attr_setschedpolicy(&androidJniThreadAttr, policy);
|
||||||
|
pthread_attr_setschedparam(&androidJniThreadAttr, &pr);
|
||||||
|
#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
|
||||||
|
pthread_setschedparam(androidJniThread, SCHED_RR, &pr);
|
||||||
|
pthread_getschedparam(androidJniThread, &policy, &pr);
|
||||||
|
EWOL_INFO("Thread <BASIC> priority : " << pr.sched_priority << " (is really set)");
|
||||||
|
if (policy == SCHED_RR) {
|
||||||
|
EWOL_INFO("Thread <BASIC> policy: SCHED_RR");
|
||||||
|
} else if (policy == SCHED_FIFO) {
|
||||||
|
EWOL_INFO("Thread <BASIC> policy: SCHED_FIFO");
|
||||||
|
} else if (policy == SCHED_OTHER) {
|
||||||
|
EWOL_INFO("Thread <BASIC> policy: SCHED_OTHER");
|
||||||
|
} else {
|
||||||
|
EWOL_INFO("Thread <BASIC> policy: ???");
|
||||||
|
}
|
||||||
|
#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
|
||||||
|
|
||||||
int64_t GetCurrentTime(void)
|
int64_t GetCurrentTime(void)
|
||||||
{
|
{
|
||||||
@ -347,7 +347,9 @@ void RemoveDecoration(void)
|
|||||||
hints.decorations = 0;// 0 (false) means that window decorations should go bye-bye
|
hints.decorations = 0;// 0 (false) means that window decorations should go bye-bye
|
||||||
property = XInternAtom(m_display, "_MOTIF_WM_HINTS", true);
|
property = XInternAtom(m_display, "_MOTIF_WM_HINTS", true);
|
||||||
if (0 != property) {
|
if (0 != property) {
|
||||||
|
XLockDisplay(m_display);
|
||||||
XChangeProperty(m_display,WindowHandle,property,property,32,PropModeReplace,(unsigned char *)&hints,5);
|
XChangeProperty(m_display,WindowHandle,property,property,32,PropModeReplace,(unsigned char *)&hints,5);
|
||||||
|
XUnlockDisplay(m_display);
|
||||||
XMapWindow(m_display, WindowHandle);
|
XMapWindow(m_display, WindowHandle);
|
||||||
} 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 ....");
|
||||||
@ -362,7 +364,9 @@ void AddDecoration(void)
|
|||||||
hints.decorations = 1;// 1 (true) means that window decorations should enable
|
hints.decorations = 1;// 1 (true) means that window decorations should enable
|
||||||
property = XInternAtom(m_display, "_MOTIF_WM_HINTS", true);
|
property = XInternAtom(m_display, "_MOTIF_WM_HINTS", true);
|
||||||
if (0 != property) {
|
if (0 != property) {
|
||||||
|
XLockDisplay(m_display);
|
||||||
XChangeProperty(m_display,WindowHandle,property,property,32,PropModeReplace,(unsigned char *)&hints,5);
|
XChangeProperty(m_display,WindowHandle,property,property,32,PropModeReplace,(unsigned char *)&hints,5);
|
||||||
|
XUnlockDisplay(m_display);
|
||||||
XMapWindow(m_display, WindowHandle);
|
XMapWindow(m_display, WindowHandle);
|
||||||
} 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 ....");
|
||||||
@ -468,14 +472,18 @@ void X11_Run(void)
|
|||||||
XEvent respond;
|
XEvent respond;
|
||||||
// main X boucle :
|
// main X boucle :
|
||||||
while (XPending(m_display)) {
|
while (XPending(m_display)) {
|
||||||
//EWOL_ERROR("plop 22222");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11:Event");
|
||||||
|
#endif
|
||||||
XNextEvent(m_display, &event);
|
XNextEvent(m_display, &event);
|
||||||
|
|
||||||
switch (event.type)
|
switch (event.type)
|
||||||
{
|
{
|
||||||
case ClientMessage:
|
case ClientMessage:
|
||||||
{
|
{
|
||||||
EWOL_INFO("Receive : ClientMessage");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("Receive : ClientMessage");
|
||||||
|
#endif
|
||||||
if(XAtomeDeleteWindows == (int64_t)event.xclient.data.l[0]) {
|
if(XAtomeDeleteWindows == (int64_t)event.xclient.data.l[0]) {
|
||||||
EWOL_INFO(" ==> Kill Requested ...");
|
EWOL_INFO(" ==> Kill Requested ...");
|
||||||
if (NULL != gui_uniqueWindows) {
|
if (NULL != gui_uniqueWindows) {
|
||||||
@ -490,11 +498,21 @@ void X11_Run(void)
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
case SelectionClear:
|
case SelectionClear:
|
||||||
// Selection has been done on an other program ==> clear ours ...
|
// Selection has been done on an other program ==> clear ours ...
|
||||||
EWOL_VERBOSE("X11 event SelectionClear");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event SelectionClear");
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
XSelectionRequestEvent *req=&(event.xselectionrequest);
|
#ifdef DEBUG_X11_EVENT
|
||||||
EWOL_VERBOSE(" property: \"" << XGetAtomName(m_display, req->property) << "\"");
|
{
|
||||||
EWOL_VERBOSE(" target: \"" << XGetAtomName(m_display, req->target) << "\"");
|
XSelectionRequestEvent *req=&(event.xselectionrequest);
|
||||||
|
char * atomNameProperty = XGetAtomName(m_display, req->property);
|
||||||
|
char * atomNameTarget = XGetAtomName(m_display, req->target);
|
||||||
|
EWOL_INFO("X11 property: \"" << atomNameProperty << "\"");
|
||||||
|
EWOL_INFO("X11 target: \"" << atomNameTarget << "\"");
|
||||||
|
if (NULL != atomNameProperty) { XFree(atomNameProperty); }
|
||||||
|
if (NULL != atomNameTarget) { XFree(atomNameTarget); }
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (true == l_clipBoardOwnerPrimary) {
|
if (true == l_clipBoardOwnerPrimary) {
|
||||||
l_clipBoardOwnerPrimary = false;
|
l_clipBoardOwnerPrimary = false;
|
||||||
} else if (true == l_clipBoardOwnerStd) {
|
} else if (true == l_clipBoardOwnerStd) {
|
||||||
@ -505,7 +523,9 @@ void X11_Run(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SelectionNotify:
|
case SelectionNotify:
|
||||||
EWOL_VERBOSE("X11 event SelectionNotify");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event SelectionNotify");
|
||||||
|
#endif
|
||||||
if (event.xselection.property == None) {
|
if (event.xselection.property == None) {
|
||||||
EWOL_VERBOSE(" ==> no data ...");
|
EWOL_VERBOSE(" ==> no data ...");
|
||||||
} else {
|
} else {
|
||||||
@ -540,10 +560,22 @@ void X11_Run(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SelectionRequest:
|
case SelectionRequest:
|
||||||
EWOL_VERBOSE("X11 event SelectionRequest");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event SelectionRequest");
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
XSelectionRequestEvent *req=&(event.xselectionrequest);
|
XSelectionRequestEvent *req=&(event.xselectionrequest);
|
||||||
EWOL_VERBOSE(" from: " << XGetAtomName(m_display, req->property) << " request=" << XGetAtomName(m_display, req->selection) << " in " << XGetAtomName(m_display, req->target));
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
{
|
||||||
|
char * atomNameProperty = XGetAtomName(m_display, req->property);
|
||||||
|
char * atomNameSelection = XGetAtomName(m_display, req->selection);
|
||||||
|
char * atomNameTarget = XGetAtomName(m_display, req->target);
|
||||||
|
EWOL_INFO(" from: " << atomNameProperty << " request=" << atomNameSelection << " in " << atomNameTarget);
|
||||||
|
if (NULL != atomNameProperty) { XFree(atomNameProperty); }
|
||||||
|
if (NULL != atomNameSelection) { XFree(atomNameSelection); }
|
||||||
|
if (NULL != atomNameTarget) { XFree(atomNameTarget); }
|
||||||
|
}
|
||||||
|
#endif
|
||||||
const char * magatTextToSend = NULL;
|
const char * magatTextToSend = NULL;
|
||||||
|
|
||||||
if (req->selection == XAtomeSelection) {
|
if (req->selection == XAtomeSelection) {
|
||||||
@ -553,7 +585,7 @@ void X11_Run(void)
|
|||||||
} else {
|
} else {
|
||||||
magatTextToSend = "";
|
magatTextToSend = "";
|
||||||
}
|
}
|
||||||
|
XLockDisplay(m_display);
|
||||||
Atom listOfAtom[4];
|
Atom listOfAtom[4];
|
||||||
if(strlen(magatTextToSend) == 0 ) {
|
if(strlen(magatTextToSend) == 0 ) {
|
||||||
respond.xselection.property= None;
|
respond.xselection.property= None;
|
||||||
@ -573,7 +605,7 @@ void X11_Run(void)
|
|||||||
(unsigned char*)listOfAtom,
|
(unsigned char*)listOfAtom,
|
||||||
nbAtomSupported );
|
nbAtomSupported );
|
||||||
respond.xselection.property=req->property;
|
respond.xselection.property=req->property;
|
||||||
EWOL_VERBOSE(" ==> Respond ... (test)");
|
EWOL_INFO(" ==> Respond ... (test)");
|
||||||
} else if(XAtomeTargetString == req->target) {
|
} else if(XAtomeTargetString == req->target) {
|
||||||
XChangeProperty( m_display,
|
XChangeProperty( m_display,
|
||||||
req->requestor,
|
req->requestor,
|
||||||
@ -584,7 +616,7 @@ void X11_Run(void)
|
|||||||
(unsigned char*)magatTextToSend,
|
(unsigned char*)magatTextToSend,
|
||||||
strlen(magatTextToSend));
|
strlen(magatTextToSend));
|
||||||
respond.xselection.property=req->property;
|
respond.xselection.property=req->property;
|
||||||
EWOL_VERBOSE(" ==> Respond ...");
|
EWOL_INFO(" ==> Respond ...");
|
||||||
} else if (XAtomeTargetStringUTF8 == req->target) {
|
} else if (XAtomeTargetStringUTF8 == req->target) {
|
||||||
XChangeProperty( m_display,
|
XChangeProperty( m_display,
|
||||||
req->requestor,
|
req->requestor,
|
||||||
@ -595,10 +627,11 @@ void X11_Run(void)
|
|||||||
(unsigned char*)magatTextToSend,
|
(unsigned char*)magatTextToSend,
|
||||||
strlen(magatTextToSend));
|
strlen(magatTextToSend));
|
||||||
respond.xselection.property=req->property;
|
respond.xselection.property=req->property;
|
||||||
EWOL_VERBOSE(" ==> Respond ...");
|
EWOL_INFO(" ==> Respond ...");
|
||||||
} 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;
|
||||||
@ -612,41 +645,67 @@ void X11_Run(void)
|
|||||||
break;
|
break;
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
case Expose:
|
case Expose:
|
||||||
EWOL_DEBUG("X11 event Expose");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event Expose");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case GraphicsExpose:
|
case GraphicsExpose:
|
||||||
EWOL_DEBUG("X11 event GraphicsExpose");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event GraphicsExpose");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case NoExpose:
|
case NoExpose:
|
||||||
EWOL_DEBUG("X11 event NoExpose");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event NoExpose");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case CreateNotify:
|
case CreateNotify:
|
||||||
EWOL_DEBUG("X11 event CreateNotify");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event CreateNotify");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case DestroyNotify:
|
case DestroyNotify:
|
||||||
EWOL_DEBUG("X11 event DestroyNotify");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event DestroyNotify");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case GravityNotify:
|
case GravityNotify:
|
||||||
EWOL_DEBUG("X11 event GravityNotify");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event GravityNotify");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case VisibilityNotify:
|
case VisibilityNotify:
|
||||||
EWOL_DEBUG("X11 event VisibilityNotify");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event VisibilityNotify");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case CirculateNotify:
|
case CirculateNotify:
|
||||||
EWOL_DEBUG("X11 event CirculateNotify");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event CirculateNotify");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case ReparentNotify:
|
case ReparentNotify:
|
||||||
EWOL_DEBUG("X11 event ReparentNotify");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event ReparentNotify");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case PropertyNotify:
|
case PropertyNotify:
|
||||||
EWOL_DEBUG("X11 event PropertyNotify");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event PropertyNotify");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case ConfigureNotify:
|
case ConfigureNotify:
|
||||||
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event ConfigureNotify");
|
||||||
|
#endif
|
||||||
m_originX = event.xconfigure.x;
|
m_originX = event.xconfigure.x;
|
||||||
m_originY = event.xconfigure.y;
|
m_originY = event.xconfigure.y;
|
||||||
EWOL_ThreadResize(event.xconfigure.width, event.xconfigure.height);
|
EWOL_ThreadResize(event.xconfigure.width, event.xconfigure.height);
|
||||||
break;
|
break;
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event ButtonPress");
|
||||||
|
#endif
|
||||||
m_cursorEventX = event.xbutton.x;
|
m_cursorEventX = event.xbutton.x;
|
||||||
m_cursorEventY = event.xbutton.y;
|
m_cursorEventY = event.xbutton.y;
|
||||||
if (event.xbutton.button < NB_MAX_INPUT) {
|
if (event.xbutton.button < NB_MAX_INPUT) {
|
||||||
@ -655,6 +714,9 @@ void X11_Run(void)
|
|||||||
EWOL_ThreadEventMouseState(event.xbutton.button, true, (float)event.xbutton.x, (float)event.xbutton.y);
|
EWOL_ThreadEventMouseState(event.xbutton.button, true, (float)event.xbutton.x, (float)event.xbutton.y);
|
||||||
break;
|
break;
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event ButtonRelease");
|
||||||
|
#endif
|
||||||
m_cursorEventX = event.xbutton.x;
|
m_cursorEventX = event.xbutton.x;
|
||||||
m_cursorEventY = event.xbutton.y;
|
m_cursorEventY = event.xbutton.y;
|
||||||
if (event.xbutton.button < NB_MAX_INPUT) {
|
if (event.xbutton.button < NB_MAX_INPUT) {
|
||||||
@ -663,17 +725,26 @@ void X11_Run(void)
|
|||||||
EWOL_ThreadEventMouseState(event.xbutton.button, false, (float)event.xbutton.x, (float)event.xbutton.y);
|
EWOL_ThreadEventMouseState(event.xbutton.button, false, (float)event.xbutton.x, (float)event.xbutton.y);
|
||||||
break;
|
break;
|
||||||
case EnterNotify:
|
case EnterNotify:
|
||||||
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event EnterNotify");
|
||||||
|
#endif
|
||||||
m_cursorEventX = event.xcrossing.x;
|
m_cursorEventX = event.xcrossing.x;
|
||||||
m_cursorEventY = event.xcrossing.y;
|
m_cursorEventY = event.xcrossing.y;
|
||||||
//EWOL_DEBUG("X11 event : " << event.type << " = \"EnterNotify\" (" << (etkFloat_t)event.xcrossing.x << "," << (etkFloat_t)event.xcrossing.y << ")");
|
//EWOL_DEBUG("X11 event : " << event.type << " = \"EnterNotify\" (" << (etkFloat_t)event.xcrossing.x << "," << (etkFloat_t)event.xcrossing.y << ")");
|
||||||
//gui_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_ENTER, (etkFloat_t)event.xcrossing.x, (etkFloat_t)event.xcrossing.y);
|
//gui_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_ENTER, (etkFloat_t)event.xcrossing.x, (etkFloat_t)event.xcrossing.y);
|
||||||
break;
|
break;
|
||||||
case LeaveNotify:
|
case LeaveNotify:
|
||||||
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event LeaveNotify");
|
||||||
|
#endif
|
||||||
m_cursorEventX = event.xcrossing.x;
|
m_cursorEventX = event.xcrossing.x;
|
||||||
m_cursorEventY = event.xcrossing.y;
|
m_cursorEventY = event.xcrossing.y;
|
||||||
//EWOL_DEBUG("X11 event : " << event.type << " = \"LeaveNotify\" (" << (etkFloat_t)event.xcrossing.x << "," << (etkFloat_t)event.xcrossing.y << ")");
|
//EWOL_DEBUG("X11 event : " << event.type << " = \"LeaveNotify\" (" << (etkFloat_t)event.xcrossing.x << "," << (etkFloat_t)event.xcrossing.y << ")");
|
||||||
break;
|
break;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event MotionNotify");
|
||||||
|
#endif
|
||||||
m_cursorEventX = event.xmotion.x;
|
m_cursorEventX = event.xmotion.x;
|
||||||
m_cursorEventY = event.xmotion.y;
|
m_cursorEventY = event.xmotion.y;
|
||||||
{
|
{
|
||||||
@ -693,14 +764,20 @@ void X11_Run(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FocusIn:
|
case FocusIn:
|
||||||
EWOL_VERBOSE("X11 event : " << event.type << " = \"FocusIn\"");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event FocusIn");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case FocusOut:
|
case FocusOut:
|
||||||
EWOL_VERBOSE("X11 event : " << event.type << " = \"FocusOut\"");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event : FocusOut");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
//EWOL_DEBUG("X11 event : " << event.type << " = \"KeyPress/KeyRelease\" ");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event : " << event.type << " = \"KeyPress/KeyRelease\" ");
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
EWOL_DEBUG("eventKey : " << event.xkey.keycode << " state : " << event.xkey.state);
|
EWOL_DEBUG("eventKey : " << event.xkey.keycode << " state : " << event.xkey.state);
|
||||||
if (event.xkey.state & (1<<0) ) {
|
if (event.xkey.state & (1<<0) ) {
|
||||||
@ -883,36 +960,55 @@ void X11_Run(void)
|
|||||||
specialEvent.move = keyInput;
|
specialEvent.move = keyInput;
|
||||||
EWOL_ThreadKeyboardEventMove(specialEvent);
|
EWOL_ThreadKeyboardEventMove(specialEvent);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
//case DestroyNotify:
|
//case DestroyNotify:
|
||||||
// break;
|
// break;
|
||||||
case MapNotify:
|
case MapNotify:
|
||||||
EWOL_VERBOSE("X11 event : " << event.type << " = \"MapNotify\"");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event : MapNotify");
|
||||||
|
#endif
|
||||||
EWOL_ThreadEventShow();
|
EWOL_ThreadEventShow();
|
||||||
break;
|
break;
|
||||||
case UnmapNotify:
|
case UnmapNotify:
|
||||||
EWOL_VERBOSE("X11 event : " << event.type << " = \"UnmapNotify\"");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event : UnmapNotify");
|
||||||
|
#endif
|
||||||
EWOL_ThreadEventHide();
|
EWOL_ThreadEventHide();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
EWOL_DEBUG("X11 event : " << event.type << " = \"???\"");
|
#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 event : " << event.type << " = \"???\"");
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(true == m_run) {
|
if(true == m_run) {
|
||||||
|
//#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 Render...");
|
||||||
|
//#endif
|
||||||
|
XLockDisplay(m_display);
|
||||||
EWOL_NativeRender();
|
EWOL_NativeRender();
|
||||||
|
XUnlockDisplay(m_display);
|
||||||
}
|
}
|
||||||
|
//#ifdef DEBUG_X11_EVENT
|
||||||
|
EWOL_INFO("X11 endEvent --- ");
|
||||||
|
//#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void X11_ChangeSize(int32_t w, int32_t h)
|
void X11_ChangeSize(int32_t w, int32_t h)
|
||||||
{
|
{
|
||||||
|
XLockDisplay(m_display);
|
||||||
XResizeWindow(m_display, WindowHandle, w, h);
|
XResizeWindow(m_display, WindowHandle, w, h);
|
||||||
|
XUnlockDisplay(m_display);
|
||||||
};
|
};
|
||||||
|
|
||||||
void X11_ChangePos(int32_t x, int32_t y)
|
void X11_ChangePos(int32_t x, int32_t y)
|
||||||
{
|
{
|
||||||
|
XLockDisplay(m_display);
|
||||||
XMoveWindow(m_display, WindowHandle, x, y);
|
XMoveWindow(m_display, WindowHandle, x, y);
|
||||||
|
XUnlockDisplay(m_display);
|
||||||
};
|
};
|
||||||
|
|
||||||
void X11_GetAbsPos(int32_t & x, int32_t & y)
|
void X11_GetAbsPos(int32_t & x, int32_t & y)
|
||||||
@ -920,7 +1016,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);
|
||||||
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -939,12 +1037,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);
|
||||||
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);
|
||||||
// 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) {
|
||||||
@ -960,12 +1060,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);
|
||||||
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);
|
||||||
// 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) {
|
||||||
@ -992,7 +1094,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);
|
||||||
XSetSelectionOwner(m_display, XAtomeSelection, WindowHandle, CurrentTime);
|
XSetSelectionOwner(m_display, XAtomeSelection, WindowHandle, CurrentTime);
|
||||||
|
XUnlockDisplay(m_display);
|
||||||
l_clipBoardOwnerPrimary = true;
|
l_clipBoardOwnerPrimary = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1003,7 +1107,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);
|
||||||
XSetSelectionOwner(m_display, XAtomeClipBoard, WindowHandle, CurrentTime);
|
XSetSelectionOwner(m_display, XAtomeClipBoard, WindowHandle, CurrentTime);
|
||||||
|
XUnlockDisplay(m_display);
|
||||||
l_clipBoardOwnerStd = true;
|
l_clipBoardOwnerStd = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user