mac key name cleanup

This commit is contained in:
Eric 2023-11-01 19:43:18 -07:00
parent 4047a5c9da
commit 544e26f129
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
17 changed files with 108 additions and 55 deletions

56
.efrocachemap generated
View File

@ -4056,26 +4056,26 @@
"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": "c1b15ac7e2c82bd82b97cb109e2eda55",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "890bf4dcce18e5c9bcaea42a69e3c4e4",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "84cb3bc48affe53ac615b8ad94d7ee80",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "ebfc636ad2b39dd441f80937996dd83d",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "e43e64e55f5456a606f0be8aa025f579",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "480e90cb5c8c676283ffd3a4f8e50dcf",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "e24d2cd8656f5f5c5dc02db28fe3c1dd",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "b10596b46ada2101a8c0769cc722f426",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "5dd458a30196c39bc9e334f1a9d5b3a4",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "43ab8ae4b7c5ededde417f0f01aa00f5",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "24fb0ffabb00de09ec9b63103534639b",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "2788e7b24f36c51ec4ec603a30ac5ae2",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "9f5fbf290252d070e98aab13f305c7dc",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "3be3c2402c33445e7fe5aa1cadc5fb19",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "ff8ebebe327730c091a2f1d55865be5d",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "ca29146d034f7ea18c0948b0a42f99d0",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "2ecabf751c7d10a3b5b80b134b3d5162",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "05c9d29f361c523ce785d8d5d8311278",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "c72df8dd7b8830cf54c186b77fbe1c4c",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "2bf6f80b765ef15a4394ad370370b6af",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "1204dd2c8c75de926c75e4502f57078c",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "264ac33e0b3a273ffd7ef9769dde5cf6",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "2fa0bf5f0a41977b5ec6b00ed4f17e2a",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "ef726bab56ae11cf3ef215e01e21c9ad",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "f5d464b59bf9cdb8c1196c7884e2f173",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "56c886224798634fcea2ddfb5591ce45",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "8fb46e16a41be252433e01b1fe8e5beb",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "19fb1ea3b52056948eb8cb09527ebe8f",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "4abe83d555baef553005792bb2afba97",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "0166ad734496b21d70e4d830cbb1ec19",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "bfd52a1ce35dfbabc57e6de74e2a61d0",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "f5a7ecb24c30c46f3ea7d340f3373fdb",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "3a9e88a6e7242f7488a59c9d8c42e8ee",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "fba815a45d4eec03f9d03d3adcb65261",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "f4ee5cbc285b34d905dbc28dbcd25762",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "3fd648584a9a1168b2c7e5cb4e6e18b9",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "47e28b96a08f68902cbe206e6ba652d1",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "fd7b02a98cc446f848f5c19182737b62",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "5218e7604faabfb6b5574d756753edc8",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "cc3a4942b16dbd28698cfa677e1bd4ac",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "d9f919fe87d497529cd8aed24a961ea3",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "56972014971024060e6014c2027debd2",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "d9f919fe87d497529cd8aed24a961ea3",
@ -4092,14 +4092,14 @@
"build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "39a0f3efabd9d2f62202ef9790e5cecd",
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "2609429078b69b48c3cda49abac7065c",
"build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "39a0f3efabd9d2f62202ef9790e5cecd",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "350146c7495a8bb828bec1a6782e3619",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "2be7ecb0dfd69fb74b60b7b60cd5c1e6",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "dff90dc36b0c809b08941684093db4a6",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "291720ae84da8daa1b3ae12dfde5713e",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "9c598f1db7b3ec0d80106c63e55a0062",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "620fe910d6f506645d4d4882b6b0c31d",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "27212e46c4b7e57d32a523b13de8fafd",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "36e695121b06f4b04e0e6d9d588189b4",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "61c6cc3186a52a11fb139d223b09cb52",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "783012d8d15a7345b4b73d1b9e0b3981",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "2320d558ecad7debab45d723d4324eae",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "be03efae4c21cd3645754f9dd64e00ad",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "51d50c4a0dae45415ab465f13fdc7a92",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "10a651d1815134112b9dc3e151c6adfa",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "4f7c320636d09bc598c38fc1a2db6d7d",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "9e9244b097860ad6a76478b0a1fa137f",
"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": "6df0f34207346d89a72924249ddd4706",

View File

@ -1,4 +1,4 @@
### 1.7.28 (build 21554, api 8, 2023-11-01)
### 1.7.28 (build 21556, api 8, 2023-11-01)
- 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

View File

@ -52,7 +52,7 @@ if TYPE_CHECKING:
# Build number and version of the ballistica binary we expect to be
# using.
TARGET_BALLISTICA_BUILD = 21554
TARGET_BALLISTICA_BUILD = 21556
TARGET_BALLISTICA_VERSION = '1.7.28'

View File

