Improve DWM code, remove WinExtras dependency
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c1b0053ac8
commit
dd9c4a7f16
7 changed files with 54 additions and 42 deletions
|
@ -24,7 +24,7 @@ BEGIN
|
||||||
VALUE "FileDescription", "gta5view"
|
VALUE "FileDescription", "gta5view"
|
||||||
VALUE "FileVersion", "MAJOR_VER.MINOR_VER.PATCH_VERSTR_BUILD_VER"
|
VALUE "FileVersion", "MAJOR_VER.MINOR_VER.PATCH_VERSTR_BUILD_VER"
|
||||||
VALUE "InternalName", "gta5view"
|
VALUE "InternalName", "gta5view"
|
||||||
VALUE "LegalCopyright", "Copyright © 2016-2020 Syping"
|
VALUE "LegalCopyright", "Copyright © 2016-2021 Syping"
|
||||||
VALUE "OriginalFilename", "gta5view.exe"
|
VALUE "OriginalFilename", "gta5view.exe"
|
||||||
VALUE "ProductName", "gta5view"
|
VALUE "ProductName", "gta5view"
|
||||||
VALUE "ProductVersion", "MAJOR_VER.MINOR_VER.PATCH_VERSTR_BUILD_VER"
|
VALUE "ProductVersion", "MAJOR_VER.MINOR_VER.PATCH_VERSTR_BUILD_VER"
|
||||||
|
|
|
@ -113,7 +113,6 @@ File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Gui.dll"
|
||||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Network.dll"
|
File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Network.dll"
|
||||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Svg.dll"
|
File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Svg.dll"
|
||||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Widgets.dll"
|
File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Widgets.dll"
|
||||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5WinExtras.dll"
|
|
||||||
SetOutPath "$INSTDIR\lang"
|
SetOutPath "$INSTDIR\lang"
|
||||||
File "../build/gta5sync_en_US.qm"
|
File "../build/gta5sync_en_US.qm"
|
||||||
File "../build/gta5sync_de.qm"
|
File "../build/gta5sync_de.qm"
|
||||||
|
@ -203,7 +202,6 @@ Delete "$INSTDIR\Qt5Gui.dll"
|
||||||
Delete "$INSTDIR\Qt5Network.dll"
|
Delete "$INSTDIR\Qt5Network.dll"
|
||||||
Delete "$INSTDIR\Qt5Svg.dll"
|
Delete "$INSTDIR\Qt5Svg.dll"
|
||||||
Delete "$INSTDIR\Qt5Widgets.dll"
|
Delete "$INSTDIR\Qt5Widgets.dll"
|
||||||
Delete "$INSTDIR\Qt5WinExtras.dll"
|
|
||||||
Delete "$INSTDIR\lang\gta5sync_en_US.qm"
|
Delete "$INSTDIR\lang\gta5sync_en_US.qm"
|
||||||
Delete "$INSTDIR\lang\gta5sync_de.qm"
|
Delete "$INSTDIR\lang\gta5sync_de.qm"
|
||||||
Delete "$INSTDIR\lang\gta5sync_fr.qm"
|
Delete "$INSTDIR\lang\gta5sync_fr.qm"
|
||||||
|
|
|
@ -21,9 +21,8 @@ find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Network Svg Widgets REQUIRED)
|
||||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS LinguistTools QUIET)
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS LinguistTools QUIET)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WinExtras REQUIRED)
|
|
||||||
list(APPEND GTA5VIEW_LIBS
|
list(APPEND GTA5VIEW_LIBS
|
||||||
Qt${QT_VERSION_MAJOR}::WinExtras
|
dwmapi
|
||||||
)
|
)
|
||||||
list(APPEND GTA5VIEW_DEFINES
|
list(APPEND GTA5VIEW_DEFINES
|
||||||
-DUNICODE
|
-DUNICODE
|
||||||
|
@ -40,9 +39,9 @@ if(APPLE)
|
||||||
)
|
)
|
||||||
set(MACOSX_BUNDLE_BUNDLE_NAME gta5view)
|
set(MACOSX_BUNDLE_BUNDLE_NAME gta5view)
|
||||||
set(MACOSX_BUNDLE_BUNDLE_VERSION 1.10.0)
|
set(MACOSX_BUNDLE_BUNDLE_VERSION 1.10.0)
|
||||||
set(MACOSX_BUNDLE_ICON_FILE 5sync.icns)
|
set(MACOSX_BUNDLE_ICON_FILE gta5view.icns)
|
||||||
set(MACOSX_BUNDLE_GUI_IDENTIFIER de.syping.gta5view)
|
set(MACOSX_BUNDLE_GUI_IDENTIFIER de.syping.gta5view)
|
||||||
set_source_files_properties(res/5sync.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
set_source_files_properties(res/gta5view.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND GTA5VIEW_DEFINES
|
list(APPEND GTA5VIEW_DEFINES
|
||||||
|
|
|
@ -38,10 +38,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#include "dwmapi.h"
|
||||||
#include <QtWinExtras/QtWin>
|
|
||||||
#include <QtWinExtras/QWinEvent>
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
|
@ -258,36 +255,55 @@ void PictureDialog::adaptDialogSize()
|
||||||
void PictureDialog::styliseDialog()
|
void PictureDialog::styliseDialog()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
BOOL isEnabled;
|
||||||
if (QtWin::isCompositionEnabled()) {
|
DwmIsCompositionEnabled(&isEnabled);
|
||||||
QPalette palette;
|
if (isEnabled == TRUE) {
|
||||||
QtWin::extendFrameIntoClientArea(this, 0, qRound(layout()->menuBar()->height() * AppEnv::screenRatioPR()), 0, 0);
|
MARGINS margins = {0, 0, qRound(layout()->menuBar()->height() * AppEnv::screenRatioPR()), 0};
|
||||||
ui->jsonFrame->setStyleSheet(QString("QFrame{background:%1;}").arg(palette.window().color().name()));
|
HRESULT hr = S_OK;
|
||||||
setStyleSheet("PictureDialog{background:transparent;}");
|
hr = DwmExtendFrameIntoClientArea(reinterpret_cast<HWND>(winId()), &margins);
|
||||||
|
if (SUCCEEDED(hr)) {
|
||||||
|
setStyleSheet("PictureDialog{background:transparent}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QPalette palette;
|
MARGINS margins = {0, 0, 0, 0};
|
||||||
QtWin::resetExtendedFrame(this);
|
DwmExtendFrameIntoClientArea(reinterpret_cast<HWND>(winId()), &margins);
|
||||||
ui->jsonFrame->setStyleSheet(QString("QFrame{background:%1;}").arg(palette.window().color().name()));
|
bool colorOk = false;
|
||||||
setStyleSheet(QString("PictureDialog{background:%1;}").arg(QtWin::realColorizationColor().name()));
|
QSettings dwmRegistry("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\DWM", QSettings::NativeFormat);
|
||||||
|
QRgb color = dwmRegistry.value("ColorizationColor").toUInt(&colorOk);
|
||||||
|
if (colorOk) {
|
||||||
|
setStyleSheet(QString("PictureDialog{background:%1}").arg(QColor::fromRgba(color).name()));
|
||||||
}
|
}
|
||||||
#endif
|
else {
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
BOOL isOpaqueBlend;
|
||||||
|
DWORD colorization;
|
||||||
|
hr = DwmGetColorizationColor(&colorization, &isOpaqueBlend);
|
||||||
|
if (SUCCEEDED(hr) && isOpaqueBlend == FALSE) {
|
||||||
|
color = colorization;
|
||||||
|
setStyleSheet(QString("PictureDialog{background:%1}").arg(QColor::fromRgba(color).name()));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setStyleSheet("PictureDialog{background:palette(window)}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ui->jsonFrame->setStyleSheet("QFrame{background:palette(window)}");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PictureDialog::event(QEvent *event)
|
|
||||||
{
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050000
|
||||||
if (naviEnabled) {
|
bool PictureDialog::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
||||||
if (event->type() == QWinEvent::CompositionChange || event->type() == QWinEvent::ColorizationChange) {
|
{
|
||||||
|
MSG *msg = reinterpret_cast<MSG*>(message);
|
||||||
|
if (msg->message == WM_DWMCOMPOSITIONCHANGED || msg->message == WM_DWMCOLORIZATIONCOLORCHANGED) {
|
||||||
styliseDialog();
|
styliseDialog();
|
||||||
}
|
}
|
||||||
|
return QWidget::nativeEvent(eventType, message, result);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return QDialog::event(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PictureDialog::nextPictureRequestedSlot()
|
void PictureDialog::nextPictureRequestedSlot()
|
||||||
{
|
{
|
||||||
|
@ -355,7 +371,7 @@ bool PictureDialog::eventFilter(QObject *obj, QEvent *ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050000
|
||||||
if (obj != ui->labPicture && naviEnabled) {
|
if (obj != ui->labPicture && naviEnabled) {
|
||||||
if (ev->type() == QEvent::MouseButtonPress) {
|
if (ev->type() == QEvent::MouseButtonPress) {
|
||||||
QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(ev);
|
QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(ev);
|
||||||
|
@ -674,11 +690,6 @@ void PictureDialog::on_labPicture_mouseDoubleClicked(Qt::MouseButton button)
|
||||||
|
|
||||||
pictureWidget->move(desktopRect.x(), desktopRect.y());
|
pictureWidget->move(desktopRect.x(), desktopRect.y());
|
||||||
pictureWidget->resize(desktopRect.width(), desktopRect.height());
|
pictureWidget->resize(desktopRect.width(), desktopRect.height());
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
#if QT_VERSION >= 0x050200
|
|
||||||
QtWin::markFullscreenWindow(pictureWidget, true);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
pictureWidget->showFullScreen();
|
pictureWidget->showFullScreen();
|
||||||
pictureWidget->setFocus();
|
pictureWidget->setFocus();
|
||||||
pictureWidget->raise();
|
pictureWidget->raise();
|
||||||
|
|
|
@ -89,7 +89,11 @@ protected:
|
||||||
void closeEvent(QCloseEvent *ev);
|
void closeEvent(QCloseEvent *ev);
|
||||||
bool eventFilter(QObject *obj, QEvent *ev);
|
bool eventFilter(QObject *obj, QEvent *ev);
|
||||||
void mousePressEvent(QMouseEvent *ev);
|
void mousePressEvent(QMouseEvent *ev);
|
||||||
bool event(QEvent *event);
|
#ifdef Q_OS_WIN
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
bool nativeEvent(const QByteArray &eventType, void *message, long *result);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString generateCrewString();
|
QString generateCrewString();
|
||||||
|
@ -120,7 +124,7 @@ private:
|
||||||
int avatarSize;
|
int avatarSize;
|
||||||
QMenu *manageMenu;
|
QMenu *manageMenu;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050000
|
||||||
QPoint dragPosition;
|
QPoint dragPosition;
|
||||||
bool dragStart;
|
bool dragStart;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
QT += core gui network svg
|
QT += core gui network svg
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): greaterThan(QT_MINOR_VERSION, 1): win32: QT += winextras
|
greaterThan(QT_MAJOR_VERSION, 4): greaterThan(QT_MINOR_VERSION, 1): win32: LIBS += -ldwmapi
|
||||||
|
|
||||||
DEPLOYMENT.display_name = gta5view
|
DEPLOYMENT.display_name = gta5view
|
||||||
TARGET = gta5view
|
TARGET = gta5view
|
||||||
|
@ -186,7 +186,7 @@ win32: CONFIG -= embed_manifest_exe
|
||||||
contains(DEFINES, GTA5SYNC_TELEMETRY): win32: LIBS += -ld3d9 # Required for getting information about GPU
|
contains(DEFINES, GTA5SYNC_TELEMETRY): win32: LIBS += -ld3d9 # Required for getting information about GPU
|
||||||
|
|
||||||
# MAC OS X ONLY
|
# MAC OS X ONLY
|
||||||
macx: ICON = res/5sync.icns
|
macx: ICON = res/gta5view.icns
|
||||||
|
|
||||||
# QT4 ONLY STUFF
|
# QT4 ONLY STUFF
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue