Skip to content

Commit

Permalink
Don't let plugins make the main window transparent (#3809)
Browse files Browse the repository at this point in the history
* Don't let plugins make the main window transparent

* Don't clear WS_EX_LAYERED if it was already set
  • Loading branch information
DomClark authored and Umcaruje committed Sep 25, 2017
1 parent fb5a58a commit dd429c5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/MainApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,22 @@
#ifndef MAINAPPLICATION_H
#define MAINAPPLICATION_H

#include "lmmsconfig.h"

#include <QApplication>

#ifdef LMMS_BUILD_WIN32
#include <windows.h>
#endif

class MainApplication : public QApplication
{
public:
MainApplication(int& argc, char** argv);
bool event(QEvent* event);
#ifdef LMMS_BUILD_WIN32
bool winEventFilter(MSG* msg, long* result);
#endif
inline QString& queuedFile()
{
return m_queuedFile;
Expand Down
24 changes: 24 additions & 0 deletions src/gui/MainApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,27 @@ bool MainApplication::event(QEvent* event)
return QApplication::event(event);
}
}

#ifdef LMMS_BUILD_WIN32
bool MainApplication::winEventFilter(MSG* msg, long* result)
{
switch(msg->message)
{
case WM_STYLECHANGING:
if(msg->wParam == GWL_EXSTYLE)
{
// Prevent plugins making the main window transparent
STYLESTRUCT * style = reinterpret_cast<STYLESTRUCT *>(msg->lParam);
if(!(style->styleOld & WS_EX_LAYERED))
{
style->styleNew &= ~WS_EX_LAYERED;
}
*result = 0;
return true;
}
return false;
default:
return false;
}
}
#endif

0 comments on commit dd429c5

Please sign in to comment.