@ -93,6 +93,7 @@ class ConfigNumberEdit:
displayname: str | bui.Lstr | None = None,
changesound: bool = True,
textscale: float = 1.0,
as_percent: bool = False,
):
if displayname is None:
displayname = configkey
@ -103,6 +104,7 @@ class ConfigNumberEdit:
self._increment = increment
self._callback = callback
self._value = bui.app.config.resolve(configkey)
self._as_percent = as_percent
self.nametext = bui.textwidget(
parent=parent,
@ -166,4 +168,8 @@ class ConfigNumberEdit:
bui.app.config.apply_and_commit()
def _update_display(self) -> None:
bui.textwidget(edit=self.valuetext, text=f'{self._value:.1f}')
if self._as_percent:
val = f'{round(self._value*100.0)}%'
else:
val = f'{self._value:.1f}'
bui.textwidget(edit=self.valuetext, text=val)

View File

@ -121,7 +121,8 @@ class AudioSettingsWindow(bui.Window):
displayname=bui.Lstr(resource=self._r + '.soundVolumeText'),
minval=0.0,
maxval=1.0,
increment=0.1,
increment=0.05,
as_percent=True,
)
if bui.app.ui_v1.use_toolbars:
bui.widget(
@ -137,9 +138,10 @@ class AudioSettingsWindow(bui.Window):
displayname=bui.Lstr(resource=self._r + '.musicVolumeText'),
minval=0.0,
maxval=1.0,
increment=0.1,
increment=0.05,
callback=music.music_volume_changed,
changesound=False,
as_percent=True,
)
v -= 0.5 * spacing

View File

@ -302,4 +302,10 @@ auto AppAdapter::DoClipboardGetText() -> std::string {
return "";
}
auto AppAdapter::GetKeyName(int keycode) -> std::string {
BA_LOG_ONCE(LogLevel::kWarning,
"CorePlatform::GetKeyName not implemented here.");
return "?";
}
} // namespace ballistica::base

View File

@ -230,6 +230,9 @@ class AppAdapter {
/// context. By default this is simply the main thread.
virtual void DoPushGraphicsContextRunnable(Runnable* runnable);
// Return a name for a ballistica keyboard keycode.
virtual auto GetKeyName(int keycode) -> std::string;
protected:
virtual ~AppAdapter();

View File

@ -9,6 +9,7 @@
#include "ballistica/base/logic/logic.h"
#include "ballistica/base/platform/apple/apple_utils.h"
#include "ballistica/base/platform/apple/from_swift.h"
#include "ballistica/base/platform/support/min_sdl_key_names.h"
#include "ballistica/base/support/app_config.h"
#include "ballistica/shared/ballistica.h"
#include "ballistica/shared/foundation/event_loop.h"
@ -282,6 +283,10 @@ auto AppAdapterApple::DoClipboardGetText() -> std::string {
#endif
}
auto AppAdapterApple::GetKeyName(int keycode) -> std::string {
return MinSDL_GetKeyName(keycode);
}
} // namespace ballistica::base
#endif // BA_XCODE_BUILD

View File

@ -43,6 +43,7 @@ class AppAdapterApple : public AppAdapter {
auto GetKeyRepeatDelay() -> float override;
auto GetKeyRepeatInterval() -> float override;
auto GetKeyName(int keycode) -> std::string override;
protected:
void DoPushMainThreadRunnable(Runnable* runnable) override;

View File

@ -843,6 +843,10 @@ auto AppAdapterSDL::DoClipboardGetText() -> std::string {
return out_s;
}
auto AppAdapterSDL::GetKeyName(int keycode) -> std::string {
return SDL_GetKeyName(static_cast<SDL_Keycode>(keycode));
}
} // namespace ballistica::base
#endif // BA_SDL_BUILD

View File

