Skip to content

game_activity: Fix pointer_index() always returning 0#84

Merged
rib merged 1 commit into
rust-mobile:mainfrom
sannyun:pointer_index_fix
May 24, 2023
Merged

game_activity: Fix pointer_index() always returning 0#84
rib merged 1 commit into
rust-mobile:mainfrom
sannyun:pointer_index_fix

Conversation

@sannyun
Copy link
Copy Markdown
Contributor

@sannyun sannyun commented May 23, 2023

Given AMOTION_EVENT_ACTION_MASK is 0xff and AMOTION_EVENT_ACTION_POINTER_INDEX_MASK is 0xff00, this function always returns 0. Looks like ANDing with AMOTION_EVENT_ACTION_MASK should be removed.

Copy link
Copy Markdown
Member

@MarijnS95 MarijnS95 left a comment

Choose a reason for hiding this comment

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

I agree, this is also what we do in the NDK (and these APIs look pretty much identical)

https://github.com/rust-mobile/ndk/blob/b3a148e804ce29c78a43131afdac2aecf7f8ab8c/ndk/src/event.rs#L424-L432

Perhaps @rib intended to use self.action on the next line, and instead use action to validate whether the MOTION_ACCESS in one of Up/Down/PointerUp/PointerDown?

@MarijnS95 MarijnS95 changed the title pointer_index always returns 0 game_activity: Fix pointer_index() always returning 0 May 24, 2023
@rib
Copy link
Copy Markdown
Member

rib commented May 24, 2023

Thanks, yeah this looks wrong. I doubt I was planning to validate the action and probably just made a mistake at the time, oops.

@rib rib merged commit 924e540 into rust-mobile:main May 24, 2023
@sannyun sannyun deleted the pointer_index_fix branch May 25, 2023 07:13
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.

3 participants