Enable propagation of key events so that hotkeys work regardless of what's focused
Originally committed to SVN as r6054.
This commit is contained in:
parent
59273bac4a
commit
cd3b9bfa37
2 changed files with 12 additions and 7 deletions
|
@ -51,6 +51,8 @@
|
||||||
#include <wx/utils.h>
|
#include <wx/utils.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <wx/eventfilter.h>
|
||||||
|
|
||||||
#include "include/aegisub/menu.h"
|
#include "include/aegisub/menu.h"
|
||||||
#include "command/command.h"
|
#include "command/command.h"
|
||||||
#include "command/icon.h"
|
#include "command/icon.h"
|
||||||
|
@ -147,13 +149,6 @@ void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/// @brief Handle wx assertions and redirect to the logging system.
|
|
||||||
/// @param file File name
|
|
||||||
/// @param line Line number
|
|
||||||
/// @param func Function name
|
|
||||||
/// @param cond Condition
|
|
||||||
/// @param msg Message
|
|
||||||
void AegisubApp::OnAssertFailure(const wxChar *file, int line, const wxChar *func, const wxChar *cond, const wxChar *msg) {
|
void AegisubApp::OnAssertFailure(const wxChar *file, int line, const wxChar *func, const wxChar *cond, const wxChar *msg) {
|
||||||
LOG_A("wx/assert") << file << ":" << line << ":" << func << "() " << cond << ": " << msg;
|
LOG_A("wx/assert") << file << ":" << line << ":" << func << "() " << cond << ": " << msg;
|
||||||
wxApp::OnAssertFailure(file, line, func, cond, msg);
|
wxApp::OnAssertFailure(file, line, func, cond, msg);
|
||||||
|
@ -543,6 +538,12 @@ int AegisubApp::OnRun() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AegisubApp::FilterEvent(wxEvent& event) {
|
||||||
|
if (event.GetEventType() == wxEVT_KEY_DOWN)
|
||||||
|
event.ResumePropagation(wxEVENT_PROPAGATE_MAX);
|
||||||
|
return wxEventFilter::Event_Skip;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
// Apple events
|
// Apple events
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
|
|
|
@ -126,6 +126,10 @@ class AegisubApp: public wxApp {
|
||||||
// our ticket to catch exceptions happening in event handlers.
|
// our ticket to catch exceptions happening in event handlers.
|
||||||
void HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent& event) const;
|
void HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent& event) const;
|
||||||
|
|
||||||
|
/// Top-level event filter to enable propagation of key events, which we
|
||||||
|
/// need for our hotkeys to work correctly
|
||||||
|
int FilterEvent(wxEvent& event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// DOCME
|
/// DOCME
|
||||||
AegisubLocale locale;
|
AegisubLocale locale;
|
||||||
|
|
Loading…
Reference in a new issue