mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Merge remote-tracking branch 'origin/linuxFixes3'
# Conflicts: # ScreenPlay/app.cpp # ScreenPlay/src/sdkconnector.cpp Removing QtBreakpad for now for linux and mac
This commit is contained in:
commit
f0550d9508
@ -5,7 +5,10 @@ CONFIG += c++17
|
||||
TARGETPATH = ScreenPlay
|
||||
|
||||
include($$PWD/../Common/qt-google-analytics/qt-google-analytics.pri)
|
||||
include($$PWD/../Common/qt-breakpad/qt-breakpad.pri)
|
||||
|
||||
!unix {
|
||||
include($$PWD/../Common/qt-breakpad/qt-breakpad.pri)
|
||||
}
|
||||
|
||||
ICON = favicon.ico
|
||||
|
||||
@ -69,7 +72,6 @@ HEADERS += \
|
||||
INCLUDEPATH += \
|
||||
$$PWD/src/\
|
||||
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
install_assets.path = $${OUT_PWD}/assets/fonts
|
||||
} else {
|
||||
@ -78,6 +80,20 @@ CONFIG(debug, debug|release) {
|
||||
|
||||
install_assets.files += $$PWD/assets/fonts/NotoSansCJKkr-Regular.otf
|
||||
|
||||
win32: ARCH_OS = x64-windows
|
||||
unix:!macx { ARCH_OS = x64-linux}
|
||||
macx: ARCH_OS = x64-osx
|
||||
|
||||
CONFIG(debug, debug|release){
|
||||
ARCH_OS_BUILD = $$ARCH_OS/debug
|
||||
} else {
|
||||
ARCH_OS_BUILD = $$ARCH_OS
|
||||
}
|
||||
|
||||
INCLUDEPATH += $$PWD/../Common/vcpkg/installed/$$ARCH_OS/include
|
||||
DEPENDPATH += $$PWD/../Common/vcpkg/installed/$$ARCH_OS/include
|
||||
|
||||
|
||||
win32 {
|
||||
RC_ICONS += favicon.ico
|
||||
CONFIG(debug, debug|release) {
|
||||
@ -86,75 +102,38 @@ win32 {
|
||||
install_it.path = $${OUT_PWD}/release/
|
||||
}
|
||||
|
||||
INCLUDEPATH += $$PWD/../Common/vcpkg/installed/x64-windows/include
|
||||
DEPENDPATH += $$PWD/../Common/vcpkg/installed/x64-windows/include
|
||||
|
||||
LIBS += -luser32
|
||||
LIBS += -L$$PWD/../Common/vcpkg/installed/x64-windows/lib/ -llibzippp
|
||||
LIBS += -L$$PWD/../Common/vcpkg/installed/x64-windows/lib/ -llibzippp
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
install_it.files += $$PWD/../Common/vcpkg/installed/x64-windows/debug/bin/zip.dll \
|
||||
$$PWD/../Common/vcpkg/installed/x64-windows/debug/bin/zlibd1.dll \
|
||||
$$PWD/../Common/vcpkg/installed/x64-windows/debug/bin/libzippp.dll \
|
||||
$$PWD/../Common/vcpkg/installed/x64-windows/debug/bin/bz2d.dll \
|
||||
$$PWD/../Common/vcpkg/installed/x64-windows/debug/bin/libcrypto-1_1-x64.dll \
|
||||
$$PWD/../Common/vcpkg/installed/x64-windows/debug/bin/libssl-1_1-x64.dll \
|
||||
|
||||
} else {
|
||||
install_it.files += $$PWD/../Common/vcpkg/installed/x64-windows/bin/zip.dll \
|
||||
$$PWD/../Common/vcpkg/installed/x64-windows/bin/zlib1.dll \
|
||||
$$PWD/../Common/vcpkg/installed/x64-windows/bin/libzippp.dll \
|
||||
$$PWD/../Common/vcpkg/installed/x64-windows/bin/bz2.dll \
|
||||
$$PWD/../Common/vcpkg/installed/x64-windows/bin/libcrypto-1_1-x64.dll \
|
||||
$$PWD/../Common/vcpkg/installed/x64-windows/bin/libssl-1_1-x64.dll \
|
||||
}
|
||||
install_it.files += $$PWD/../Common/vcpkg/installed/$$ARCH_OS_BUILD/bin/zip.dll \
|
||||
$$PWD/../Common/vcpkg/installed/$$ARCH_OS_BUILD/bin/zlibd1.dll \
|
||||
$$PWD/../Common/vcpkg/installed/$$ARCH_OS_BUILD/bin/libzippp.dll \
|
||||
$$PWD/../Common/vcpkg/installed/$$ARCH_OS_BUILD/bin/bz2d.dll \
|
||||
$$PWD/../Common/vcpkg/installed/$$ARCH_OS_BUILD/bin/libcrypto-1_1-x64.dll \
|
||||
$$PWD/../Common/vcpkg/installed/$$ARCH_OS_BUILD/bin/libssl-1_1-x64.dll \
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
macx {
|
||||
LIBS += -L$$PWD/ThirdParty/steam/redistributable_bin/osx32/ -lsteam_api
|
||||
DEPENDPATH += $$PWD/ThirdParty/steam/redistributable_bin/osx32
|
||||
|
||||
INCLUDEPATH += $$PWD/ThirdParty/steam/
|
||||
DEPENDPATH += $$PWD/ThirdParty/steam/
|
||||
|
||||
LIBS += -L$$PWD/ThirdParty/steam/lib/osx32/ -lsdkencryptedappticket
|
||||
|
||||
steam_data.files += steam_appid.txt
|
||||
steam_data.path = Contents/MacOS
|
||||
steam_data_lib.files += $$PWD/ThirdParty/steam/redistributable_bin/osx32/libsteam_api.dylib
|
||||
steam_data_lib.path = Contents/MacOS/
|
||||
QMAKE_BUNDLE_DATA += steam_data
|
||||
QMAKE_BUNDLE_DATA += steam_data_lib
|
||||
|
||||
}
|
||||
|
||||
unix {
|
||||
INCLUDEPATH += $$PWD/../Common/vcpkg/installed/x64-linux/include
|
||||
DEPENDPATH += $$PWD/../Common/vcpkg/installed/x64-linux/include
|
||||
|
||||
LIBS += -L$$PWD/../Common/vcpkg/installed/x64-linux/lib/ -llibzippp -lzip
|
||||
|
||||
install_it.path = $${OUT_PWD}
|
||||
LIBS += -L$$PWD/../Common/vcpkg/installed/$$ARCH_OS_BUILD/lib/ -llibzippp -lzip -lbz2d -lz -lcrypto -lssl -ldl
|
||||
|
||||
install_it.files += $$PWD/../Common/vcpkg/installed/$$ARCH_OS_BUILD/bin/libbz2d.so \
|
||||
$$PWD/../Common/vcpkg/installed/$$ARCH_OS_BUILD/bin/libcrypto.so \
|
||||
$$PWD/../Common/vcpkg/installed/$$ARCH_OS_BUILD/bin/liblibzippp.so \
|
||||
$$PWD/../Common/vcpkg/installed/$$ARCH_OS_BUILD/bin/libssl.so \
|
||||
$$PWD/../Common/vcpkg/installed/$$ARCH_OS_BUILD/bin/libz.so \
|
||||
$$PWD/../Common/vcpkg/installed/$$ARCH_OS_BUILD/bin/libzip.so \
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
install_it.files += $$PWD/../Common/vcpkg/installed/x64-linux/debug/bin/zip.so \
|
||||
$$PWD/../Common/vcpkg/installed/x64-linux/debug/bin/zlibd1.so \
|
||||
$$PWD/../Common/vcpkg/installed/x64-linux/debug/bin/libzippp.so \
|
||||
$$PWD/../Common/vcpkg/installed/x64-linux/debug/bin/bz2d.so \
|
||||
$$PWD/../Common/vcpkg/installed/x64-linux/debug/bin/libcrypto-1_1-x64.so \
|
||||
$$PWD/../Common/vcpkg/installed/x64-linux/debug/bin/libssl-1_1-x64.so \
|
||||
|
||||
} else {
|
||||
install_it.files += $$PWD/../Common/vcpkg/installed/x64-linux/bin/zip.so \
|
||||
$$PWD/../Common/vcpkg/installed/x64-linux/bin/zlib1.so \
|
||||
$$PWD/../Common/vcpkg/installed/x64-linux/bin/libzippp.so \
|
||||
$$PWD/../Common/vcpkg/installed/x64-linux/bin/bz2.so \
|
||||
$$PWD/../Common/vcpkg/installed/x64-linux/bin/libcrypto-1_1-x64.so \
|
||||
$$PWD/../Common/vcpkg/installed/x64-linux/bin/libssl-1_1-x64.so \
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,8 +51,10 @@ App::App()
|
||||
QGuiApplication::setApplicationName("ScreenPlay");
|
||||
QGuiApplication::setApplicationVersion("0.10.1");
|
||||
QGuiApplication::setQuitOnLastWindowClosed(false);
|
||||
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
QtBreakpad::init(QDir::current().absolutePath());
|
||||
#endif
|
||||
|
||||
QFontDatabase::addApplicationFont(":/assets/fonts/LibreBaskerville-Italic.ttf");
|
||||
|
||||
@ -117,7 +119,7 @@ void App::init()
|
||||
m_telemetry->setNetworkAccessManager(nam);
|
||||
m_telemetry->setSendInterval(1000);
|
||||
m_telemetry->startSession();
|
||||
m_telemetry->sendEvent("version", QGuiApplication::applicationVersion());
|
||||
m_telemetry->sendEvent("version", QApplication::applicationVersion());
|
||||
}
|
||||
|
||||
m_create = make_unique<Create>(m_globalVariables);
|
||||
@ -139,7 +141,7 @@ void App::init()
|
||||
m_installedListModel->init();
|
||||
|
||||
// Set visible if the -silent parameter was not set
|
||||
if (QGuiApplication::instance()->arguments().contains("-silent")) {
|
||||
if (QApplication::instance()->arguments().contains("-silent")) {
|
||||
settings()->setSilentStart(true);
|
||||
}
|
||||
|
||||
@ -150,13 +152,13 @@ void App::init()
|
||||
void App::exit()
|
||||
{
|
||||
if (!m_telemetry) {
|
||||
QGuiApplication::instance()->quit();
|
||||
QApplication::instance()->quit();
|
||||
return;
|
||||
} else {
|
||||
// Workaround because we cannot force to send exit event
|
||||
m_telemetry->setSendInterval(5);
|
||||
m_telemetry->endSession();
|
||||
QTimer::singleShot(150, []() { QGuiApplication::instance()->quit(); });
|
||||
QTimer::singleShot(150, []() { QApplication::instance()->quit(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +16,9 @@
|
||||
#include <memory>
|
||||
|
||||
#include "ganalytics.h"
|
||||
#ifdef Q_OS_WINDOWS
|
||||
#include "qt_breakpad.h"
|
||||
|
||||
#endif
|
||||
#include "src/create.h"
|
||||
#include "src/globalvariables.h"
|
||||
#include "src/installedlistfilter.h"
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include <QGuiApplication>
|
||||
#include <QApplication>
|
||||
|
||||
#include "app.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QGuiApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||
|
||||
QGuiApplication qtGuiApp(argc, argv);
|
||||
QApplication qtGuiApp(argc, argv);
|
||||
|
||||
ScreenPlay::App app;
|
||||
|
||||
|
@ -25,9 +25,9 @@ MonitorListModel::MonitorListModel(QObject* parent)
|
||||
{
|
||||
loadMonitors();
|
||||
|
||||
auto* guiAppInst = dynamic_cast<QGuiApplication*>(QGuiApplication::instance());
|
||||
connect(guiAppInst, &QGuiApplication::screenAdded, this, &MonitorListModel::screenAdded);
|
||||
connect(guiAppInst, &QGuiApplication::screenRemoved, this, &MonitorListModel::screenRemoved);
|
||||
auto* guiAppInst = dynamic_cast<QApplication*>(QApplication::instance());
|
||||
connect(guiAppInst, &QApplication::screenAdded, this, &MonitorListModel::screenAdded);
|
||||
connect(guiAppInst, &QApplication::screenRemoved, this, &MonitorListModel::screenRemoved);
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> MonitorListModel::roleNames() const
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <QAbstractListModel>
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QGuiApplication>
|
||||
#include <QApplication>
|
||||
#include <QRect>
|
||||
#include <QScreen>
|
||||
#include <QSize>
|
||||
@ -100,7 +100,7 @@ public slots:
|
||||
|
||||
QRect getAbsoluteDesktopSize() const
|
||||
{
|
||||
auto* app = static_cast<QGuiApplication*>(QGuiApplication::instance());
|
||||
auto* app = static_cast<QApplication*>(QApplication::instance());
|
||||
return app->screens().at(0)->availableVirtualGeometry();
|
||||
}
|
||||
|
||||
|
@ -49,10 +49,8 @@ void ScreenPlayManager::createWallpaper(
|
||||
if (m_telemetry) {
|
||||
m_telemetry->sendEvent("wallpaper", "start");
|
||||
}
|
||||
QString path = absoluteStoragePath;
|
||||
|
||||
if (absoluteStoragePath.contains("file:///"))
|
||||
path = path.remove("file:///");
|
||||
QString path = QUrl(absoluteStoragePath).toLocalFile();
|
||||
|
||||
std::sort(monitorIndex.begin(), monitorIndex.end());
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QApplication>
|
||||
#include <QObject>
|
||||
#include <QPoint>
|
||||
#include <QProcess>
|
||||
|
@ -97,7 +97,7 @@ Settings::Settings(const shared_ptr<GlobalVariables>& globalVariables,
|
||||
* not generate warnings.
|
||||
*/
|
||||
QDir dir;
|
||||
QString path = QGuiApplication::instance()->applicationDirPath() + "/../../workshop/content/672870";
|
||||
QString path = QApplication::instance()->applicationDirPath() + "/../../workshop/content/672870";
|
||||
if (!dir.mkpath(path)) {
|
||||
qWarning() << "Could not create steam workshop path for path: " << path;
|
||||
} else {
|
||||
@ -124,6 +124,10 @@ Settings::Settings(const shared_ptr<GlobalVariables>& globalVariables,
|
||||
void Settings::writeJsonFileFromResource(const QString& filename)
|
||||
{
|
||||
QFile file(m_globalVariables->localSettingsPath().toString() + "/" + filename + ".json");
|
||||
QDir directory(m_globalVariables->localSettingsPath().toString());
|
||||
if(!directory.exists()){
|
||||
directory.mkpath(directory.path());
|
||||
}
|
||||
QFile defaultSettings(":/" + filename + ".json");
|
||||
|
||||
file.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||
@ -161,6 +165,11 @@ void Settings::setupWidgetAndWindowPaths()
|
||||
m_globalVariables->setWidgetExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWidget/debug/ScreenPlayWidget.exe"));
|
||||
m_globalVariables->setWallpaperExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWallpaper/debug/ScreenPlayWallpaper.exe"));
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
m_globalVariables->setWidgetExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWidget/ScreenPlayWidget"));
|
||||
m_globalVariables->setWallpaperExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWallpaper/ScreenPlayWallpaper"));
|
||||
#endif
|
||||
}
|
||||
|
||||
// We need to detect the right base path so we can copy later the example projects
|
||||
@ -236,7 +245,7 @@ void Settings::setupLanguage()
|
||||
|
||||
bool Settings::retranslateUI()
|
||||
{
|
||||
auto* app = static_cast<QGuiApplication*>(QGuiApplication::instance());
|
||||
auto* app = static_cast<QApplication*>(QApplication::instance());
|
||||
QString langCode = QVariant::fromValue(language()).toString();
|
||||
langCode = langCode.toLower();
|
||||
QFile tsFile;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFontDatabase>
|
||||
#include <QGuiApplication>
|
||||
#include <QApplication>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
@ -203,8 +203,9 @@ public slots:
|
||||
settings.sync();
|
||||
} else {
|
||||
settings.remove("ScreenPlay");
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
setqSetting("Autostart", autostart);
|
||||
|
||||
|
@ -28,7 +28,7 @@ Util::Util(QNetworkAccessManager* networkAccessManager, QObject* parent)
|
||||
// This gives us nice clickable output in QtCreator
|
||||
qSetMessagePattern("%{if-category}%{category}: %{endif}%{message}\n Loc: [%{file}:%{line}]");
|
||||
|
||||
QString path = QGuiApplication::instance()->applicationDirPath() + "/";
|
||||
QString path = QApplication::instance()->applicationDirPath() + "/";
|
||||
QFile fileFFMPEG;
|
||||
QFile fileFFPROBE;
|
||||
|
||||
@ -49,7 +49,7 @@ Util::Util(QNetworkAccessManager* networkAccessManager, QObject* parent)
|
||||
*/
|
||||
void Util::copyToClipboard(const QString& text) const
|
||||
{
|
||||
auto* clipboard = QGuiApplication::clipboard();
|
||||
auto* clipboard = QApplication::clipboard();
|
||||
clipboard->setText(text);
|
||||
}
|
||||
|
||||
@ -323,7 +323,7 @@ void Util::downloadFFMPEG()
|
||||
return;
|
||||
}
|
||||
|
||||
string path = QGuiApplication::instance()->applicationDirPath().toStdString() + "/";
|
||||
string path = QApplication::instance()->applicationDirPath().toStdString() + "/";
|
||||
|
||||
ZipEntry entryFFMPEG;
|
||||
std::string entryFFMPEGPath;
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QGuiApplication>
|
||||
#include <QApplication>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QNetworkAccessManager>
|
||||
|
@ -6,7 +6,6 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
TARGETPATH = ScreenPlayWallpaper
|
||||
|
||||
include($$PWD/../Common/qt-breakpad/qt-breakpad.pri)
|
||||
|
||||
|
||||
RESOURCES += \
|
||||
@ -29,6 +28,7 @@ unix{
|
||||
}
|
||||
|
||||
win32 {
|
||||
include($$PWD/../Common/qt-breakpad/qt-breakpad.pri)
|
||||
LIBS += -luser32
|
||||
SOURCES += \
|
||||
src/windowsdesktopproperties.cpp \
|
||||
@ -79,6 +79,8 @@ unix {
|
||||
|
||||
install_it.path = $${OUT_PWD}/
|
||||
|
||||
LIBS += -lX11
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
install_it.files += \
|
||||
$$PWD/../Common/vcpkg/installed/x64-linux/debug/bin/libcrypto-1_1-x64.so \
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include <QtWebEngine>
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#include "qt_breakpad.h"
|
||||
|
||||
#include "src/winwindow.h"
|
||||
#endif
|
||||
|
||||
@ -18,18 +20,15 @@
|
||||
#endif
|
||||
|
||||
#include "../ScreenPlaySDK/screenplaysdk.h"
|
||||
#include "qt_breakpad.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QGuiApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QtBreakpad::init(QDir::current().absolutePath());
|
||||
|
||||
// This gives us nice clickable output in QtCreator
|
||||
qSetMessagePattern("%{if-category}%{category}: %{endif}%{message}\n Loc: [%{file}:%{line}]");
|
||||
|
||||
@ -41,6 +40,8 @@ int main(int argc, char* argv[])
|
||||
//Set the monitor number to test
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
QtBreakpad::init(QDir::current().absolutePath());
|
||||
|
||||
//WinWindow window1({ 0 }, "test", "appid", "1", "fill");
|
||||
//WinWindow window2({ 1 }, "test", "appid", "1", "fill");
|
||||
//WinWindow window3({ 2 }, "test", "appid", "1", "fill");
|
||||
@ -48,7 +49,7 @@ int main(int argc, char* argv[])
|
||||
WinWindow window({ 0 }, "C:/Program Files (x86)/Steam/steamapps/workshop/content/672870/1958068745", "appid", "1", "fill", true);
|
||||
#endif
|
||||
#if defined(Q_OS_LINUX)
|
||||
LinuxWindow window(QVector<int>{ 0 }, "test", "appid", "1", "fill");
|
||||
LinuxWindow window({ 0 }, "/home/graphicscore/Desktop/wallpapers/MechaGirl", "appid", "1", "fill", false);
|
||||
#endif
|
||||
#if defined(Q_OS_OSX)
|
||||
MacWindow window({ 0 }, "test", "appid", "1", "fill");
|
||||
@ -115,7 +116,7 @@ int main(int argc, char* argv[])
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
LinuxWindow window(list, argumentList.at(2), argumentList.at(3), argumentList.at(4), argumentList.at(5));
|
||||
LinuxWindow window(list, argumentList.at(2), argumentList.at(3), argumentList.at(4), argumentList.at(5), checkWallpaperVisible);
|
||||
QObject::connect(&sdk, &ScreenPlaySDK::sdkDisconnected, &window, &LinuxWindow::destroyThis);
|
||||
QObject::connect(&sdk, &ScreenPlaySDK::incommingMessage, &window, &LinuxWindow::messageReceived);
|
||||
#endif
|
||||
|
@ -1,14 +1,173 @@
|
||||
#include "linuxwindow.h"
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
LinuxWindow::LinuxWindow(QVector<int> activeScreensList, QString projectPath, QString id, QString volume, const QString fillmode, QObject* parent)
|
||||
: BaseWindow(projectPath)
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define WIDTH 512
|
||||
#define HEIGHT 384
|
||||
|
||||
#define OPAQUE 0xffffffff
|
||||
|
||||
#define NAME "xwinwrap"
|
||||
|
||||
#define ATOM(a) XInternAtom(display, #a, False)
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
* This code is non functional only here for testing!
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
LinuxWindow::LinuxWindow(QVector<int> activeScreensList, QString projectPath, QString id, QString volume, const QString fillmode, const bool checkWallpaperVisible, QObject* parent)
|
||||
: BaseWindow(projectPath, activeScreensList, checkWallpaperVisible)
|
||||
{
|
||||
m_window.setWidth(1920);
|
||||
m_window.setHeight(1080);
|
||||
|
||||
m_window.show();
|
||||
|
||||
setAppID(id);
|
||||
|
||||
bool ok = false;
|
||||
float volumeParsed = volume.toFloat(&ok);
|
||||
if (!ok) {
|
||||
qFatal("Could not parse volume");
|
||||
}
|
||||
|
||||
setVolume(volumeParsed);
|
||||
setFillMode(fillmode);
|
||||
|
||||
// Ether for one Screen or for all
|
||||
if ((QApplication::screens().length() == activeScreensList.length()) && (activeScreensList.length() != 1)) {
|
||||
setupWallpaperForAllScreens();
|
||||
} else if (activeScreensList.length() == 1) {
|
||||
setupWallpaperForOneScreen(activeScreensList.at(0));
|
||||
setCanFade(true);
|
||||
} else if (activeScreensList.length() > 1) {
|
||||
setupWallpaperForMultipleScreens(activeScreensList);
|
||||
}
|
||||
|
||||
setWidth(m_window.width());
|
||||
setHeight(m_window.height());
|
||||
|
||||
m_window.setResizeMode(QQuickView::ResizeMode::SizeRootObjectToView);
|
||||
m_window.rootContext()->setContextProperty("window", this);
|
||||
//m_window.rootContext()->setContextProperty("desktopProperties", &m_windowsDesktopProperties);
|
||||
// Instead of setting "renderType: Text.NativeRendering" every time
|
||||
// we can set it here once :)
|
||||
|
||||
m_window.setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering);
|
||||
m_window.setSource(QUrl("qrc:/mainWindow.qml"));
|
||||
|
||||
Window window = m_window.winId();
|
||||
|
||||
Display* display = XOpenDisplay("");
|
||||
|
||||
XSetWindowAttributes attrs = { ParentRelative, 0L, 0, 0L, 0, 0,
|
||||
Always, 0L, 0L, False, StructureNotifyMask | ExposureMask | ButtonPressMask | ButtonReleaseMask, 0L, False, 0, 0 };
|
||||
|
||||
XWMHints wmHint;
|
||||
Atom xa;
|
||||
|
||||
int flags;
|
||||
|
||||
flags |= CWBorderPixel | CWColormap;
|
||||
|
||||
XChangeWindowAttributes(display, window, flags, &attrs);
|
||||
|
||||
wmHint.flags = InputHint | StateHint;
|
||||
wmHint.input = true;
|
||||
wmHint.initial_state = WithdrawnState;
|
||||
|
||||
XSetWMProperties(display, window, NULL, NULL, NULL,
|
||||
0, NULL, &wmHint, NULL);
|
||||
|
||||
xa = ATOM(_NET_WM_WINDOW_TYPE);
|
||||
|
||||
Atom prop;
|
||||
|
||||
xa = ATOM(_MOTIF_WM_HINTS);
|
||||
if (xa != None) {
|
||||
long prop[5] = { 2, 0, 0, 0, 0 };
|
||||
XChangeProperty(display, window, xa, xa, 32,
|
||||
PropModeReplace, (unsigned char*)prop, 5);
|
||||
}
|
||||
|
||||
xa = ATOM(_NET_WM_STATE);
|
||||
if (xa != None) {
|
||||
Atom xa_prop = ATOM(_NET_WM_STATE_BELOW);
|
||||
|
||||
XChangeProperty(display, window, xa, XA_ATOM, 32,
|
||||
PropModeAppend, (unsigned char*)&xa_prop, 1);
|
||||
}
|
||||
|
||||
xa = ATOM(_NET_WM_DESKTOP);
|
||||
if (xa != None) {
|
||||
CARD32 xa_prop = 0xFFFFFFFF;
|
||||
|
||||
XChangeProperty(display, window, xa, XA_CARDINAL, 32,
|
||||
PropModeAppend, (unsigned char*)&xa_prop, 1);
|
||||
}
|
||||
|
||||
xa = ATOM(_NET_WM_STATE);
|
||||
if (xa != None) {
|
||||
Atom xa_prop = ATOM(_NET_WM_STATE_STICKY);
|
||||
|
||||
XChangeProperty(display, window, xa, XA_ATOM, 32,
|
||||
PropModeAppend, (unsigned char*)&xa_prop, 1);
|
||||
}
|
||||
|
||||
xa = ATOM(_NET_WM_STATE);
|
||||
if (xa != None) {
|
||||
Atom xa_prop = ATOM(_NET_WM_STATE_SKIP_TASKBAR);
|
||||
|
||||
XChangeProperty(display, window, xa, XA_ATOM, 32,
|
||||
PropModeAppend, (unsigned char*)&xa_prop, 1);
|
||||
}
|
||||
xa = ATOM(_NET_WM_STATE);
|
||||
if (xa != None) {
|
||||
Atom xa_prop = ATOM(_NET_WM_STATE_SKIP_PAGER);
|
||||
|
||||
XChangeProperty(display, window, xa, XA_ATOM, 32,
|
||||
PropModeAppend, (unsigned char*)&xa_prop, 1);
|
||||
}
|
||||
|
||||
XMapWindow(display, window);
|
||||
|
||||
XSync(display, window);
|
||||
|
||||
/*QObject::connect(&m_checkForFullScreenWindowTimer, &QTimer::timeout, this, &WinWindow::checkForFullScreenWindow);
|
||||
|
||||
if (checkWallpaperVisible) {
|
||||
m_checkForFullScreenWindowTimer.start(10);
|
||||
}
|
||||
|
||||
QTimer::singleShot(1000, [this]() {
|
||||
setupWindowMouseHook();
|
||||
});*/
|
||||
|
||||
/*********/
|
||||
|
||||
/*bool ok = false;
|
||||
float volumeParsed = volume.toFloat(&ok);
|
||||
if (!ok) {
|
||||
qFatal("Could not parse volume");
|
||||
}
|
||||
setVolume(volumeParsed);
|
||||
|
||||
// WARNING: Setting Window flags must be called *here*!
|
||||
@ -20,7 +179,19 @@ LinuxWindow::LinuxWindow(QVector<int> activeScreensList, QString projectPath, QS
|
||||
// Instead of setting "renderType: Text.NativeRendering" every time
|
||||
// we can set it here once :)
|
||||
m_window.setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering);
|
||||
m_window.setSource(QUrl("qrc:/mainWindow.qml"));
|
||||
m_window.setSource(QUrl("qrc:/mainWindow.qml"));*/
|
||||
}
|
||||
|
||||
void LinuxWindow::setupWallpaperForOneScreen(int activeScreen)
|
||||
{
|
||||
}
|
||||
|
||||
void LinuxWindow::setupWallpaperForAllScreens()
|
||||
{
|
||||
}
|
||||
|
||||
void LinuxWindow::setupWallpaperForMultipleScreens(const QVector<int>& activeScreensList)
|
||||
{
|
||||
}
|
||||
|
||||
void LinuxWindow::setVisible(bool show)
|
||||
@ -32,4 +203,3 @@ void LinuxWindow::destroyThis()
|
||||
{
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ class LinuxWindow : public BaseWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LinuxWindow(QVector<int> activeScreensList, QString projectPath, QString id, QString volume, const QString fillmode,QObject *parent = nullptr);
|
||||
explicit LinuxWindow(QVector<int> activeScreensList, QString projectPath, QString id, QString volume, const QString fillmode,const bool checkWallpaperVisible, QObject *parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
@ -26,5 +26,8 @@ public slots:
|
||||
void destroyThis() override;
|
||||
private:
|
||||
QQuickView m_window;
|
||||
void setupWallpaperForOneScreen(int activeScreen);
|
||||
void setupWallpaperForAllScreens();
|
||||
void setupWallpaperForMultipleScreens(const QVector<int>& activeScreensList);
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <QGuiApplication>
|
||||
#include <QApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QStringList>
|
||||
|
||||
@ -7,10 +7,10 @@
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QGuiApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||
|
||||
QGuiApplication app(argc, argv);
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QStringList argumentList = app.arguments();
|
||||
|
||||
|
@ -13,7 +13,7 @@ WidgetWindow::WidgetWindow(const QString projectPath, const QString appid, const
|
||||
};
|
||||
|
||||
if (!availableTypes.contains(m_type)) {
|
||||
QGuiApplication::exit(-4);
|
||||
QApplication::exit(-4);
|
||||
}
|
||||
|
||||
Qt::WindowFlags flags = m_window.flags();
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QGuiApplication>
|
||||
#include <QApplication>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonParseError>
|
||||
|
Loading…
Reference in New Issue
Block a user