From f2797958dbc5d08c9d49ff9be874d9d79127502a Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 11 Nov 2013 18:07:05 -0400 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20minimize=20on=20focus=20loss=20?= =?UTF-8?q?in=20fullscreen-desktop=20mode=20(mimics=20post-SDL=202.0.1=20b?= =?UTF-8?q?ehaviour)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/window/sdl/Window.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/modules/window/sdl/Window.cpp b/src/modules/window/sdl/Window.cpp index 383984c31..a7510ff8b 100644 --- a/src/modules/window/sdl/Window.cpp +++ b/src/modules/window/sdl/Window.cpp @@ -42,12 +42,6 @@ Window::Window() , window(0) , context(0) { -#ifdef LOVE_MACOSX - // SDL 2 minimizes the window at weird times on OSX if this isn't disabled. - // TODO: do Linux and/or Windows need this as well (multi-monitor)? - SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0"); -#endif - if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) throw love::Exception("%s", SDL_GetError()); } @@ -313,6 +307,16 @@ void Window::updateAttributes(const WindowAttributes &newattribs) curMode.attribs.borderless = (wflags & SDL_WINDOW_BORDERLESS) != 0; curMode.attribs.centered = newattribs.centered; curMode.attribs.display = std::max(SDL_GetWindowDisplayIndex(window), 0); + + // Only minimize on focus loss if the window is in exclusive-fullscreen + // mode (mimics behaviour of SDL 2.0.2+). + // In OS X we always disable this to prevent dock minimization weirdness. +#ifndef LOVE_MACOSX + if (curMode.attribs.fullscreen && curMode.attribs.fstype == FULLSCREEN_TYPE_NORMAL) + SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "1"); + else +#endif + SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0"); } void Window::getWindow(int &width, int &height, WindowAttributes &attribs)