Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable plugin transparency on Qt5 #3934

Merged
merged 1 commit into from
Nov 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions include/MainApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,26 @@

#ifdef LMMS_BUILD_WIN32
#include <windows.h>
#if QT_VERSION >= 0x050000
#include <QAbstractNativeEventFilter>
#endif
#endif

#if defined(LMMS_BUILD_WIN32) && QT_VERSION >= 0x050000
class MainApplication : public QApplication, public QAbstractNativeEventFilter
#else
class MainApplication : public QApplication
#endif
{
public:
MainApplication(int& argc, char** argv);
bool event(QEvent* event);
#ifdef LMMS_BUILD_WIN32
bool winEventFilter(MSG* msg, long* result);
#if QT_VERSION >= 0x050000
bool nativeEventFilter(const QByteArray& eventType, void* message,
long* result);
#endif
#endif
inline QString& queuedFile()
{
Expand Down
20 changes: 19 additions & 1 deletion src/gui/MainApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@

MainApplication::MainApplication(int& argc, char** argv) :
QApplication(argc, argv),
m_queuedFile() {}
m_queuedFile()
{
#if defined(LMMS_BUILD_WIN32) && QT_VERSION >= 0x050000
installNativeEventFilter(this);
#endif
}

bool MainApplication::event(QEvent* event)
{
Expand Down Expand Up @@ -64,6 +69,7 @@ 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)
{
switch(msg->message)
Expand All @@ -85,4 +91,16 @@ bool MainApplication::winEventFilter(MSG* msg, long* result)
return false;
}
}

#if QT_VERSION >= 0x050000
bool MainApplication::nativeEventFilter(const QByteArray& eventType,
void* message, long* result)
{
if(eventType == "windows_generic_MSG")
{
return winEventFilter(static_cast<MSG *>(message), result);
}
return false;
}
#endif
#endif