mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-12-10 23:22:39 +08:00
fix viewtreeobserver's listeners,view's onTouchModeChange working.
This commit is contained in:
parent
bd37128832
commit
10ce6a3440
@ -293,6 +293,11 @@ void WindowManager::onMotion(MotionEvent&event) {
|
||||
const int y = event.getY();
|
||||
for (auto itr = mWindows.rbegin();itr != mWindows.rend();itr++) {
|
||||
auto w = (*itr);
|
||||
ViewTreeObserver*obv = w->getViewTreeObserver();
|
||||
if(event.getAction()==MotionEvent::ACTION_DOWN)
|
||||
obv->dispatchOnTouchModeChanged(true);
|
||||
else if(event.getAction()==MotionEvent::ACTION_UP)
|
||||
obv->dispatchOnTouchModeChanged(false);
|
||||
if ((w->getVisibility()==View::VISIBLE) && w->getBound().contains(x,y)) {
|
||||
event.offsetLocation(-w->getLeft(),-w->getTop());
|
||||
w->dispatchTouchEvent(event);
|
||||
|
@ -152,9 +152,6 @@ void ViewTreeObserver::addOnWindowFocusChangeListener(OnWindowFocusChangeListene
|
||||
|
||||
void ViewTreeObserver::removeOnWindowFocusChangeListener(OnWindowFocusChangeListener victim) {
|
||||
checkIsAlive();
|
||||
if (mOnWindowFocusListeners.empty()) {
|
||||
return;
|
||||
}
|
||||
auto it = std::find(mOnWindowFocusListeners.begin(),mOnWindowFocusListeners.end(),victim);
|
||||
if(it!=mOnWindowFocusListeners.end())
|
||||
mOnWindowFocusListeners.erase(it);
|
||||
@ -172,9 +169,6 @@ void ViewTreeObserver::addOnGlobalFocusChangeListener(OnGlobalFocusChangeListene
|
||||
|
||||
void ViewTreeObserver::removeOnGlobalFocusChangeListener(OnGlobalFocusChangeListener victim) {
|
||||
checkIsAlive();
|
||||
if (mOnGlobalFocusListeners.empty()) {
|
||||
return;
|
||||
}
|
||||
auto it = std::find(mOnGlobalFocusListeners.begin(),mOnGlobalFocusListeners.end(),victim);
|
||||
if(it != mOnGlobalFocusListeners.end())
|
||||
mOnGlobalFocusListeners.erase(it);
|
||||
@ -197,9 +191,6 @@ void ViewTreeObserver::removeGlobalOnLayoutListener(OnGlobalLayoutListener victi
|
||||
|
||||
void ViewTreeObserver::removeOnGlobalLayoutListener(OnGlobalLayoutListener victim) {
|
||||
checkIsAlive();
|
||||
if (mOnGlobalLayoutListeners.empty()) {
|
||||
return;
|
||||
}
|
||||
auto it = std::find(mOnGlobalLayoutListeners.begin(),mOnGlobalLayoutListeners.end(),victim);
|
||||
if(it != mOnGlobalLayoutListeners.end())
|
||||
mOnGlobalLayoutListeners.erase(it);
|
||||
@ -217,9 +208,6 @@ void ViewTreeObserver::addOnPreDrawListener(OnPreDrawListener listener) {
|
||||
|
||||
void ViewTreeObserver::removeOnPreDrawListener(OnPreDrawListener victim) {
|
||||
checkIsAlive();
|
||||
if (mOnPreDrawListeners.empty()) {
|
||||
return;
|
||||
}
|
||||
auto it = std::find(mOnPreDrawListeners.begin(),mOnPreDrawListeners.end(),victim);
|
||||
if(it!=mOnPreDrawListeners.end())
|
||||
mOnPreDrawListeners.erase(it);
|
||||
@ -240,9 +228,6 @@ void ViewTreeObserver::addOnWindowShownListener(OnWindowShownListener listener)
|
||||
|
||||
void ViewTreeObserver::removeOnWindowShownListener(OnWindowShownListener victim) {
|
||||
checkIsAlive();
|
||||
if (mOnWindowShownListeners.empty()) {
|
||||
return;
|
||||
}
|
||||
auto it = std::find(mOnWindowShownListeners.begin(),mOnWindowShownListeners.end(),victim);
|
||||
if(it!=mOnWindowShownListeners.end())
|
||||
mOnWindowShownListeners.erase(it);
|
||||
@ -269,9 +254,6 @@ void ViewTreeObserver::addOnDrawListener(OnDrawListener listener) {
|
||||
|
||||
void ViewTreeObserver::removeOnDrawListener(OnDrawListener victim) {
|
||||
checkIsAlive();
|
||||
if (mOnDrawListeners.size()) {
|
||||
return;
|
||||
}
|
||||
if (mInDispatchOnDraw) {
|
||||
/*IllegalStateException ex = new IllegalStateException(
|
||||
if (sIllegalOnDrawModificationIsFatal) {
|
||||
@ -297,9 +279,6 @@ void ViewTreeObserver::addOnScrollChangedListener(OnScrollChangedListener listen
|
||||
|
||||
void ViewTreeObserver::removeOnScrollChangedListener(OnScrollChangedListener victim) {
|
||||
checkIsAlive();
|
||||
if (mOnScrollChangedListeners.size()) {
|
||||
return;
|
||||
}
|
||||
auto it = std::find(mOnScrollChangedListeners.begin(),mOnScrollChangedListeners.end(),victim);
|
||||
if(it!=mOnScrollChangedListeners.end())
|
||||
mOnScrollChangedListeners.erase(it);
|
||||
@ -317,9 +296,6 @@ void ViewTreeObserver::addOnTouchModeChangeListener(OnTouchModeChangeListener li
|
||||
|
||||
void ViewTreeObserver::removeOnTouchModeChangeListener(OnTouchModeChangeListener victim) {
|
||||
checkIsAlive();
|
||||
if (mOnTouchModeChangeListeners.size()) {
|
||||
return;
|
||||
}
|
||||
auto it = std::find(mOnTouchModeChangeListeners.begin(),mOnTouchModeChangeListeners.end(),victim);
|
||||
if(it != mOnTouchModeChangeListeners.end())
|
||||
mOnTouchModeChangeListeners.erase(it);
|
||||
@ -337,9 +313,6 @@ void ViewTreeObserver::addOnComputeInternalInsetsListener(OnComputeInternalInset
|
||||
|
||||
void ViewTreeObserver::removeOnComputeInternalInsetsListener(OnComputeInternalInsetsListener victim) {
|
||||
checkIsAlive();
|
||||
if (mOnComputeInternalInsetsListeners.size()) {
|
||||
return;
|
||||
}
|
||||
auto it = std::find(mOnComputeInternalInsetsListeners.begin(),mOnComputeInternalInsetsListeners.end(),victim);
|
||||
if(it!=mOnComputeInternalInsetsListeners.end())
|
||||
mOnComputeInternalInsetsListeners.erase(it);
|
||||
@ -347,17 +320,11 @@ void ViewTreeObserver::removeOnComputeInternalInsetsListener(OnComputeInternalIn
|
||||
|
||||
void ViewTreeObserver::addOnEnterAnimationCompleteListener(OnEnterAnimationCompleteListener listener) {
|
||||
checkIsAlive();
|
||||
if (mOnEnterAnimationCompleteListeners.size()) {
|
||||
//mOnEnterAnimationCompleteListeners = new CopyOnWriteArrayList<OnEnterAnimationCompleteListener>();
|
||||
}
|
||||
mOnEnterAnimationCompleteListeners.push_back(listener);
|
||||
}
|
||||
|
||||
void ViewTreeObserver::removeOnEnterAnimationCompleteListener(OnEnterAnimationCompleteListener listener) {
|
||||
checkIsAlive();
|
||||
if (mOnEnterAnimationCompleteListeners.size()) {
|
||||
return;
|
||||
}
|
||||
auto it =std::find(mOnEnterAnimationCompleteListeners.begin(),mOnEnterAnimationCompleteListeners.end(),listener);
|
||||
if(it != mOnEnterAnimationCompleteListeners.end())
|
||||
mOnEnterAnimationCompleteListeners.erase(it);
|
||||
|
@ -40,7 +40,7 @@ static char *msgBoddy=nullptr;
|
||||
static constexpr int kMaxMessageSize=2048;
|
||||
|
||||
static void LogInit() {
|
||||
#if ASYNC_LOG
|
||||
#if defined(ASYNC_LOG)&&ASYNC_LOG
|
||||
static std::once_flag sInit;
|
||||
std::call_once(sInit,[&]() {
|
||||
msgBoddy =new char[kMaxMessageSize];
|
||||
@ -61,7 +61,7 @@ void LogPrintf(int level,const char*file,const char*func,int line,const char*for
|
||||
const std::string tag=splitFileName(file);
|
||||
auto it=sModules.find(tag);
|
||||
const int module_loglevel=(it==sModules.end())?sLogLevel:it->second;
|
||||
#if ASYNC_LOG
|
||||
#if defined(ASYNC_LOG )&&ASYNC_LOG
|
||||
const char*colors[]= {"\033[0m","\033[1m","\033[0;32m","\033[0;36m","\033[1;31m","\033[5;31m"};
|
||||
if(level<module_loglevel||level<0||level>LOG_FATAL)
|
||||
return;
|
||||
@ -86,7 +86,7 @@ void LogPrintf(int level,const char*file,const char*func,int line,const char*for
|
||||
#endif
|
||||
}
|
||||
|
||||
void LogDump(int level,const char*tag,const char*func,int line,const char*label,const BYTE*data,int len) {
|
||||
void LogDump(int level,const char*tag,const char*func,int line,const char*label,const unsigned char*data,int len) {
|
||||
char buff[128];
|
||||
int i,taglen=0;
|
||||
taglen = sprintf(buff,"%s[%d]",label,len);
|
||||
@ -179,7 +179,7 @@ LogMessage::~LogMessage() {
|
||||
if (!str.empty()) oss << str ;
|
||||
log_entry_ += oss.str();
|
||||
log_entry_ +="\033[0m\n";
|
||||
#if ASYNC_LOG
|
||||
#if defined(ASYNC_LOG)&&ASYNC_LOG
|
||||
dbgMessages.push(log_entry_);
|
||||
#else
|
||||
printf("%s",log_entry_.c_str());
|
||||
|
@ -89,8 +89,11 @@ int GFXInit() {
|
||||
ret = MI_SYS_MMA_Alloc("mma_heap_name0",allocedSize,&preallocedMem);
|
||||
int index = 1;
|
||||
devSurfaces[0].kbuffer = devs[0].fix.smem_start;
|
||||
#if defined(DOUBLE_BUFFER)&&DOUBLE_BUFFER
|
||||
devSurfaces[0].msize = dev->fix.smem_len;
|
||||
#else
|
||||
devSurfaces[0].msize = displayScreenSize;
|
||||
|
||||
#endif
|
||||
if((devs[0].fix.smem_start+displayScreenSize<preallocedMem)||(devs[0].fix.smem_start>preallocedMem+allocedSize)){
|
||||
LOGD("fbmem %x,%x is not in prealocted memory's range",devs[0].fix.smem_start,devs[0].fix.smem_start+displayScreenSize);
|
||||
for(int i=0;i<MAX_HWSURFACE+1;i++){
|
||||
@ -252,8 +255,9 @@ INT GFXFlip(HANDLE surface) {
|
||||
surf->kbuffer-=screen_size;
|
||||
}
|
||||
surf->current=(surf->current+1)%2;
|
||||
int sync = ioctl(dev->fb, FBIO_WAITFORVSYNC, NULL);
|
||||
int ret=ioctl(dev->fb, FBIOPAN_DISPLAY, &dev->var);
|
||||
LOGI_IF(ret<0,"FBIOPAN_DISPLAY=%d yoffset=%d res=%dx%d dev=%p fb=%d",ret,dev->var.yoffset,dev->var.xres,dev->var.yres,dev,dev->fb);
|
||||
LOGI_IF(ret<0||sync<0,"FBIOPAN_DISPLAY=%d yoffset=%d res=%dx%d dev=%p fb=%d,sync=%d",ret,dev->var.yoffset,dev->var.xres,dev->var.yres,dev,dev->fb,sync);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -307,12 +311,11 @@ INT GFXCreateSurface(int dispid,HANDLE*surface,UINT width,UINT height,INT format
|
||||
surf->ishw = hwsurface;
|
||||
surf->pitch= surf->width*4;
|
||||
surf->current = 0;
|
||||
#if !defined(DOUBLE_BUFFER)||(DOUBLE_BUFFER==0)
|
||||
surf->msize= surf->pitch*surf->height;
|
||||
#endif
|
||||
MI_S32 ret=0;
|
||||
if(hwsurface) {
|
||||
#if defined(DOUBLE_BUFFER)&&DOUBLE_BUFFER
|
||||
surf->msize*= 2;
|
||||
#endif
|
||||
#if !defined(DOUBLE_BUFFER)||(DOUBLE_BUFFER==0)
|
||||
dev->var.yoffset=0;
|
||||
LOGI("ioctl offset(0)=%d dev=%p ret=%d",ioctl(dev->fb,FBIOPAN_DISPLAY,&dev->var),dev,ret);
|
||||
|
Loading…
Reference in New Issue
Block a user