Skip to content

Commit

Permalink
Fix Qt6 signature change for nativeEventFilter (#7254)
Browse files Browse the repository at this point in the history
* Adds win32EventFilter a wrapper for nativeEventFilter on Windows
* win32EventFilter is currently used to intercept top-level Window events (currently, to avoid VSTs setting transparency of the parent application)
  • Loading branch information
Rossmaxx authored May 19, 2024
1 parent 0fdf986 commit d43f4e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 8 additions & 4 deletions include/MainApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,14 @@ class MainApplication : public QApplication
MainApplication(int& argc, char** argv);
bool event(QEvent* event) override;
#ifdef LMMS_BUILD_WIN32
bool winEventFilter(MSG* msg, long* result);
bool nativeEventFilter(const QByteArray& eventType, void* message,
long* result);
#endif
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
using FilterResult = long;
#else
using FilterResult = qintptr;
#endif // QT6 check
bool win32EventFilter(MSG* msg, FilterResult* result);
bool nativeEventFilter(const QByteArray& eventType, void* message, FilterResult* result);
#endif // LMMS_BUILD_WIN32
inline QString& queuedFile()
{
return m_queuedFile;
Expand Down
8 changes: 4 additions & 4 deletions src/gui/MainApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ bool MainApplication::event(QEvent* event)
}

#ifdef LMMS_BUILD_WIN32
// This can be moved into nativeEventFilter once Qt4 support has been dropped
bool MainApplication::winEventFilter(MSG* msg, long* result)
// Helper function for nativeEventFilter
bool MainApplication::win32EventFilter(MSG* msg, FilterResult* result)
{
switch(msg->message)
{
Expand All @@ -110,11 +110,11 @@ bool MainApplication::winEventFilter(MSG* msg, long* result)
}

bool MainApplication::nativeEventFilter(const QByteArray& eventType,
void* message, long* result)
void* message, FilterResult* result)
{
if(eventType == "windows_generic_MSG")
{
return winEventFilter(static_cast<MSG *>(message), result);
return win32EventFilter(static_cast<MSG*>(message), result);
}
return false;
}
Expand Down

0 comments on commit d43f4e2

Please sign in to comment.