Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maybe fix duplicated DPAD events #4255

Open
wants to merge 1 commit into
base: 25.lts.1+
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions starboard/android/shared/input_events_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -829,10 +829,6 @@ bool InputEventsGenerator::CreateInputEventsFromGameActivityEvent(
ProcessJoyStickEvent(kLeftY, AMOTION_EVENT_AXIS_Y, android_event, events);
ProcessJoyStickEvent(kRightX, AMOTION_EVENT_AXIS_Z, android_event, events);
ProcessJoyStickEvent(kRightY, AMOTION_EVENT_AXIS_RZ, android_event, events);

// Remember the "hat" input values (dpad on the game controller) to help
// differentiate hat vs. stick fallback events.
UpdateHatValuesAndPossiblySynthesizeKeyEvents(android_event, events);
}

// Lie to Android and tell it that we did not process the motion event,
Expand Down Expand Up @@ -890,25 +886,6 @@ void InputEventsGenerator::ProcessFallbackDPadEvent(
}
}

// Update |InputEventsGenerator::hat_value_| according to the incoming motion
// event's data. Possibly generate DPad events based on any changes in value
// here.
void InputEventsGenerator::UpdateHatValuesAndPossiblySynthesizeKeyEvents(
GameActivityMotionEvent* android_motion_event,
Events* events) {
float new_hat_x = GameActivityPointerAxes_getAxisValue(
&android_motion_event->pointers[0], AMOTION_EVENT_AXIS_HAT_X);
PossiblySynthesizeHatKeyEvents(kHatX, hat_value_[kHatX], new_hat_x, window_,
android_motion_event, events);
hat_value_[kHatX] = new_hat_x;

float new_hat_y = GameActivityPointerAxes_getAxisValue(
&android_motion_event->pointers[0], AMOTION_EVENT_AXIS_HAT_Y);
PossiblySynthesizeHatKeyEvents(kHatY, hat_value_[kHatY], new_hat_y, window_,
android_motion_event, events);
hat_value_[kHatY] = new_hat_y;
}

void InputEventsGenerator::UpdateDeviceFlatMapIfNecessary(
GameActivityMotionEvent* android_motion_event,
jobject input_device) {
Expand Down
Loading