diff --git a/.efrocachemap b/.efrocachemap index ba270cbd..95f67d38 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -421,10 +421,10 @@ "build/assets/ba_data/audio/zoeOw.ogg": "74befe45a8417e95b6a2233c51992a26", "build/assets/ba_data/audio/zoePickup01.ogg": "48ab8cddfcde36a750856f3f81dd20c8", "build/assets/ba_data/audio/zoeScream01.ogg": "2b468aedfa8741090247f04eb9e6df55", - "build/assets/ba_data/data/langdata.json": "1b939f3099af72667d06820b1474ffb9", - "build/assets/ba_data/data/languages/arabic.json": "d1f900ab5aa2433d402bd46ed1149cc7", + "build/assets/ba_data/data/langdata.json": "7a5f49ae1738b012a6d7c16740af80a0", + "build/assets/ba_data/data/languages/arabic.json": "295c559911fa251f401f8cdcad91c226", "build/assets/ba_data/data/languages/belarussian.json": "e151808b6b4f6dc159cf55ee62adad3c", - "build/assets/ba_data/data/languages/chinese.json": "8d889accdd49334591209bdaf6eaf02f", + "build/assets/ba_data/data/languages/chinese.json": "b0d4e874ba8d22c8fd0d7a0eaaf96ac9", "build/assets/ba_data/data/languages/chinesetraditional.json": "f858da49be0a5374157c627857751078", "build/assets/ba_data/data/languages/croatian.json": "766532c67af5bd0144c2d63cab0516fa", "build/assets/ba_data/data/languages/czech.json": "93c5fe0d884d95435da6c675f64e30e0", @@ -440,21 +440,21 @@ "build/assets/ba_data/data/languages/hindi.json": "88ee0cda537bab9ac827def5e236fe1a", "build/assets/ba_data/data/languages/hungarian.json": "796a290a8c44a1e7635208c2ff5fdc6e", "build/assets/ba_data/data/languages/indonesian.json": "bff88ce57744a639810b93a1d1dd79f4", - "build/assets/ba_data/data/languages/italian.json": "338e7a03dff47f4eefc0ca3a995cd4f4", + "build/assets/ba_data/data/languages/italian.json": "58ecf53a963dbeca1bbf3605e5ab6a2f", "build/assets/ba_data/data/languages/korean.json": "ca1122a9ee551da3f75ae632012bd0e2", "build/assets/ba_data/data/languages/malay.json": "832562ce997fc70704b9234c95fb2e38", "build/assets/ba_data/data/languages/persian.json": "71cc5b33abda0f285b970b8cc4a014a8", "build/assets/ba_data/data/languages/polish.json": "e1a1a801851924748ad38fa68216439a", "build/assets/ba_data/data/languages/portuguese.json": "9fcd6b4da9e5d0dc0e337ab00b5debe2", "build/assets/ba_data/data/languages/romanian.json": "aeebdd54f65939c2facc6ac50c117826", - "build/assets/ba_data/data/languages/russian.json": "7f1689fff58321fdaa632cb9c45105df", + "build/assets/ba_data/data/languages/russian.json": "70f79c606ccc5ec7bd6ce0303fdece70", "build/assets/ba_data/data/languages/serbian.json": "d7452dd72ac0e51680cb39b5ebaa1c69", "build/assets/ba_data/data/languages/slovak.json": "27962d53dc3f7dd4e877cd40faafeeef", - "build/assets/ba_data/data/languages/spanish.json": "bd1e3a209f2e129e8aafe668cf48a26a", + "build/assets/ba_data/data/languages/spanish.json": "6ccd728df4766be1969434d6f04c36d2", "build/assets/ba_data/data/languages/swedish.json": "77d671f10613291ebf9c71da66f18a18", "build/assets/ba_data/data/languages/tamil.json": "65ab7798d637fa62a703750179eeb723", "build/assets/ba_data/data/languages/thai.json": "33f63753c9af9a5b238d229a0bf23fbc", - "build/assets/ba_data/data/languages/turkish.json": "9d7e58c9062dc517c3779c255a9b3142", + "build/assets/ba_data/data/languages/turkish.json": "42318070b817663f671d78a9c8f3019c", "build/assets/ba_data/data/languages/ukrainian.json": "f72eb51abfbbb56e27866895d7e947d2", "build/assets/ba_data/data/languages/venetian.json": "88595b7ee696b4094d7874c3c4188852", "build/assets/ba_data/data/languages/vietnamese.json": "921cd1e50f60fe3e101f246e172750ba", @@ -4056,50 +4056,50 @@ "build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1", "build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae", "build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "32bb83a4f89e01aa643757b0cb13b109", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "e710eeae8cc6ebfafe869b860528437c", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "605497ca84eba13f05d08fb16cba5741", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "3b88d767fc74e9169a24c707e5f1b075", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "edc3598904990e1224bbb922c5a49034", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "3e4cfe6ef623f8c6263ebd4be0837762", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "6a76e3a83ad2129cc1eefe627fd53d48", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "6245c26fe2355a955ed668fbf39545c9", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "330b0cc59fc767d5263ef2136f7a7611", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "09230899c32ad2ad72a45849937206b3", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "3ea59821a409a4ebca355ed3ce6efb05", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "9a54eca69f5746b02eeddd3b91cc4411", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "ef7fca726c6fb0324412efe93c01ad90", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "430599b16acfbc01b769539d422434b0", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "dc41efdaf2d6d441545008a55c6fa465", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "78a7ce5e1d4502da430f452dd66ff8fc", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "75062e8500654d7041127bad885e3d41", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "9bc73b6a26c1a3337a28b55de99e1c9e", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "d78640a51f84484fdbe5bcdded3e4262", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "55ec3263f4ed2f62c9a6825dd7a54169", - "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "80ff019ab0715f68dc4cae15c7a9fdab", - "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "bbe53e6685130822cbba276f63b76dcb", - "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "80ff019ab0715f68dc4cae15c7a9fdab", - "build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "bbe53e6685130822cbba276f63b76dcb", - "build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "0d0737d71a7efe201e5ebadeb5f12c71", - "build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "895099e15bad328666f71869f6f09b79", - "build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "0d0737d71a7efe201e5ebadeb5f12c71", - "build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "895099e15bad328666f71869f6f09b79", - "build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "79e38e7d6eb4a5810bbb22e94d4e87ee", - "build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "2cf7ef381bc7408c21f4ea444815233e", - "build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "79e38e7d6eb4a5810bbb22e94d4e87ee", - "build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "2cf7ef381bc7408c21f4ea444815233e", - "build/prefab/lib/mac_x86_64_gui/debug/libballisticaplus.a": "5d457e3b58015c9da26a7911a6c8ed5a", - "build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "70d5ec6b86c91c787a182da729737951", - "build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "444861c2242f3f0b9e09046b6cbf0245", - "build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "70d5ec6b86c91c787a182da729737951", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "864a9cbab9f9585aee77de74198a7972", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "74b8380f81af7e753f474432d90a29ff", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "adaf30a163aecc89a70c796bbbe26834", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "0dac2937a62d13700550dbc73e1c0d2c", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "df398f3b1cf28ef14c6cc6f5983f2180", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "87465318edc11b17f84de48d555d895a", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "0744a823a205fa95a12f7fe3ecb480cc", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "859de1201dd68abbd308f95514a6375b", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "ece14cc6d7a449f581c810a2d6d3449d", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "b0b75bde134af8c73aa1f7e239bd84dc", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "f0742e77993c006a5f2df3e9bee6732e", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "b803f154b4bf2aeb908a603fa7888301", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "2be90b3e6fc6908448a7677dd3cfb594", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "4d12d1887901f7c77b5df965bb0b4622", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "987f4e024c7ed08e58223369b40aa309", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "7dd6ce5ab63d9d255029fb907cf6fb63", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "ad505c3ad979b2cf52c664ee79798575", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "3773aa5c6d396b4c38883321067f5523", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "748f3877c0ac40f48ebc5d8aab442173", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "2d059f03286603ac416718eb262241ab", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "3bd988564ed41c15b4d0f493eced88ef", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "f01539e046d72d86d63da0b4b6fc28df", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "d554e6d3ef9709ad7d7c848633901089", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "967375f76d43831afd7e10208502dcc1", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "7dba8e8a0b8ffbe7f8d73b33b0c41ed5", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "11ccabb65197c9f2e3059ac434888e11", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "8d79aece6620eb017896a7e816a78f0d", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "a3331c3d60962e7f0c2b62728bf7f43e", + "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "1636f9569ee8b8a6c0abed5c9e31e3f7", + "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "3fc153ee973090358916b90938429931", + "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "1636f9569ee8b8a6c0abed5c9e31e3f7", + "build/prefab/lib/linux_arm64_server/release/libballisticaplus.a": "3fc153ee973090358916b90938429931", + "build/prefab/lib/linux_x86_64_gui/debug/libballisticaplus.a": "1c7ed5b60c2961cf7d1a918157f90bce", + "build/prefab/lib/linux_x86_64_gui/release/libballisticaplus.a": "0cbfd345b7e6a02d2a6bdfe7966d03d1", + "build/prefab/lib/linux_x86_64_server/debug/libballisticaplus.a": "1c7ed5b60c2961cf7d1a918157f90bce", + "build/prefab/lib/linux_x86_64_server/release/libballisticaplus.a": "0cbfd345b7e6a02d2a6bdfe7966d03d1", + "build/prefab/lib/mac_arm64_gui/debug/libballisticaplus.a": "1360496e008c0d0fb631b2fde94e0d54", + "build/prefab/lib/mac_arm64_gui/release/libballisticaplus.a": "f64f8060f46a1f7088c7aadef33220dd", + "build/prefab/lib/mac_arm64_server/debug/libballisticaplus.a": "1360496e008c0d0fb631b2fde94e0d54", + "build/prefab/lib/mac_arm64_server/release/libballisticaplus.a": "f64f8060f46a1f7088c7aadef33220dd", + "build/prefab/lib/mac_x86_64_gui/debug/libballisticaplus.a": "dc45874c7796f4fc740c224243efac28", + "build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "c7e7528347b1ec5bc37b13ed8ae88df1", + "build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "abeca8c975a6cd5766fc90df99e8dcd1", + "build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "c7e7528347b1ec5bc37b13ed8ae88df1", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "7aa3fa305f66461ec5e5bbc550aa742d", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "89c02f2300860fded6b44855f9b8407f", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "69f97da125d43fc396eeaea8013cb133", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "9e56ac32e0cc2785811a162de68c69da", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "a62570a46fed2002590be0bafe5055e8", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "b2a10b1eb917197da8f981d5a5daed44", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "c3af2f896ddb7a0b5f2ee2f35bac0318", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "30628de8aa6a7d9cfccf09f102ff9953", "src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c", "src/assets/ba_data/python/babase/_mgen/enums.py": "28323912b56ec07701eda3d41a6a4101", "src/ballistica/base/mgen/pyembed/binding_base.inc": "bb96031e3f844704fcc9a0549a6d2c41", diff --git a/CHANGELOG.md b/CHANGELOG.md index fc387fa0..37afc519 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.28 (build 21473, api 8, 2023-10-16) +### 1.7.28 (build 21479, api 8, 2023-10-17) - Massively cleaned up code related to rendering and window systems (OpenGL, SDL, etc). This code had been growing into a nasty tangle for 15 years diff --git a/src/assets/ba_data/python/babase/_app.py b/src/assets/ba_data/python/babase/_app.py index ffd1f05d..ec0e0d8b 100644 --- a/src/assets/ba_data/python/babase/_app.py +++ b/src/assets/ba_data/python/babase/_app.py @@ -903,7 +903,7 @@ class App: duration = _babase.apptime() - starttime if duration > 1.0: logging.warning( - 'Shutdown-suppressions delayed shutdown longer than ideal ' + 'Shutdown-suppressions lasted longer than ideal ' '(%.2f seconds).', duration, ) diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index 643c752b..9c68772d 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -52,7 +52,7 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 21473 +TARGET_BALLISTICA_BUILD = 21479 TARGET_BALLISTICA_VERSION = '1.7.28' diff --git a/src/assets/ba_data/python/bauiv1lib/settings/controls.py b/src/assets/ba_data/python/bauiv1lib/settings/controls.py index 0b9abd39..168df15c 100644 --- a/src/assets/ba_data/python/bauiv1lib/settings/controls.py +++ b/src/assets/ba_data/python/bauiv1lib/settings/controls.py @@ -98,9 +98,11 @@ class ControlsSettingsWindow(bui.Window): # made-for-iOS/Mac systems # (we can run into problems where devices register as one of each # type otherwise).. + # UPDATE: We always use the apple system these days (which should + # support older controllers). So no need for a switch. show_mac_controller_subsystem = False - if platform == 'mac' and bui.is_xcode_build(): - show_mac_controller_subsystem = True + # if platform == 'mac' and bui.is_xcode_build(): + # show_mac_controller_subsystem = True if show_mac_controller_subsystem: height += spacing * 1.5 @@ -311,6 +313,7 @@ class ControlsSettingsWindow(bui.Window): maxwidth=width * 0.8, ) v -= spacing + if show_mac_controller_subsystem: PopupMenu( parent=self._root_widget, diff --git a/src/ballistica/base/app_adapter/app_adapter.cc b/src/ballistica/base/app_adapter/app_adapter.cc index 80391e90..566383ac 100644 --- a/src/ballistica/base/app_adapter/app_adapter.cc +++ b/src/ballistica/base/app_adapter/app_adapter.cc @@ -303,5 +303,6 @@ auto AppAdapter::CanBackQuit() -> bool { return false; } void AppAdapter::DoBackQuit() { FatalError("Fixme unimplemented."); } void AppAdapter::DoSoftQuit() { FatalError("Fixme unimplemented."); } void AppAdapter::TerminateApp() { FatalError("Fixme unimplemented."); } +auto AppAdapter::HasDirectKeyboardInput() -> bool { return false; } } // namespace ballistica::base diff --git a/src/ballistica/base/app_adapter/app_adapter.h b/src/ballistica/base/app_adapter/app_adapter.h index 7b6339d9..67879ca8 100644 --- a/src/ballistica/base/app_adapter/app_adapter.h +++ b/src/ballistica/base/app_adapter/app_adapter.h @@ -171,6 +171,16 @@ class AppAdapter { /// this point. virtual void TerminateApp(); + /// Should return whether there is a keyboard attached that will deliver + /// direct text-editing related events to the app. When this is false, + /// alternate entry methods such as keyboard-entry-dialogs and on-screen + /// keyboards will be used. This value can change based on conditions such + /// as a hardware keyboard getting attached or detached or the language + /// changing (it may be preferable to rely on dialogs for non-english + /// languages/etc.). Default implementation returns false. This function + /// should be callable from any thread. + virtual auto HasDirectKeyboardInput() -> bool; + protected: AppAdapter(); virtual ~AppAdapter(); diff --git a/src/ballistica/base/app_adapter/app_adapter_apple.cc b/src/ballistica/base/app_adapter/app_adapter_apple.cc index 9c224905..53c4f771 100644 --- a/src/ballistica/base/app_adapter/app_adapter_apple.cc +++ b/src/ballistica/base/app_adapter/app_adapter_apple.cc @@ -230,6 +230,8 @@ auto AppAdapterApple::FullscreenControlKeyShortcut() const return "fn+F"; } +auto AppAdapterApple::HasDirectKeyboardInput() -> bool { return true; }; + } // namespace ballistica::base #endif // BA_XCODE_BUILD diff --git a/src/ballistica/base/app_adapter/app_adapter_apple.h b/src/ballistica/base/app_adapter/app_adapter_apple.h index da14b971..133966b1 100644 --- a/src/ballistica/base/app_adapter/app_adapter_apple.h +++ b/src/ballistica/base/app_adapter/app_adapter_apple.h @@ -40,6 +40,8 @@ class AppAdapterApple : public AppAdapter { auto FullscreenControlKeyShortcut() const -> std::optional override; + auto HasDirectKeyboardInput() -> bool override; + protected: void DoPushMainThreadRunnable(Runnable* runnable) override; void DoPushGraphicsContextRunnable(Runnable* runnable) override; diff --git a/src/ballistica/base/app_adapter/app_adapter_sdl.cc b/src/ballistica/base/app_adapter/app_adapter_sdl.cc index 30c03ee4..51552e14 100644 --- a/src/ballistica/base/app_adapter/app_adapter_sdl.cc +++ b/src/ballistica/base/app_adapter/app_adapter_sdl.cc @@ -845,6 +845,11 @@ auto AppAdapterSDL::FullscreenControlKeyShortcut() const auto AppAdapterSDL::SupportsVSync() -> bool const { return true; } auto AppAdapterSDL::SupportsMaxFPS() -> bool const { return true; } +auto AppAdapterSDL::HasDirectKeyboardInput() -> bool { + // We always provide direct keyboard events. + return true; +} + } // namespace ballistica::base #endif // BA_SDL_BUILD diff --git a/src/ballistica/base/app_adapter/app_adapter_sdl.h b/src/ballistica/base/app_adapter/app_adapter_sdl.h index 78223a24..9f57b127 100644 --- a/src/ballistica/base/app_adapter/app_adapter_sdl.h +++ b/src/ballistica/base/app_adapter/app_adapter_sdl.h @@ -40,6 +40,8 @@ class AppAdapterSDL : public AppAdapter { auto SupportsVSync() -> bool const override; auto SupportsMaxFPS() -> bool const override; + auto HasDirectKeyboardInput() -> bool override; + protected: void DoPushMainThreadRunnable(Runnable* runnable) override; void RunMainThreadEventLoopToCompletion() override; diff --git a/src/ballistica/base/input/input.cc b/src/ballistica/base/input/input.cc index c3b27059..736ecc37 100644 --- a/src/ballistica/base/input/input.cc +++ b/src/ballistica/base/input/input.cc @@ -533,23 +533,28 @@ void Input::UpdateEnabledControllerSubsystems_() { // First off, on mac, let's update whether we want to completely ignore // either the classic or the iOS/Mac controller subsystems. - if (g_buildconfig.ostype_macos()) { - std::string sys = g_base->app_config->Resolve( - AppConfig::StringID::kMacControllerSubsystem); - if (sys == "Classic") { - ignore_mfi_controllers_ = true; - ignore_sdl_controllers_ = false; - } else if (sys == "MFi") { - ignore_mfi_controllers_ = false; - ignore_sdl_controllers_ = true; - } else if (sys == "Both") { - ignore_mfi_controllers_ = false; - ignore_sdl_controllers_ = false; - } else { - BA_LOG_ONCE(LogLevel::kError, - "Invalid mac-controller-subsystem value: '" + sys + "'"); - } - } + // + // UPDATE - these days we're mfi-only on our xcode builds (which should + // support older controllers too). So we don't need to touch ignore vals + // anywhere since we'll not get sdl ones on those builds. + + // if (g_buildconfig.ostype_macos()) { + // std::string sys = g_base->app_config->Resolve( + // AppConfig::StringID::kMacControllerSubsystem); + // if (sys == "Classic") { + // ignore_mfi_controllers_ = true; + // ignore_sdl_controllers_ = false; + // } else if (sys == "MFi") { + // ignore_mfi_controllers_ = false; + // ignore_sdl_controllers_ = true; + // } else if (sys == "Both") { + // ignore_mfi_controllers_ = false; + // ignore_sdl_controllers_ = false; + // } else { + // BA_LOG_ONCE(LogLevel::kError, + // "Invalid mac-controller-subsystem value: '" + sys + "'"); + // } + // } } void Input::OnAppStart() { assert(g_base->InLogicThread()); } @@ -810,10 +815,35 @@ void Input::PushTextInputEvent(const std::string& text) { g_base->logic->event_loop()->PushCall([this, text] { MarkInputActive(); - // Ignore if input is locked. + // If if the app doesn't want direct text input right now. + if (!g_base->app_adapter->HasDirectKeyboardInput()) { + return; + } + + // Ignore if input is locked. if (IsInputLocked()) { return; } + + // We try to handle char filtering here (to keep it consistent across + // platforms) but make a stink if they sent us something that we can't + // at least translate to unicode. + if (!Utils::IsValidUTF8(text)) { + Log(LogLevel::kWarning, "PushTextInputEvent passed invalid utf-8 text."); + return; + } + + // Now scan through unicode vals and ignore stuff like tabs and newlines + // and backspaces. We want to limit this mechanism to direct simple + // lines of text. Anything needing something fancier should go through a + // proper OS-managed text input dialog or whatnot. + auto univals = Utils::UnicodeFromUTF8(text, "80ff83"); + for (auto&& unival : univals) { + if (unival < 32) { + return; + } + } + if (g_base && g_base->ui->dev_console() != nullptr && g_base->ui->dev_console()->HandleTextEditing(text)) { return; diff --git a/src/ballistica/base/ui/ui.cc b/src/ballistica/base/ui/ui.cc index 34ce797d..e9b50093 100644 --- a/src/ballistica/base/ui/ui.cc +++ b/src/ballistica/base/ui/ui.cc @@ -2,6 +2,7 @@ #include "ballistica/base/ui/ui.h" +#include "ballistica/base/app_adapter/app_adapter.h" #include "ballistica/base/audio/audio.h" #include "ballistica/base/graphics/component/simple_component.h" #include "ballistica/base/input/device/keyboard_input.h" @@ -184,15 +185,14 @@ void UI::HandleMouseUp(int button, float x, float y) { } auto UI::UIHasDirectKeyboardInput() const -> bool { - // Currently limiting this to desktop operating systems, but should - // generalize this, as situations such as tablets with hardware keyboards - // should behave similarly to desktop PCs. Though perhaps we should make - // this optional everywhere (or language dependent) since direct keyboard - // input might not work well for some languages even on desktops. - if (g_buildconfig.ostype_macos() || g_buildconfig.ostype_windows() - || g_buildconfig.ostype_linux()) { - // Return true if we've got a keyboard attached and either it or nothing - // is active. + // As a first gate, ask the app-adapter if it is providing keyboard + // events at all. + if (g_base->app_adapter->HasDirectKeyboardInput()) { + // Ok, direct keyboard input is a thing. + // Now let's also require the keyboard (or nothing) to be currently + // driving the UI. If something like a game-controller is driving, + // we'll probably want to pop up a controller-centric on-screen-keyboard + // thingie instead. auto* ui_input_device = g_base->ui->GetUIInputDevice(); if (auto* keyboard = g_base->ui->GetUIInputDevice()) { if (ui_input_device == keyboard || ui_input_device == nullptr) { diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index a9cb1129..ff991ab1 100644 --- a/src/ballistica/shared/ballistica.cc +++ b/src/ballistica/shared/ballistica.cc @@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int { namespace ballistica { // These are set automatically via script; don't modify them here. -const int kEngineBuildNumber = 21473; +const int kEngineBuildNumber = 21479; const char* kEngineVersion = "1.7.28"; const int kEngineApiVersion = 8; diff --git a/src/ballistica/ui_v1/widget/text_widget.cc b/src/ballistica/ui_v1/widget/text_widget.cc index 2225580c..edeeeaea 100644 --- a/src/ballistica/ui_v1/widget/text_widget.cc +++ b/src/ballistica/ui_v1/widget/text_widget.cc @@ -562,12 +562,7 @@ void TextWidget::Activate() { } auto TextWidget::ShouldUseStringEditor_() const -> bool { - if (g_core->HeadlessMode()) { - BA_LOG_ONCE( - LogLevel::kError, - "ShouldUseStringEditDialog_ called in headless; should not happen."); - return false; - } + assert(!g_core->HeadlessMode()); // Should not get called here. // Obscure cases such as the text-widget *on* our built-in on-screen // editor (obviously it should itself not pop up an editor). @@ -581,7 +576,7 @@ auto TextWidget::ShouldUseStringEditor_() const -> bool { return true; } - // If we can take direct key events, no string-editor needed. + // If the UI is getting fed actual keyboard events, no string-editor needed. return !g_base->ui->UIHasDirectKeyboardInput(); }