Skip to content

Conversation

@QQQQWAS
Copy link
Contributor

@QQQQWAS QQQQWAS commented Apr 30, 2025

No description provided.

switch(flags){
case AMOTION_EVENT_ACTION_POINTER_UP:
case AMOTION_EVENT_ACTION_UP:{
touch_is_down[pid] = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the value of pid to make sure it doesn't overflow the array of touch_is_down

CNFGEGLDriver.c Outdated
HandleButton( x, y, id, 0 );
case AMOTION_EVENT_ACTION_POINTER_DOWN:
case AMOTION_EVENT_ACTION_DOWN:{
touch_is_down[id] = 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check to make sure you don't overflow the array.

CNFGEGLDriver.c Outdated
HandleMotion( x, y, index );
case AMOTION_EVENT_ACTION_MOVE:{
int off = 0; //number of touches preceeding i that are not down
for(int i = 0; i-off < pointer_count && pid+i<10; i++){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a #define for the number of touches.

@QQQQWAS
Copy link
Contributor Author

QQQQWAS commented May 1, 2025

like this?

size_t pointerCount = AMotionEvent_getPointerCount(event);
int pointer_count = AMotionEvent_getPointerCount(event);
int32_t action = AMotionEvent_getAction(event);
int flags = action & AMOTION_EVENT_ACTION_MASK;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be still my heart! Even better!

@cnlohr
Copy link
Member

cnlohr commented May 1, 2025

Yes, this looks great. Thank you for the work!

@cnlohr cnlohr merged commit b1b9452 into cntools:master May 1, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants