From f6616d1d4d7f1b9f8be95ec294357a884e6d1266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesu=CC=81s=20A=2E=20A=CC=81lvarez?= Date: Tue, 5 Nov 2019 23:02:14 +0100 Subject: [PATCH] add rootless as video mode instead of own setting --- BasiliskII/src/SDL/prefs_sdl.cpp | 3 --- BasiliskII/src/SDL/video_rootless.cpp | 2 +- BasiliskII/src/SDL/video_sdl2.cpp | 22 ++++++++++++++++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/BasiliskII/src/SDL/prefs_sdl.cpp b/BasiliskII/src/SDL/prefs_sdl.cpp index 8dd64a79..5151f760 100644 --- a/BasiliskII/src/SDL/prefs_sdl.cpp +++ b/BasiliskII/src/SDL/prefs_sdl.cpp @@ -32,9 +32,6 @@ prefs_desc platform_prefs_items[] = { {"idlewait", TYPE_BOOLEAN, false, "sleep when idle"}, {"sdlrender", TYPE_STRING, false, "SDL_Renderer driver (\"auto\", \"software\" (may be faster), etc.)"}, -#ifdef VIDEO_ROOTLESS - {"rootless", TYPE_BOOLEAN, false, "Rootles mode (System 7)"}, -#endif {NULL, TYPE_END, false} // End of list }; diff --git a/BasiliskII/src/SDL/video_rootless.cpp b/BasiliskII/src/SDL/video_rootless.cpp index 525ca7b5..2f30d305 100644 --- a/BasiliskII/src/SDL/video_rootless.cpp +++ b/BasiliskII/src/SDL/video_rootless.cpp @@ -61,7 +61,7 @@ static uint32 low_mem_map = 0; int16 InstallRootlessProc() { // Rootless mode support M68kRegisters r; - if (PrefsFindBool("rootless")) { + if (strncmp(PrefsFindString("screen"), "rootless", 8) == 0) { printf("Installing rootless support\n"); r.d[0] = sizeof(rootless_proc); Execute68kTrap(0xa71e, &r); // NewPtrSysClear() diff --git a/BasiliskII/src/SDL/video_sdl2.cpp b/BasiliskII/src/SDL/video_sdl2.cpp index 2e8f1302..e0947b56 100644 --- a/BasiliskII/src/SDL/video_sdl2.cpp +++ b/BasiliskII/src/SDL/video_sdl2.cpp @@ -88,7 +88,8 @@ extern int display_type; // See enum above #else enum { DISPLAY_WINDOW, // windowed display - DISPLAY_SCREEN // fullscreen display + DISPLAY_SCREEN, // fullscreen display + DISPLAY_ROOTLESS // fullscreen with transparent desktop }; static int display_type = DISPLAY_WINDOW; // See enum above #endif @@ -743,6 +744,11 @@ static SDL_Surface * init_sdl_video(int width, int height, int bpp, Uint32 flags window_flags |= SDL_WINDOW_RESIZABLE; */ if (!sdl_window) { +#ifdef VIDEO_ROOTLESS + if (display_type == DISPLAY_ROOTLESS) { + window_flags |= SDL_WINDOW_BORDERLESS; + } +#endif sdl_window = SDL_CreateWindow( "Basilisk II", SDL_WINDOWPOS_UNDEFINED, @@ -1380,6 +1386,13 @@ bool VideoInit(bool classic) display_type = DISPLAY_WINDOW; else if (sscanf(mode_str, "dga/%d/%d", &default_width, &default_height) == 2) display_type = DISPLAY_SCREEN; +#ifdef VIDEO_ROOTLESS + else if (strncmp(mode_str, "rootless", 8) == 0) { + display_type = DISPLAY_ROOTLESS; + default_width = sdl_display_width(); + default_height = sdl_display_height(); + } +#endif } if (default_width <= 0) default_width = sdl_display_width(); @@ -1469,7 +1482,12 @@ bool VideoInit(bool classic) for (int d = VIDEO_DEPTH_1BIT; d <= default_depth; d++) add_mode(display_type, w, h, video_modes[i].resolution_id, TrivialBytesPerRow(w, (video_depth)d), d); } - } +#ifdef VIDEO_ROOTLESS + } else if (display_type == DISPLAY_ROOTLESS) { + for (int d = VIDEO_DEPTH_1BIT; d <= default_depth; d++) + add_mode(display_type, default_width, default_height, 0x80, TrivialBytesPerRow(default_width, (video_depth)d), d); +#endif + } if (VideoModes.empty()) { ErrorAlert(STR_NO_XVISUAL_ERR);