@ -45,6 +45,8 @@ class AppAdapterSDL : public AppAdapter {
auto GetGraphicsSettings() -> GraphicsSettings* override;
auto GetKeyName(int keycode) -> std::string override;
protected:
void DoPushMainThreadRunnable(Runnable* runnable) override;
void RunMainThreadEventLoopToCompletion() override;

View File

@ -477,7 +477,7 @@ void KeyboardInput::UpdateArrowKeys_(SDL_Keycode key) {
}
auto KeyboardInput::GetButtonName(int index) -> std::string {
return g_base->platform->GetKeyName(index);
return g_base->app_adapter->GetKeyName(index);
}
auto KeyboardInput::GetRawDeviceName() -> std::string { return "Keyboard"; }

View File

@ -7,7 +7,6 @@
#include "ballistica/base/base.h"
#include "ballistica/base/input/input.h"
#include "ballistica/base/logic/logic.h"
#include "ballistica/base/platform/support/min_sdl_key_names.h"
#include "ballistica/base/python/base_python.h"
#include "ballistica/base/ui/ui.h"
#include "ballistica/core/core.h"
@ -27,20 +26,6 @@ void BasePlatform::PostInit() {
BasePlatform::~BasePlatform() = default;
auto BasePlatform::GetKeyName(int keycode) -> std::string {
// On our actual SDL platforms we're trying to be *pure* sdl so
// call their function for this. Otherwise we call our own version
// of it which is basically the same thing (at least for now).
#if BA_MINSDL_BUILD
return MinSDL_GetKeyName(keycode);
#elif BA_SDL_BUILD
return SDL_GetKeyName(static_cast<SDL_Keycode>(keycode));
#else
Log(LogLevel::kWarn, "CorePlatform::GetKeyName not implemented here.");
return "?";
#endif
}
void BasePlatform::LoginAdapterGetSignInToken(const std::string& login_type,
int attempt_id) {
// Default implementation simply calls completion callback immediately.

View File

@ -61,11 +61,6 @@ class BasePlatform {
/// Called when the app should set itself up to intercept ctrl-c presses.
virtual void SetupInterruptHandling();
#pragma mark INPUT DEVICES -----------------------------------------------------
// Return a name for a ballistica keycode.
virtual auto GetKeyName(int keycode) -> std::string;
#pragma mark ACCOUNTS ----------------------------------------------------------
/// Called when a Python LoginAdapter is requesting an explicit sign-in.

View File

@ -367,6 +367,22 @@ auto MinSDL_GetKeyName(int keycode) -> std::string {
static char name[8];
char* end;
// Handle a few specially per platform.
if (g_buildconfig.ostype_macos()) {
switch (key) {
case SDLK_LGUI:
return "Left Command";
case SDLK_RGUI:
return "Right Command";
case SDLK_LALT:
return "Left Option";
case SDLK_RALT:
return "Right Option";
default:
break;
}
}
if (key & SDLK_SCANCODE_MASK) {
return GetScancodeName((SDL_Scancode)(key & ~SDLK_SCANCODE_MASK));
}

View File

@ -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 = 21554;
const int kEngineBuildNumber = 21556;
const char* kEngineVersion = "1.7.28";
const int kEngineApiVersion = 8;

View File

@ -55,6 +55,7 @@ class SigningConfig:
class _Section(Enum):
COMPILEC = 'CompileC'
COMPILEXCSTRINGS = 'CompileXCStrings'
SWIFTCOMPILE = 'SwiftCompile'
SWIFTGENERATEPCH = 'SwiftGeneratePch'
SWIFTDRIVER = 'SwiftDriver'
@ -91,6 +92,7 @@ class _Section(Enum):
EXTRACTAPPINTENTSMETADATA = 'ExtractAppIntentsMetadata'
SWIFTMERGEGENERATEDHEADERS = 'SwiftMergeGeneratedHeaders'
GENERATEDSYMFILE = 'GenerateDSYMFile'
GENERATEASSETSYMBOLS = 'GenerateAssetSymbols'
class XCodeBuild:
@ -575,6 +577,12 @@ class XCodeBuild:
line,
ignore_line_starts=['builtin-validationUtility'],
)
elif self._section is _Section.COMPILEXCSTRINGS:
self._print_simple_section_line(
line,
prefix='Compiling strings',
ignore_line_start_tails=['/xcstringstool'],
)
elif self._section is _Section.CONVERTICONSETFILE:
self._print_simple_section_line(
line,
@ -653,6 +661,9 @@ class XCodeBuild:
'/copypng',
'/iconutil',
],
ignore_containing=[
'note: detected encoding of input file as Unicode (UTF-8)'
],
)
elif self._section is _Section.PROCESSPRODUCTPACKAGING:
if '.net.froemling.ballistica.ios"' in line:
@ -689,6 +700,17 @@ class XCodeBuild:
'"com.apple.Music.library.read",',
],
)
elif self._section is _Section.GENERATEASSETSYMBOLS:
self._print_simple_section_line(
line,
ignore_containing=[
'/* com.apple.actool.compilation-results */',
'/GeneratedAssetSymbols-Index.plist',
'/GeneratedAssetSymbols.h',
'/GeneratedAssetSymbols.swift',
],
)
elif self._section is _Section.PROCESSPRODUCTPACKAGINGDER:
self._print_simple_section_line(
line,
@ -944,12 +966,16 @@ class XCodeBuild:
prefix_index: int | None = None,
ignore_line_starts: list[str] | None = None,
ignore_line_start_tails: list[str] | None = None,
ignore_containing: list[str] | None = None,
prefix_unexpected: bool = True,
) -> None:
# pylint: disable=too-many-branches
if ignore_line_starts is None:
ignore_line_starts = []
if ignore_line_start_tails is None:
ignore_line_start_tails = []
if ignore_containing is None:
ignore_containing = []
# First line of the section.
if self._section_line_count == 0:
@ -975,6 +1001,8 @@ class XCodeBuild:
return
if any(splits[0].endswith(tail) for tail in ignore_line_start_tails):
return
if any(c in line for c in ignore_containing):
return
# Fall back on printing anything we don't recognize.
if prefix is None and prefix_unexpected: