diff --git a/BasiliskII/src/SDL/video_sdl2.cpp b/BasiliskII/src/SDL/video_sdl2.cpp index 72a591b2..35e15a1f 100644 --- a/BasiliskII/src/SDL/video_sdl2.cpp +++ b/BasiliskII/src/SDL/video_sdl2.cpp @@ -546,34 +546,20 @@ static void set_mac_frame_buffer(SDL_monitor_desc &monitor, int depth, bool nati } // Set window name and class -static void set_window_name(int name) -{ - if (!sdl_window) { - return; - } - const char *str = GetString(name); - SDL_SetWindowTitle(sdl_window, str); -} - -static void set_window_name_grabbed() { +static void set_window_name() { if (!sdl_window) return; - int hotkey = PrefsFindInt32("hotkey"); - if (!hotkey) hotkey = 1; - std::string s = GetString(STR_WINDOW_TITLE_GRABBED0); - 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_GRABBED3); - s += GetString(STR_WINDOW_TITLE_GRABBED4); - SDL_SetWindowTitle(sdl_window, s.c_str()); -} - -// Set mouse grab mode -static void set_grab_mode(bool grab) -{ - if (!sdl_window) { - return; + const char *title = PrefsFindString("title"); + std::string s = title ? title : GetString(STR_WINDOW_TITLE); + if (mouse_grabbed) { + s += GetString(STR_WINDOW_TITLE_GRABBED0); + int hotkey = PrefsFindInt32("hotkey"); + if (!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_GRABBED3); + s += GetString(STR_WINDOW_TITLE_GRABBED4); } - SDL_SetWindowGrab(sdl_window, grab ? SDL_TRUE : SDL_FALSE); + SDL_SetWindowTitle(sdl_window, s.c_str()); } // Migrate preferences items (XXX to be handled in MigratePrefs()) @@ -771,7 +757,7 @@ static SDL_Surface * init_sdl_video(int width, int height, int bpp, Uint32 flags if (!sdl_window) { int m = get_mag_rate(); sdl_window = SDL_CreateWindow( - GetString(STR_WINDOW_TITLE), + "", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, m * window_width, @@ -781,6 +767,7 @@ static SDL_Surface * init_sdl_video(int width, int height, int bpp, Uint32 flags shutdown_sdl_video(); return NULL; } + set_window_name(); } if (flags & SDL_WINDOW_FULLSCREEN) SDL_SetWindowGrab(sdl_window, SDL_TRUE); @@ -1109,7 +1096,7 @@ void driver_base::adapt_to_video_mode() { SDL_ShowCursor(hardware_cursor); // Set window name/class - mouse_grabbed ? set_window_name_grabbed() : set_window_name((int)STR_WINDOW_TITLE); + set_window_name(); // Everything went well init_ok = true; @@ -1209,7 +1196,7 @@ void driver_base::grab_mouse(void) if (!mouse_grabbed) { mouse_grabbed = true; update_mouse_grab(); - set_window_name_grabbed(); + set_window_name(); disable_mouse_accel(); ADBSetRelMouseMode(true); } @@ -1221,7 +1208,7 @@ void driver_base::ungrab_mouse(void) if (mouse_grabbed) { mouse_grabbed = false; update_mouse_grab(); - set_window_name(STR_WINDOW_TITLE); + set_window_name(); restore_mouse_accel(); ADBSetRelMouseMode(false); } diff --git a/BasiliskII/src/include/user_strings.h b/BasiliskII/src/include/user_strings.h index 1b9a4253..71e7d80a 100644 --- a/BasiliskII/src/include/user_strings.h +++ b/BasiliskII/src/include/user_strings.h @@ -212,8 +212,6 @@ enum { // Mac window STR_WINDOW_TITLE = 4000, - STR_WINDOW_TITLE_FROZEN, - STR_WINDOW_TITLE_GRABBED, STR_WINDOW_TITLE_GRABBED0, STR_WINDOW_TITLE_GRABBED1, STR_WINDOW_TITLE_GRABBED2, diff --git a/BasiliskII/src/prefs_items.cpp b/BasiliskII/src/prefs_items.cpp index 883c7a6e..0b30b8c9 100644 --- a/BasiliskII/src/prefs_items.cpp +++ b/BasiliskII/src/prefs_items.cpp @@ -82,6 +82,7 @@ prefs_desc common_prefs_items[] = { {"swap_opt_cmd", TYPE_BOOLEAN, false, "swap option and command key"}, {"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"}, {"host_domain", TYPE_STRING, true, "handle DNS requests for this domain on the host (slirp only)"}, + {"title", TYPE_STRING, false, "window title"}, {NULL, TYPE_END, false, NULL} // End of list }; diff --git a/BasiliskII/src/user_strings.cpp b/BasiliskII/src/user_strings.cpp index 41689552..0ae22b93 100644 --- a/BasiliskII/src/user_strings.cpp +++ b/BasiliskII/src/user_strings.cpp @@ -225,9 +225,7 @@ user_string_def common_strings[] = { {STR_JIT_FOLLOW_CONST_JUMPS, "Translate through constant jumps (inline blocks)"}, {STR_WINDOW_TITLE, "Basilisk II"}, - {STR_WINDOW_TITLE_FROZEN, "Basilisk II *** FROZEN ***"}, - {STR_WINDOW_TITLE_GRABBED, "Basilisk II (mouse grabbed, press Ctrl-F5 to release)"}, - {STR_WINDOW_TITLE_GRABBED0, "Basilisk II (mouse grabbed, press "}, + {STR_WINDOW_TITLE_GRABBED0, " (mouse grabbed, press "}, {STR_WINDOW_TITLE_GRABBED1, "Ctrl-"}, #ifdef __APPLE__ {STR_WINDOW_TITLE_GRABBED2, "Opt-"}, diff --git a/SheepShaver/src/include/user_strings.h b/SheepShaver/src/include/user_strings.h index 1813954a..51951520 100644 --- a/SheepShaver/src/include/user_strings.h +++ b/SheepShaver/src/include/user_strings.h @@ -165,8 +165,6 @@ enum { // Mac window STR_WINDOW_TITLE = 4000, - STR_WINDOW_TITLE_FROZEN, - STR_WINDOW_TITLE_GRABBED, STR_WINDOW_TITLE_GRABBED0, STR_WINDOW_TITLE_GRABBED1, STR_WINDOW_TITLE_GRABBED2, diff --git a/SheepShaver/src/prefs_items.cpp b/SheepShaver/src/prefs_items.cpp index 5efc1e30..8e1f448d 100644 --- a/SheepShaver/src/prefs_items.cpp +++ b/SheepShaver/src/prefs_items.cpp @@ -70,6 +70,7 @@ prefs_desc common_prefs_items[] = { {"swap_opt_cmd", TYPE_BOOLEAN, false, "swap option and command key"}, {"host_domain", TYPE_STRING, true, "handle DNS requests for this domain on the host (slirp only)"}, {"redir", TYPE_STRING, true, "port forwarding for slirp"}, + {"title", TYPE_STRING, false, "window title"}, {NULL, TYPE_END, false, NULL} // End of list }; diff --git a/SheepShaver/src/user_strings.cpp b/SheepShaver/src/user_strings.cpp index 6a52511a..9a24cb1c 100644 --- a/SheepShaver/src/user_strings.cpp +++ b/SheepShaver/src/user_strings.cpp @@ -171,9 +171,7 @@ user_string_def common_strings[] = { {STR_JIT_68K_CTRL, "Enable built-in 68k DR Emulator (EXPERIMENTAL)"}, {STR_WINDOW_TITLE, "SheepShaver"}, - {STR_WINDOW_TITLE_FROZEN, "SheepShaver *** FROZEN ***"}, - {STR_WINDOW_TITLE_GRABBED, "SheepShaver (mouse grabbed, press Ctrl-F5 to release)"}, - {STR_WINDOW_TITLE_GRABBED0, "SheepShaver (mouse grabbed, press "}, + {STR_WINDOW_TITLE_GRABBED0, " (mouse grabbed, press "}, {STR_WINDOW_TITLE_GRABBED1, "Ctrl-"}, #ifdef __APPLE__ {STR_WINDOW_TITLE_GRABBED2, "Opt-"},