osx: Make modelss dialogs stay on top of the main window as they're floating panels, not documents

Originally committed to SVN as r6889.
This commit is contained in:
Thomas Goyne 2012-06-07 02:48:13 +00:00
parent 26a5fbe4b8
commit f0f7ad2858
4 changed files with 11 additions and 2 deletions

View File

@ -25,6 +25,8 @@
#include <wx/dialog.h> #include <wx/dialog.h>
#endif #endif
#include "utils.h"
/// @brief A manager for dialogs /// @brief A manager for dialogs
/// ///
/// DialogManager keeps track of modal and modeless dialogs which have been /// DialogManager keeps track of modal and modeless dialogs which have been
@ -74,6 +76,7 @@ public:
created_dialogs[&typeid(DialogType)] = d; created_dialogs[&typeid(DialogType)] = d;
d->Bind(wxEVT_CLOSE_WINDOW, &DialogManager::OnClose, this); d->Bind(wxEVT_CLOSE_WINDOW, &DialogManager::OnClose, this);
d->Show(); d->Show();
SetFloatOnParent(d);
} }
catch (agi::UserCancelException const&) { } catch (agi::UserCancelException const&) { }
} }

View File

@ -36,3 +36,7 @@ void AddFullScreenButton(wxWindow *window) {
collectionBehavior |= NSWindowCollectionBehaviorFullScreenPrimary; collectionBehavior |= NSWindowCollectionBehaviorFullScreenPrimary;
[nsWindow setCollectionBehavior:collectionBehavior]; [nsWindow setCollectionBehavior:collectionBehavior];
} }
void SetFloatOnParent(wxWindow *window) {
[[window->GetHandle() window] setLevel:NSFloatingWindowLevel];
}

View File

@ -424,6 +424,6 @@ void CleanCache(wxString const& directory, wxString const& file_type, int64_t ma
// OS X implementation in osx_utils.mm // OS X implementation in osx_utils.mm
#ifndef __WXOSX_COCOA__ #ifndef __WXOSX_COCOA__
void AddFullScreenButton(wxWindow *window) { void AddFullScreenButton(wxWindow *) { }
} void SetFloatOnParent(wxWindow *) { }
#endif #endif

View File

@ -97,6 +97,8 @@ void RestartAegisub();
/// Add the OS X 10.7+ full-screen button to a window /// Add the OS X 10.7+ full-screen button to a window
void AddFullScreenButton(wxWindow *window); void AddFullScreenButton(wxWindow *window);
void SetFloatOnParent(wxWindow *window);
/// Forward a mouse wheel event to the window under the mouse if needed /// Forward a mouse wheel event to the window under the mouse if needed
/// @param source The initial target of the wheel event /// @param source The initial target of the wheel event
/// @param evt The event /// @param evt The event