From f0f7ad28583e89bf064c9295175bfc674e41babe Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Thu, 7 Jun 2012 02:48:13 +0000 Subject: [PATCH] osx: Make modelss dialogs stay on top of the main window as they're floating panels, not documents Originally committed to SVN as r6889. --- aegisub/src/dialog_manager.h | 3 +++ aegisub/src/osx_utils.mm | 4 ++++ aegisub/src/utils.cpp | 4 ++-- aegisub/src/utils.h | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/aegisub/src/dialog_manager.h b/aegisub/src/dialog_manager.h index 3d8222ac7..f8b873ec8 100644 --- a/aegisub/src/dialog_manager.h +++ b/aegisub/src/dialog_manager.h @@ -25,6 +25,8 @@ #include #endif +#include "utils.h" + /// @brief A manager for dialogs /// /// DialogManager keeps track of modal and modeless dialogs which have been @@ -74,6 +76,7 @@ public: created_dialogs[&typeid(DialogType)] = d; d->Bind(wxEVT_CLOSE_WINDOW, &DialogManager::OnClose, this); d->Show(); + SetFloatOnParent(d); } catch (agi::UserCancelException const&) { } } diff --git a/aegisub/src/osx_utils.mm b/aegisub/src/osx_utils.mm index 76da12f39..bd6ec0ee6 100644 --- a/aegisub/src/osx_utils.mm +++ b/aegisub/src/osx_utils.mm @@ -36,3 +36,7 @@ void AddFullScreenButton(wxWindow *window) { collectionBehavior |= NSWindowCollectionBehaviorFullScreenPrimary; [nsWindow setCollectionBehavior:collectionBehavior]; } + +void SetFloatOnParent(wxWindow *window) { + [[window->GetHandle() window] setLevel:NSFloatingWindowLevel]; +} diff --git a/aegisub/src/utils.cpp b/aegisub/src/utils.cpp index 4ea11593b..8b4a30fe5 100644 --- a/aegisub/src/utils.cpp +++ b/aegisub/src/utils.cpp @@ -424,6 +424,6 @@ void CleanCache(wxString const& directory, wxString const& file_type, int64_t ma // OS X implementation in osx_utils.mm #ifndef __WXOSX_COCOA__ -void AddFullScreenButton(wxWindow *window) { -} +void AddFullScreenButton(wxWindow *) { } +void SetFloatOnParent(wxWindow *) { } #endif diff --git a/aegisub/src/utils.h b/aegisub/src/utils.h index bf45723a8..763b9e0f9 100644 --- a/aegisub/src/utils.h +++ b/aegisub/src/utils.h @@ -97,6 +97,8 @@ void RestartAegisub(); /// Add the OS X 10.7+ full-screen button to a window void AddFullScreenButton(wxWindow *window); +void SetFloatOnParent(wxWindow *window); + /// Forward a mouse wheel event to the window under the mouse if needed /// @param source The initial target of the wheel event /// @param evt The event