DBG+GUI: fixed event native event filters for plugins
This commit is contained in:
parent
67447c631a
commit
144e7b27b6
|
@ -998,7 +998,7 @@ bool pluginwinevent(MSG* message, long* result)
|
|||
PLUG_CB_WINEVENT winevent;
|
||||
winevent.message = message;
|
||||
winevent.result = result;
|
||||
winevent.retval = false;
|
||||
winevent.retval = false; //false=handle event, true=ignore event
|
||||
plugincbcall(CB_WINEVENT, &winevent);
|
||||
return winevent.retval;
|
||||
}
|
||||
|
@ -1012,7 +1012,7 @@ bool pluginwineventglobal(MSG* message)
|
|||
{
|
||||
PLUG_CB_WINEVENTGLOBAL winevent;
|
||||
winevent.message = message;
|
||||
winevent.retval = false;
|
||||
winevent.retval = false; //false=handle event, true=ignore event
|
||||
plugincbcall(CB_WINEVENTGLOBAL, &winevent);
|
||||
return winevent.retval;
|
||||
}
|
||||
|
|
|
@ -14,17 +14,17 @@ MyApplication::MyApplication(int & argc, char** argv)
|
|||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||
bool MyApplication::winEventFilter(MSG* message, long* result)
|
||||
{
|
||||
return DbgWinEvent(message, result);
|
||||
}
|
||||
|
||||
bool MyApplication::globalEventFilter(void* message)
|
||||
{
|
||||
return DbgWinEventGlobal((MSG*)message);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool MyApplication::winEventFilter(MSG* message, long* result)
|
||||
{
|
||||
return DbgWinEvent(message, result);
|
||||
}
|
||||
|
||||
bool MyApplication::notify(QObject* receiver, QEvent* event)
|
||||
{
|
||||
bool done = true;
|
||||
|
@ -79,8 +79,8 @@ int main(int argc, char* argv[])
|
|||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||
QAbstractEventDispatcher::instance(application.thread())->setEventFilter(MyApplication::globalEventFilter);
|
||||
#else
|
||||
x64GlobalFilter* filter = new x64GlobalFilter();
|
||||
QAbstractEventDispatcher::instance(application.thread())->installNativeEventFilter(filter);
|
||||
auto eventFilter = new MyEventFilter();
|
||||
application.installNativeEventFilter(eventFilter);
|
||||
#endif
|
||||
|
||||
// Get the hidden language setting (for testers)
|
||||
|
@ -150,7 +150,7 @@ int main(int argc, char* argv[])
|
|||
//execute the application
|
||||
int result = application.exec();
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
QAbstractEventDispatcher::instance(application.thread())->removeNativeEventFilter(filter);
|
||||
application.removeNativeEventFilter(eventFilter);
|
||||
#else
|
||||
QAbstractEventDispatcher::instance(application.thread())->setEventFilter(nullptr);
|
||||
#endif
|
||||
|
|
|
@ -13,9 +13,9 @@ class MyApplication : public QApplication
|
|||
{
|
||||
public:
|
||||
MyApplication(int & argc, char** argv);
|
||||
bool notify(QObject* receiver, QEvent* event);
|
||||
bool winEventFilter(MSG* message, long* result);
|
||||
bool notify(QObject* receiver, QEvent* event) Q_DECL_OVERRIDE;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||
bool winEventFilter(MSG* message, long* result) Q_DECL_OVERRIDE;
|
||||
static bool globalEventFilter(void* message);
|
||||
#endif
|
||||
};
|
||||
|
@ -30,12 +30,16 @@ struct TranslatedStringStorage
|
|||
extern std::map<DWORD, TranslatedStringStorage>* TLS_TranslatedStringMap;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
class x64GlobalFilter : public QAbstractNativeEventFilter
|
||||
class MyEventFilter : public QAbstractNativeEventFilter
|
||||
{
|
||||
public:
|
||||
virtual bool nativeEventFilter(const QByteArray &, void* message, long*) Q_DECL_OVERRIDE
|
||||
virtual bool nativeEventFilter(const QByteArray & eventType, void* message, long* result) Q_DECL_OVERRIDE
|
||||
{
|
||||
return DbgWinEventGlobal((MSG*)message);
|
||||
if(eventType == "windows_dispatcher_MSG")
|
||||
return DbgWinEventGlobal((MSG*)message);
|
||||
else if(eventType == "windows_generic_MSG")
|
||||
return DbgWinEvent((MSG*)message, result);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
#endif // QT_VERSION
|
||||
|
|
Loading…
Reference in New Issue