Fixed string building for mouse grab hotkey message

This commit is contained in:
robxnano 2022-09-06 23:23:33 +01:00
parent b1ab353085
commit 177a297527
8 changed files with 40 additions and 30 deletions

View File

@ -361,8 +361,8 @@ void audio_set_speaker_volume(uint32 vol)
{
}
static int play_startup(void *arg) {
#if SDL_VERSION_ATLEAST(2,0,0)
static int play_startup(void *arg) {
SDL_AudioSpec wav_spec;
Uint8 *wav_buffer;
Uint32 wav_length;
@ -384,7 +384,7 @@ static int play_startup(void *arg) {
}
void PlayStartupSound() {
#if SDL_VERSION_ATLEAST(2,0,0)
SDL_CreateThread(play_startup, "", NULL);
#endif
}
#if SDL_VERSION_ATLEAST(2,0,0)

View File

@ -527,13 +527,13 @@ static void set_window_name(bool mouse_grabbed)
int grabbed = 0;
if (mouse_grabbed)
{
s += GetString(STR_WINDOW_TITLE_GRABBED_PRE);
int hotkey = PrefsFindInt32("hotkey");
if (hotkey & 2)
grabbed = STR_WINDOW_TITLE_GRABBED2;
else if (hotkey & 4)
grabbed = STR_WINDOW_TITLE_GRABBED3;
else
grabbed = STR_WINDOW_TITLE_GRABBED1;
hotkey = hotkey ? hotkey : 1;
if (hotkey & 1) s += GetString(STR_WINDOW_TITLE_GRABBED1);
if (hotkey & 2) s += GetString(STR_WINDOW_TITLE_GRABBED2);
if (hotkey & 4) s += GetString(STR_WINDOW_TITLE_GRABBED4);
s += GetString(STR_WINDOW_TITLE_GRABBED_POST);
}
const SDL_VideoInfo *vi = SDL_GetVideoInfo();
if (vi && vi->wm_available)

View File

@ -557,10 +557,13 @@ static void set_window_name() {
std::string s = title ? title : GetString(STR_WINDOW_TITLE);
if (mouse_grabbed)
{
s += GetString(STR_WINDOW_TITLE_GRABBED_PRE);
int hotkey = PrefsFindInt32("hotkey");
hotkey = hotkey ? hotkey : 1;
if (hotkey & 1) s += GetString(STR_WINDOW_TITLE_GRABBED1);
if (hotkey & 2) s += GetString(STR_WINDOW_TITLE_GRABBED2);
else if (hotkey & 4) s += GetString(STR_WINDOW_TITLE_GRABBED3);
else s += GetString(STR_WINDOW_TITLE_GRABBED1);
if (hotkey & 4) s += GetString(STR_WINDOW_TITLE_GRABBED4);
s += GetString(STR_WINDOW_TITLE_GRABBED_POST);
}
SDL_SetWindowTitle(sdl_window, s.c_str());
}
@ -1671,11 +1674,7 @@ static void do_toggle_fullscreen(void)
SDL_SetWindowGrab(sdl_window, SDL_FALSE);
} else {
display_type = DISPLAY_SCREEN;
#ifdef __MACOSX__
SDL_SetWindowFullscreen(sdl_window, SDL_WINDOW_FULLSCREEN_DESKTOP);
#else
SDL_SetWindowFullscreen(sdl_window, SDL_WINDOW_FULLSCREEN);
#endif
SDL_SetWindowGrab(sdl_window, SDL_TRUE);
}
}

View File

@ -93,8 +93,11 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
TimerReset();
EtherReset();
AudioReset();
#ifdef ENABLE_SDL
#if SDL_VERSION_ATLEAST(2,0,0)
PlayStartupSound();
#endif
#endif
// Create BootGlobs at top of memory
Mac_memset(RAMBaseMac + RAMSize - 4096, 0, 4096);
uint32 boot_globs = RAMBaseMac + RAMSize - 0x1c;

View File

