diff --git a/src/osdep/amiberry.cpp b/src/osdep/amiberry.cpp index 4000ad2a2..4c31494bf 100644 --- a/src/osdep/amiberry.cpp +++ b/src/osdep/amiberry.cpp @@ -677,29 +677,6 @@ static void setmouseactive2(struct AmigaMonitor* mon, int active, bool allowpaus } } - bool gotfocus = false; - for (int i = 0; i < MAX_AMIGAMONITORS; i++) { - SDL_Window* window = SDL_GetMouseFocus(); - if (window && (window == AMonitors[i].amiga_window)) { - mon = &AMonitors[i]; - break; - } - } - for (int i = 0; i < MAX_AMIGAMONITORS; i++) { - if (iswindowfocus(&AMonitors[i])) { - gotfocus = true; - break; - } - } - if (!gotfocus) { - write_log("Tried to capture mouse but window didn't have focus! F=%d A=%d\n", focus, mouseactive); - focus = 0; - mouseactive = 0; - active = 0; - releasecapture(mon); - recapture = 0; - } - if (mouseactive > 0) focus = mon->monitor_id + 1; diff --git a/src/osdep/amiberry_gfx.cpp b/src/osdep/amiberry_gfx.cpp index bce6e3fa4..2d88e48f4 100644 --- a/src/osdep/amiberry_gfx.cpp +++ b/src/osdep/amiberry_gfx.cpp @@ -229,45 +229,39 @@ static void SDL2_init() mon->currentmode.freq = sdl_mode.refresh_rate; } - // If KMSDRM is detected, force Full-Window mode - if (kmsdrm_detected) - { - currprefs.gfx_apmode[APMODE_NATIVE].gfx_fullscreen = changed_prefs.gfx_apmode[APMODE_NATIVE].gfx_fullscreen = GFX_FULLWINDOW; - currprefs.gfx_apmode[APMODE_RTG].gfx_fullscreen = changed_prefs.gfx_apmode[APMODE_RTG].gfx_fullscreen = GFX_FULLWINDOW; - } - if (!mon->amiga_window) { write_log("Creating Amiberry window...\n"); Uint32 mode; - if (sdl_mode.w >= 800 && sdl_mode.h >= 600) + if (!kmsdrm_detected) { - // Only enable Windowed mode if we're running under x11 and the resolution is at least 800x600 + // Only enable Windowed mode if we're running under x11 if (currprefs.gfx_apmode[APMODE_NATIVE].gfx_fullscreen == GFX_FULLWINDOW) mode = SDL_WINDOW_FULLSCREEN_DESKTOP; else if (currprefs.gfx_apmode[APMODE_NATIVE].gfx_fullscreen == GFX_FULLSCREEN) mode = SDL_WINDOW_FULLSCREEN; else mode = SDL_WINDOW_RESIZABLE; - if (currprefs.borderless) - mode |= SDL_WINDOW_BORDERLESS; - if (currprefs.main_alwaysontop) - mode |= SDL_WINDOW_ALWAYS_ON_TOP; - if (currprefs.start_minimized) - mode |= SDL_WINDOW_HIDDEN; - else - mode |= SDL_WINDOW_SHOWN; - // Set Window allow high DPI by default - mode |= SDL_WINDOW_ALLOW_HIGHDPI; -#ifdef USE_OPENGL - mode |= SDL_WINDOW_OPENGL; -#endif } else { // otherwise go for Full-window mode = SDL_WINDOW_FULLSCREEN_DESKTOP; } + + if (currprefs.borderless) + mode |= SDL_WINDOW_BORDERLESS; + if (currprefs.main_alwaysontop) + mode |= SDL_WINDOW_ALWAYS_ON_TOP; + if (currprefs.start_minimized) + mode |= SDL_WINDOW_HIDDEN; + else + mode |= SDL_WINDOW_SHOWN; + // Set Window allow high DPI by default + mode |= SDL_WINDOW_ALLOW_HIGHDPI; +#ifdef USE_OPENGL + mode |= SDL_WINDOW_OPENGL; +#endif if (amiberry_options.rotation_angle == 0 || amiberry_options.rotation_angle == 180) { diff --git a/src/osdep/gui/main_window.cpp b/src/osdep/gui/main_window.cpp index a4f8687f5..371def2db 100644 --- a/src/osdep/gui/main_window.cpp +++ b/src/osdep/gui/main_window.cpp @@ -285,35 +285,29 @@ void amiberry_gui_init() check_error_sdl(gui_screen == nullptr, "Unable to create GUI surface:"); } - // If KMSDRM is detected, force Full-Window mode - if (kmsdrm_detected) - { - currprefs.gfx_apmode[APMODE_NATIVE].gfx_fullscreen = changed_prefs.gfx_apmode[APMODE_NATIVE].gfx_fullscreen = GFX_FULLWINDOW; - currprefs.gfx_apmode[APMODE_RTG].gfx_fullscreen = changed_prefs.gfx_apmode[APMODE_RTG].gfx_fullscreen = GFX_FULLWINDOW; - } - if (!mon->gui_window) { write_log("Creating Amiberry GUI window...\n"); Uint32 mode; - if (sdl_mode.w >= 800 && sdl_mode.h >= 600 && !kmsdrm_detected) + if (!kmsdrm_detected) { - // Only enable Windowed mode if we're running under x11 and the resolution is at least 800x600 + // Only enable Windowed mode if we're running under x11 mode = SDL_WINDOW_RESIZABLE; - if (currprefs.gui_alwaysontop) - mode |= SDL_WINDOW_ALWAYS_ON_TOP; - if (currprefs.start_minimized) - mode |= SDL_WINDOW_HIDDEN; - else - mode |= SDL_WINDOW_SHOWN; - // Set Window allow high DPI by default - mode |= SDL_WINDOW_ALLOW_HIGHDPI; - } + } + else + { + // otherwise go for Full-window + mode = SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_ALWAYS_ON_TOP; + } + + if (currprefs.gui_alwaysontop) + mode |= SDL_WINDOW_ALWAYS_ON_TOP; + if (currprefs.start_minimized) + mode |= SDL_WINDOW_HIDDEN; else - { - // otherwise go for Full-window - mode = SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_ALWAYS_ON_TOP; - } + mode |= SDL_WINDOW_SHOWN; + // Set Window allow high DPI by default + mode |= SDL_WINDOW_ALLOW_HIGHDPI; if (amiberry_options.rotation_angle == 0 || amiberry_options.rotation_angle == 180) {