-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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
Enable BUTTON_FORWARD
and BUTTON_BACK
mouse buttons on Android
#95460
Enable BUTTON_FORWARD
and BUTTON_BACK
mouse buttons on Android
#95460
Conversation
90959ca
to
2fcdb44
Compare
2fcdb44
to
d4ac225
Compare
a917a0f
to
9d8d5ee
Compare
The documentation for KEY_BACK says "Media back key. Not to be confused with the Back button on an Android device.". Is it outdated, or does it refer to a different BACK key? |
9d8d5ee
to
d1891ad
Compare
Media back key. Not to be confused with the Back button on an Android device. | ||
Back key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure about this? This was documented by @Calinou in #41581 based on this comment: #19325 (comment)
Did the mapping change since then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least on Linux it seems to refer to the "Internet" browsing keys of the keyboards of yore: https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/blob/master/include/X11/XF86keysym.h#L64
As well as possibly the (also history-related) "back" key on some Chromebooks keyboards, according to our code (scancode_map[0xA6] = Key::BACK; // On Chromebooks
).
Seems to be a similar situation on Windows: vk_map[VK_BROWSER_BACK] = Key::BACK; // (0xA6)
And on Android it's indeed
47: { AKEYCODE_BACK, Key::BACK }, // (4) Back key.
But the Android NDK docs don't really say more about this. They also have a mapping for AKEYCODE_FORWARD
, what's a Forward key on an Android device?
We would need to check whether #19325 is still true or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Android mouse's
BUTTON_FORWARD
andBUTTON_BACK
buttons are dispatched as key events.
I may be wrong but to me it looks like this PR makes it so that those Android-exclusive inputs are sent through KEY_BACK
and KEY_FORWARD
inputs.
With that said, please do not change the description to be unusually succinct again. On desktop platforms these keys really refer to the Media keys, which are definitely not the same as the additional mouse buttons.
At least clarify that on Android, these correspond to certain other keys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh boy, after reading your reply, there's a whole rabbit hole to dissect about the purpose of these keys on various platforms, huh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They also have a mapping for AKEYCODE_FORWARD, what's a Forward key on an Android device?
The forward key on Android is mapped to KEYCODE_FORWARD
:
Key code constant: Forward key. Navigates forward in the history stack. Complement of KEYCODE_BACK.
We would need to check whether #19325 is still true or not.
I don't think the documentation update was ever correct on Android. back
events on Android are special but are still sent as back
key events and dispatched via numerous devices (e.g: touch button, mouse, keyboard, etc..), so the mapping in Godot should indeed be KEY_BACK
and should be available to the game logic which this PR fixes.
Media back key. Not to be confused with the Back button on an Android device. | ||
Back key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Android mouse's
BUTTON_FORWARD
andBUTTON_BACK
buttons are dispatched as key events.
I may be wrong but to me it looks like this PR makes it so that those Android-exclusive inputs are sent through KEY_BACK
and KEY_FORWARD
inputs.
With that said, please do not change the description to be unusually succinct again. On desktop platforms these keys really refer to the Media keys, which are definitely not the same as the additional mouse buttons.
At least clarify that on Android, these correspond to certain other keys.
file_menu->get_popup()->add_shortcut( | ||
ED_SHORTCUT_ARRAY("script_editor/history_previous", TTR("History Previous"), | ||
{ int32_t(KeyModifierMask::ALT | Key::LEFT), int32_t(Key::BACK) }), | ||
WINDOW_PREV); | ||
file_menu->get_popup()->add_shortcut( | ||
ED_SHORTCUT_ARRAY("script_editor/history_next", TTR("History Next"), | ||
{ int32_t(KeyModifierMask::ALT | Key::RIGHT), int32_t(Key::FORWARD) }), | ||
WINDOW_NEXT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned above, these keys really refer to the Media keys. They are used for video and music playback, so this mapping is rather unorthodox on desktop.
@akien-mga @KoBeWi @Mickeon Ping on this PR. From the last comment, it doesn't look like there are blockers to going ahead with adding this functionality. |
Thanks! |
Follow up to #36910 for Android; Android mouse's
BUTTON_FORWARD
andBUTTON_BACK
buttons are dispatched as key events.