diff --git a/applications/display-server/dbusinterface.cpp b/applications/display-server/dbusinterface.cpp index ec252d852..1b2c46926 100644 --- a/applications/display-server/dbusinterface.cpp +++ b/applications/display-server/dbusinterface.cpp @@ -464,7 +464,6 @@ QList> DbusInterface::visibleSurfaces(){ if( surface->visible() && connection->isRunning() - && !connection->isStopped() ){ surfaces.append(surface); } diff --git a/applications/launcher/main.qml b/applications/launcher/main.qml index 6f524a012..a0a99e86a 100755 --- a/applications/launcher/main.qml +++ b/applications/launcher/main.qml @@ -11,7 +11,6 @@ OxideWindow { visible: true title: qsTr("Oxide") focus: true - backgroundColor: "white" FontLoader { id: iconFont; source: "/font/icomoon.ttf" } onAfterSynchronizing: { if (stateController.state == "loading") { diff --git a/applications/lockscreen/main.cpp b/applications/lockscreen/main.cpp index c71313c6e..85c4282ed 100644 --- a/applications/lockscreen/main.cpp +++ b/applications/lockscreen/main.cpp @@ -15,8 +15,6 @@ using namespace Oxide; using namespace Oxide::QML; using namespace Oxide::Sentry; -#define DEBUG_EVENTS - int main(int argc, char *argv[]){ deviceSettings.setupQtEnvironment(); QGuiApplication app(argc, argv); diff --git a/applications/lockscreen/main.qml b/applications/lockscreen/main.qml index aecee5bb3..11ce2d06d 100644 --- a/applications/lockscreen/main.qml +++ b/applications/lockscreen/main.qml @@ -10,6 +10,7 @@ OxideWindow { objectName: "window" visible: stateController.state != "loading" title: qsTr("Oxide") + color: "black" property int itemPadding: 10 FontLoader { id: iconFont; source: "/font/icomoon.ttf" } Component.onCompleted: { diff --git a/applications/process-manager/main.qml b/applications/process-manager/main.qml index 88fe76f26..7029b94e3 100755 --- a/applications/process-manager/main.qml +++ b/applications/process-manager/main.qml @@ -8,7 +8,6 @@ import "widgets" OxideWindow { id: window visible: true - backgroundColor: "white" onAfterSynchronizing: { if (stateController.state == "loading") { stateController.state = "loaded"; diff --git a/applications/screenshot-viewer/main.qml b/applications/screenshot-viewer/main.qml index e889b2148..d20d24517 100644 --- a/applications/screenshot-viewer/main.qml +++ b/applications/screenshot-viewer/main.qml @@ -9,7 +9,6 @@ OxideWindow { id: window objectName: "window" visible: stateController.state !== "loading" - backgroundColor: "white" title: { if(stateController.state !== "viewing" || !viewer.model){ return Qt.application.displayName; diff --git a/applications/system-service/application.cpp b/applications/system-service/application.cpp index 065df22f3..8c8db02b8 100644 --- a/applications/system-service/application.cpp +++ b/applications/system-service/application.cpp @@ -197,7 +197,6 @@ void Application::interruptApplication(){ startSpan("stopped", "Application is stopped"); } }); - getCompositorDBus()->lower(QString("connection/%1").arg(m_process->processId())); }); } void Application::waitForPause(){ diff --git a/applications/system-service/main.qml b/applications/system-service/main.qml index 6751536b5..83f461008 100644 --- a/applications/system-service/main.qml +++ b/applications/system-service/main.qml @@ -9,7 +9,7 @@ OxideWindow{ height: 1 visible: true opacity: 0 - backgroundColor: "transparent" + color: "transparent" Shortcut{ sequences: ["Alt+Tab"] context: Qt.ApplicationShortcut diff --git a/applications/task-switcher/controller.h b/applications/task-switcher/controller.h index ed4dc5990..2da6ea0d8 100644 --- a/applications/task-switcher/controller.h +++ b/applications/task-switcher/controller.h @@ -10,7 +10,6 @@ #include #include -#include "screenprovider.h" #include "appitem.h" using namespace codes::eeems::oxide1; @@ -28,10 +27,8 @@ class Controller : public QObject { Q_OBJECT public: - Controller(QObject* parent, ScreenProvider* screenProvider) + Controller(QObject* parent) : QObject(parent),applications() { - blankImage = new QImage(qApp->primaryScreen()->geometry().size(), QImage::Format_Mono); - this->screenProvider = screenProvider; auto bus = QDBusConnection::systemBus(); qDebug() << "Waiting for tarnish to start up..."; while(!bus.interface()->registeredServiceNames().value().contains(OXIDE_SERVICE)){ @@ -47,16 +44,8 @@ class Controller : public QObject { connect(signalHandler, &SignalHandler::sigUsr1, this, &Controller::sigUsr1); connect(signalHandler, &SignalHandler::sigUsr2, this, &Controller::sigUsr2); - qDebug() << "Requesting screen API..."; - QDBusObjectPath path = api->requestAPI("screen"); - if(path.path() == "/"){ - qDebug() << "Unable to get screen API"; - throw ""; - } - screenApi = new Screen(OXIDE_SERVICE, path.path(), bus, this); - qDebug() << "Requesting apps API..."; - path = api->requestAPI("apps"); + QDBusObjectPath path = api->requestAPI("apps"); if(path.path() == "/"){ qDebug() << "Unable to get apps API"; throw ""; @@ -66,8 +55,6 @@ class Controller : public QObject { connect(appsApi, &Apps::applicationRegistered, this, &Controller::registerApplication); connect(appsApi, &Apps::applicationLaunched, this, &Controller::reload); connect(appsApi, &Apps::applicationExited, this, &Controller::reload); - - updateImage(); } ~Controller(){} @@ -190,43 +177,6 @@ class Controller : public QObject { } stateControllerUI->setProperty("state", state); } - void updateImage(){ - qDebug() << "Updating background..."; - Oxide::Sentry::sentry_transaction("controller", "updateImage", [this](Oxide::Sentry::Transaction* t){ - QImage* img = nullptr; - Oxide::Sentry::sentry_span(t, "previousApplications", "Get image from previous application", [this, &img](Oxide::Sentry::Span* s){ - auto previousApplications = appsApi->previousApplications(); - while(img == nullptr && !previousApplications.isEmpty()){ - auto name = previousApplications.takeLast(); - Oxide::Sentry::sentry_span(s, name.toStdString(), "Load image from application", [this, &img, previousApplications, name]{ - auto path = ((QDBusObjectPath)appsApi->getApplicationPath(name)).path(); - if(path == "/"){ - O_WARNING("Unable to get save screen for" << name); - return; - } - auto bus = QDBusConnection::systemBus(); - Application app(OXIDE_SERVICE, path, bus, this); - auto data = app.screenCapture(); - auto image = QImage::fromData(data, "JPG"); - if(image.isNull()){ - O_WARNING("Image for " << name << " is corrupt, trying next application"); - return; - } - img = new QImage(image); - qDebug() << "Using save screen from " << name; - }); - } - }); - Oxide::Sentry::sentry_span(t, "update", "Update image", [this, img]{ - if(img != nullptr){ - screenProvider->updateImage(img); - return; - } - qWarning() << "No previous application. Using blank screen"; - screenProvider->updateImage(blankImage); - }); - }); - } void setRoot(QObject* root){ this->root = root; } Apps* getAppsApi() { return appsApi; } @@ -239,7 +189,6 @@ private slots: ::kill(tarnishPid(), SIGUSR1); qDebug() << "Sent to the foreground..."; setState("loading"); - updateImage(); } void sigUsr2(){ qDebug() << "Sent to the background..."; @@ -268,13 +217,10 @@ private slots: private: General* api; - Screen* screenApi; Apps* appsApi; QObject* root = nullptr; QObject* stateControllerUI = nullptr; - ScreenProvider* screenProvider; QList applications; - QImage* blankImage; int tarnishPid() { return api->tarnishPid(); } QObject* getStateControllerUI(){ diff --git a/applications/task-switcher/corrupt_stable.h b/applications/task-switcher/corrupt_stable.h index e36b85be2..d49ced4b7 100644 --- a/applications/task-switcher/corrupt_stable.h +++ b/applications/task-switcher/corrupt_stable.h @@ -18,7 +18,4 @@ #include #include #include - -#include "controller.h" -#include "screenprovider.h" #endif diff --git a/applications/task-switcher/main.cpp b/applications/task-switcher/main.cpp index d749bd2df..f95b5171d 100644 --- a/applications/task-switcher/main.cpp +++ b/applications/task-switcher/main.cpp @@ -6,13 +6,9 @@ #include #include #include -#include #include #include "controller.h" - -#include "screenprovider.h" - using namespace std; using namespace Oxide; using namespace Oxide::QML; @@ -31,22 +27,18 @@ int main(int argc, char *argv[]){ app.setOrganizationDomain(OXIDE_SERVICE); app.setApplicationName("corrupt"); app.setApplicationVersion(APP_VERSION); - auto screenProvider = new ScreenProvider(&app); - Controller controller(&app, screenProvider); + Controller controller(&app); QQmlApplicationEngine engine; registerQML(&engine); QQmlContext* context = engine.rootContext(); context->setContextProperty("apps", QVariant::fromValue(controller.getApps())); context->setContextProperty("controller", &controller); - engine.rootContext()->setContextProperty("screenProvider", screenProvider); - engine.addImageProvider("screen", screenProvider); engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); if (engine.rootObjects().isEmpty()){ qDebug() << "Nothing to display"; return -1; } auto root = engine.rootObjects().first(); - root->installEventFilter(new EventFilter(&app)); controller.setRoot(root); signal(SIGINT, sigHandler); diff --git a/applications/task-switcher/main.qml b/applications/task-switcher/main.qml index c76aaf436..558374b50 100644 --- a/applications/task-switcher/main.qml +++ b/applications/task-switcher/main.qml @@ -8,17 +8,14 @@ import "./widgets" OxideWindow { id: window objectName: "window" - visible: stateController.state === "loaded" - backgroundColor: "transparent" + flags: Qt.FramelessWindowHint title: qsTr("Corrupt") - property int itemPadding: 10 - Connections{ - target: screenProvider - onImageChanged: background.reload() - } + color: "transparent" + Component.onCompleted: controller.startup() + visible: true Connections { target: controller - onReload: { + function onReload(){ appsView.model = controller.getApps(); if(appsView.currentIndex > appsView.count){ appsView.currentIndex = appsView.count @@ -26,49 +23,21 @@ OxideWindow { } } Shortcut{ - sequence: [StandardKey.Cancel, Qt.Key_Backspace] + sequences: [StandardKey.Cancel, "Backspace"] context: Qt.ApplicationShortcut onActivated: controller.previousApplication() } - - Component.onCompleted: { - controller.startup(); - } - background: Rectangle { - Image { - id: background - objectName: "background" - anchors.fill: parent - cache: false - source: "image://screen/image" - visible: stateController.state === "loaded" - property bool counter: false - function reload(){ - controller.breadcrumb("background", "reload"); - console.log("Reloading background"); - counter = !counter - source = "image://screen/image?id=" + counter - } - } - } - initialItem: MouseArea { + initialItem: MouseArea{ anchors.fill: parent - enabled: stateController.state === "loaded" - onClicked: { - controller.breadcrumb("background", "click", "ui"); - controller.previousApplication(); - } + onClicked: controller.previousApplication() } - page.header: Item{} page.footer: Rectangle { id: footer color: "white" border.color: "black" border.width: 1 + width: parent.width height: 150 - anchors.left: parent.left - anchors.right: parent.right - visible: stateController.state === "loaded" clip: true RowLayout { anchors.fill: parent diff --git a/applications/task-switcher/screenprovider.h b/applications/task-switcher/screenprovider.h deleted file mode 100644 index 22f32eb30..000000000 --- a/applications/task-switcher/screenprovider.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef SCREENPROVIDER_H -#define SCREENPROVIDER_H - -#include - -class ScreenProvider: public QObject, public QQuickImageProvider -{ - Q_OBJECT -public: - ScreenProvider(QObject* parent) : QObject(parent), QQuickImageProvider(QQuickImageProvider::Image), image() {}; - -public slots: - void updateImage(QImage* image){ - this->image = image->copy(image->rect()); - emit imageChanged(); - } - QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override { - Q_UNUSED(id); - if(size){ - *size = image.size(); - } - if(requestedSize.width() > 0 && requestedSize.height() > 0) { - image = image.scaled(requestedSize.width(), requestedSize.height(), Qt::KeepAspectRatio); - } - return image; - } - -signals: - void imageChanged(); - -private: - QImage image; -}; - -#endif // SCREENPROVIDER_H diff --git a/applications/task-switcher/task-switcher.pro b/applications/task-switcher/task-switcher.pro index 39f225c57..f006ccd09 100644 --- a/applications/task-switcher/task-switcher.pro +++ b/applications/task-switcher/task-switcher.pro @@ -23,8 +23,7 @@ INSTALLS += applications INCLUDEPATH += ../../shared HEADERS += \ appitem.h \ - controller.h \ - screenprovider.h + controller.h RESOURCES += \ qml.qrc diff --git a/assets/opt/usr/share/applications/codes.eeems.corrupt.oxide b/assets/opt/usr/share/applications/codes.eeems.corrupt.oxide index 53d48d2bd..12754d1e5 100644 --- a/assets/opt/usr/share/applications/codes.eeems.corrupt.oxide +++ b/assets/opt/usr/share/applications/codes.eeems.corrupt.oxide @@ -4,5 +4,5 @@ "bin": "/opt/bin/corrupt", "flags": ["hidden", "nosavescreen", "nosplash"], "type": "backgroundable", - "permissions": ["apps", "screen"] + "permissions": ["apps"] } diff --git a/shared/liboxide/OxideWindow.qml b/shared/liboxide/OxideWindow.qml index 0ae5b6364..a92a9eeda 100644 --- a/shared/liboxide/OxideWindow.qml +++ b/shared/liboxide/OxideWindow.qml @@ -12,7 +12,6 @@ ApplicationWindow { property alias centerMenu: centerMenu.children property alias stack: stack property alias initialItem: stack.initialItem - property alias backgroundColor: background.color property alias headerBackgroundColor: header.color property bool landscape: Oxide.landscape Component.onCompleted: stack.forceActiveFocus() @@ -55,7 +54,7 @@ ApplicationWindow { } background: Rectangle { id: background - color: "black" + color: window.color } contentData: [ StackView { diff --git a/shared/liboxide/devicesettings.cpp b/shared/liboxide/devicesettings.cpp index 5e206ff1e..72849c063 100644 --- a/shared/liboxide/devicesettings.cpp +++ b/shared/liboxide/devicesettings.cpp @@ -207,15 +207,17 @@ namespace Oxide { QCoreApplication::addLibraryPath("/opt/usr/lib/plugins"); qputenv("QMLSCENE_DEVICE", "software"); qputenv("QT_QUICK_BACKEND","software"); + QString platform("oxide:enable_fonts:freetype:freetype"); if(touch){ qputenv( "QT_QPA_PLATFORM", - QString("oxide:enable_fonts:%1") + QString("%1:%2") + .arg(platform) .arg(deviceSettings.getTouchEnvSetting()) .toUtf8() ); }else{ - qputenv("QT_QPA_PLATFORM", "oxide:enable_fonts"); + qputenv("QT_QPA_PLATFORM", platform.toUtf8()); } } diff --git a/shared/qpa/oxidebackingstore.cpp b/shared/qpa/oxidebackingstore.cpp index c0ebac1ab..8a01bfbdb 100644 --- a/shared/qpa/oxidebackingstore.cpp +++ b/shared/qpa/oxidebackingstore.cpp @@ -13,10 +13,9 @@ QT_BEGIN_NAMESPACE OxideBackingStore::OxideBackingStore(QWindow* window) -: QPlatformBackingStore(window), - mDebug(OxideIntegration::instance()->options() & OxideIntegration::DebugQPA) +: QPlatformBackingStore(window) { - if(mDebug){ + if(OxideIntegration::instance()->options() & OxideIntegration::DebugQPA){ qDebug() << "OxideBackingStore::OxideBackingStore:" << (quintptr)this; } if(window != nullptr && window->handle()){ @@ -36,7 +35,7 @@ void OxideBackingStore::flush(QWindow* window, const QRegion& region, const QPoi if(mBuffer == nullptr || region.isEmpty()){ return; } - if(mDebug){ + if(OxideIntegration::instance()->options() & OxideIntegration::DebugQPA){ qDebug() << "OxideBackingStore::repaint:" << mBuffer->surface << offset << region; } bool ok; @@ -61,7 +60,7 @@ void OxideBackingStore::resize(const QSize& size, const QRegion& region){ if(image.size() == size){ return; } - if(mDebug){ + if(OxideIntegration::instance()->options() & OxideIntegration::DebugQPA){ qDebug() << "OxideBackingStore::resize:" << (mBuffer == nullptr ? 0 : mBuffer->surface) << size << region; } bool ok; @@ -127,7 +126,7 @@ bool OxideBackingStore::scroll(const QRegion& area, int dx, int dy){ Q_UNUSED(area) Q_UNUSED(dx) Q_UNUSED(dy) - if(mDebug){ + if(OxideIntegration::instance()->options() & OxideIntegration::DebugQPA){ qDebug() << "OxideBackingStore::scroll"; } return false; diff --git a/shared/qpa/oxidebackingstore.h b/shared/qpa/oxidebackingstore.h index 4da034a57..098d1a2a2 100644 --- a/shared/qpa/oxidebackingstore.h +++ b/shared/qpa/oxidebackingstore.h @@ -24,7 +24,6 @@ class OxideBackingStore : public QPlatformBackingStore private: QImage image; - const bool mDebug; Blight::shared_buf_t mBuffer = nullptr; }; diff --git a/shared/qpa/oxideintegration.cpp b/shared/qpa/oxideintegration.cpp index 5c6aac793..37b0b1b21 100644 --- a/shared/qpa/oxideintegration.cpp +++ b/shared/qpa/oxideintegration.cpp @@ -42,6 +42,12 @@ static inline unsigned short parseOptions(const QStringList& paramList){ options |= OxideIntegration::FontconfigDatabase; } } + if( + qEnvironmentVariableIsSet(debugQPAEnvironmentVariable) + && qEnvironmentVariableIntValue(debugQPAEnvironmentVariable) > 0 + ){ + options |= OxideIntegration::DebugQPA | OxideIntegration::EnableFonts; + } QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(true); return options; } @@ -52,16 +58,10 @@ OxideIntegration::OxideIntegration(const QStringList& parameters) m_debug(false), m_parameters(parameters) { + m_debug = m_options & DebugQPA; if(m_debug){ qDebug() << "OxideIntegration::OxideIntegration"; } - if( - qEnvironmentVariableIsSet(debugQPAEnvironmentVariable) - && qEnvironmentVariableIntValue(debugQPAEnvironmentVariable) > 0 - ){ - m_options |= DebugQPA | EnableFonts; - m_debug = true; - } } OxideIntegration::~OxideIntegration(){ diff --git a/shared/qpa/oxideintegration.h b/shared/qpa/oxideintegration.h index 8ef5de4bd..78f42241b 100644 --- a/shared/qpa/oxideintegration.h +++ b/shared/qpa/oxideintegration.h @@ -22,12 +22,13 @@ class Q_DECL_EXPORT OxideIntegration #endif { public: - enum Options: unsigned short{ // Options to be passed on command line or determined from environment + enum Option: unsigned short{ // Options to be passed on command line or determined from environment DebugQPA = 0x1, EnableFonts = 0x2, FreeTypeFontDatabase = 0x4, FontconfigDatabase = 0x8 }; + Q_DECLARE_FLAGS(Options, Option) explicit OxideIntegration(const QStringList ¶meters); ~OxideIntegration();