mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-22 14:32:58 +02:00
Restore focus if another modal dialog is opened on top of FileDialog
An example of this would be the FFmpeg custom options dialog. When the options dialog would close, focus would be lost and with no apparent way to get it back when using the keyboard. This change tracks the modal dialogs that are opened after the current file dialog and that are descendants of the current file dialog. Once all of the descendants are closed, the current file dialog will restore the focus and make sure it is the topmost window. This only affected Windows.
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <wx/modalhook.h>
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// FileDialog
|
||||
//-------------------------------------------------------------------------
|
||||
@@ -36,9 +38,8 @@ class FileDialog : public FileDialogBase
|
||||
|
||||
virtual void GetPaths(wxArrayString& paths) const;
|
||||
virtual void GetFilenames(wxArrayString& files) const;
|
||||
void OnSize(wxSizeEvent & e);
|
||||
virtual int ShowModal();
|
||||
|
||||
|
||||
protected:
|
||||
// -----------------------------------------
|
||||
// wxMSW-specific implementation from now on
|
||||
@@ -98,6 +99,23 @@ private:
|
||||
|
||||
wxPanel *mRoot;
|
||||
|
||||
class Disabler : public wxModalDialogHook
|
||||
{
|
||||
public:
|
||||
Disabler();
|
||||
void Init(wxWindow *root, HWND hwnd);
|
||||
|
||||
protected:
|
||||
int Enter(wxDialog *dialog);
|
||||
void Exit(wxDialog *dialog);
|
||||
bool IsChild(const wxDialog *dialog) const;
|
||||
|
||||
private:
|
||||
wxWindow *mRoot;
|
||||
HWND mHwnd;
|
||||
int mModalCount;
|
||||
} mDisabler;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(FileDialog)
|
||||
DECLARE_NO_COPY_CLASS(FileDialog)
|
||||
};
|
||||
|
Reference in New Issue
Block a user