You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-15 13:51:40 +00:00
Merge pull request #95460 from m4gr3d/enable_mouse_forward_back_buttons
Enable `BUTTON_FORWARD` and `BUTTON_BACK` mouse buttons on Android
This commit is contained in:
@@ -2030,16 +2030,16 @@
|
|||||||
Help key.
|
Help key.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="KEY_BACK" value="4194376" enum="Key">
|
<constant name="KEY_BACK" value="4194376" enum="Key">
|
||||||
Media back key. Not to be confused with the Back button on an Android device.
|
Back key.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="KEY_FORWARD" value="4194377" enum="Key">
|
<constant name="KEY_FORWARD" value="4194377" enum="Key">
|
||||||
Media forward key.
|
Forward key.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="KEY_STOP" value="4194378" enum="Key">
|
<constant name="KEY_STOP" value="4194378" enum="Key">
|
||||||
Media stop key.
|
Media stop key.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="KEY_REFRESH" value="4194379" enum="Key">
|
<constant name="KEY_REFRESH" value="4194379" enum="Key">
|
||||||
Media refresh key.
|
Refresh key.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="KEY_VOLUMEDOWN" value="4194380" enum="Key">
|
<constant name="KEY_VOLUMEDOWN" value="4194380" enum="Key">
|
||||||
Volume down key.
|
Volume down key.
|
||||||
|
|||||||
@@ -4266,8 +4266,14 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
|
|||||||
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/show_in_file_system", TTR("Show in FileSystem")), SHOW_IN_FILE_SYSTEM);
|
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/show_in_file_system", TTR("Show in FileSystem")), SHOW_IN_FILE_SYSTEM);
|
||||||
file_menu->get_popup()->add_separator();
|
file_menu->get_popup()->add_separator();
|
||||||
|
|
||||||
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_previous", TTR("History Previous"), KeyModifierMask::ALT | Key::LEFT), WINDOW_PREV);
|
file_menu->get_popup()->add_shortcut(
|
||||||
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_next", TTR("History Next"), KeyModifierMask::ALT | Key::RIGHT), WINDOW_NEXT);
|
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);
|
||||||
ED_SHORTCUT_OVERRIDE("script_editor/history_previous", "macos", KeyModifierMask::ALT | KeyModifierMask::META | Key::LEFT);
|
ED_SHORTCUT_OVERRIDE("script_editor/history_previous", "macos", KeyModifierMask::ALT | KeyModifierMask::META | Key::LEFT);
|
||||||
ED_SHORTCUT_OVERRIDE("script_editor/history_next", "macos", KeyModifierMask::ALT | KeyModifierMask::META | Key::RIGHT);
|
ED_SHORTCUT_OVERRIDE("script_editor/history_next", "macos", KeyModifierMask::ALT | KeyModifierMask::META | Key::RIGHT);
|
||||||
|
|
||||||
|
|||||||
@@ -970,15 +970,10 @@ class Godot(private val context: Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun onBackPressed() {
|
fun onBackPressed() {
|
||||||
var shouldQuit = true
|
|
||||||
for (plugin in pluginRegistry.allPlugins) {
|
for (plugin in pluginRegistry.allPlugins) {
|
||||||
if (plugin.onMainBackPressed()) {
|
plugin.onMainBackPressed()
|
||||||
shouldQuit = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (shouldQuit) {
|
|
||||||
renderView?.queueOnRenderThread { GodotLib.back() }
|
|
||||||
}
|
}
|
||||||
|
renderView?.queueOnRenderThread { GodotLib.back() }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -154,10 +154,6 @@ public class GodotInputHandler implements InputManager.InputDeviceListener, Sens
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean onKeyUp(final int keyCode, KeyEvent event) {
|
public boolean onKeyUp(final int keyCode, KeyEvent event) {
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
|
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -183,13 +179,6 @@ public class GodotInputHandler implements InputManager.InputDeviceListener, Sens
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean onKeyDown(final int keyCode, KeyEvent event) {
|
public boolean onKeyDown(final int keyCode, KeyEvent event) {
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
|
||||||
godot.onBackPressed();
|
|
||||||
// press 'back' button should not terminate program
|
|
||||||
//normal handle 'back' event in game logic
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
|
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user