@ -218,9 +218,11 @@ enum {
// Mac window
STR_WINDOW_TITLE = 4000,
STR_WINDOW_TITLE_GRABBED_PRE,
STR_WINDOW_TITLE_GRABBED1,
STR_WINDOW_TITLE_GRABBED2,
STR_WINDOW_TITLE_GRABBED3,
STR_WINDOW_TITLE_GRABBED4,
STR_WINDOW_TITLE_GRABBED_POST,
STR_WINDOW_MENU = 4050,
STR_WINDOW_ITEM_ABOUT,
STR_WINDOW_ITEM_REFRESH,

View File

@ -231,18 +231,20 @@ user_string_def common_strings[] = {
{STR_JIT_FOLLOW_CONST_JUMPS, "Translate through constant jumps (inline blocks)"},
{STR_WINDOW_TITLE, "Basilisk II"},
{STR_WINDOW_TITLE_GRABBED1, " (mouse grabbed, press Ctrl+F5 to release)"},
{STR_WINDOW_TITLE_GRABBED_PRE, " (mouse grabbed, press "},
{STR_WINDOW_TITLE_GRABBED1, "Ctrl+"},
#ifdef __APPLE__
{STR_WINDOW_TITLE_GRABBED2, " (mouse grabbed, press Opt+F5 to release)"},
{STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Cmd+F5 to release)"},
{STR_WINDOW_TITLE_GRABBED2, "Opt+"},
{STR_WINDOW_TITLE_GRABBED4, "Cmd+F5"},
#else
{STR_WINDOW_TITLE_GRABBED2, " (mouse grabbed, press Alt+F5 to release)"},
{STR_WINDOW_TITLE_GRABBED2, "Alt+"},
#endif
#ifdef __WIN32__
{STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Win+F5 to release)"},
{STR_WINDOW_TITLE_GRABBED4, "Win+"},
#elif !defined(__APPLE__)
{STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Super+F5 to release)"},
{STR_WINDOW_TITLE_GRABBED4, "Super+"},
#endif
{STR_WINDOW_TITLE_GRABBED_POST, "F5 to release)"},
{STR_WINDOW_MENU, "Basilisk II"},
{STR_WINDOW_ITEM_ABOUT, "About Basilisk II" ELLIPSIS},
{STR_WINDOW_ITEM_REFRESH, "Refresh Rate"},

View File

@ -174,9 +174,11 @@ enum {
// Mac window
STR_WINDOW_TITLE = 4000,
STR_WINDOW_TITLE_GRABBED_PRE,
STR_WINDOW_TITLE_GRABBED1,
STR_WINDOW_TITLE_GRABBED2,
STR_WINDOW_TITLE_GRABBED3,
STR_WINDOW_TITLE_GRABBED4,
STR_WINDOW_TITLE_GRABBED_POST,
STR_WINDOW_MENU = 4050,
STR_WINDOW_ITEM_ABOUT,
STR_WINDOW_ITEM_REFRESH,

View File

@ -180,18 +180,20 @@ user_string_def common_strings[] = {
{STR_JIT_68K_CTRL, "Enable built-in 68k DR Emulator (EXPERIMENTAL)"},
{STR_WINDOW_TITLE, "SheepShaver"},
{STR_WINDOW_TITLE_GRABBED1, " (mouse grabbed, press Ctrl+F5 to release)"},
{STR_WINDOW_TITLE_GRABBED_PRE, " (mouse grabbed, press "},
{STR_WINDOW_TITLE_GRABBED1, "Ctrl+"},
#ifdef __APPLE__
{STR_WINDOW_TITLE_GRABBED2, " (mouse grabbed, press Opt+F5 to release)"},
{STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Cmd+F5 to release)"},
{STR_WINDOW_TITLE_GRABBED2, "Opt+"},
{STR_WINDOW_TITLE_GRABBED4, "Cmd+F5"},
#else
{STR_WINDOW_TITLE_GRABBED2, " (mouse grabbed, press Alt+F5 to release)"},
{STR_WINDOW_TITLE_GRABBED2, "Alt+"},
#endif
#ifdef __WIN32__
{STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Win+F5 to release)"},
{STR_WINDOW_TITLE_GRABBED4, "Win+"},
#elif !defined(__APPLE__)
{STR_WINDOW_TITLE_GRABBED3, " (mouse grabbed, press Super+F5 to release)"},
{STR_WINDOW_TITLE_GRABBED4, "Super+"},
#endif
{STR_WINDOW_TITLE_GRABBED_POST, "F5 to release)"},
{STR_WINDOW_MENU, "SheepShaver"},
{STR_WINDOW_ITEM_ABOUT, "About SheepShaver" ELLIPSIS},
{STR_WINDOW_ITEM_REFRESH, "Refresh Rate"},