Yuhang Zhao
2023-12-06 0287f19b3eabf6b6632d51c0288e6cf0be2c5e69
src/core/corewindowagent.cpp
@@ -13,32 +13,33 @@
namespace QWK {
    CoreWindowAgentPrivate::CoreWindowAgentPrivate() : q_ptr(nullptr), eventHandler(nullptr) {
    CoreWindowAgentPrivate::CoreWindowAgentPrivate() : q_ptr(nullptr), context(nullptr) {
    }
    CoreWindowAgentPrivate::~CoreWindowAgentPrivate() = default;
    CoreWindowAgentPrivate::~CoreWindowAgentPrivate() {
        if (context) {
            delete context;
            context = nullptr;
        }
    }
    void CoreWindowAgentPrivate::init() {
    }
    bool CoreWindowAgentPrivate::setup(QWindow *window, WindowItemDelegate *delegate) {
        Q_ASSERT(window);
        if (!window) {
            return false;
        }
        auto handler =
    bool CoreWindowAgentPrivate::setup(const QObject *host, const WindowItemDelegate *delegate) {
        auto ctx =
#ifdef Q_OS_WINDOWS
            new Win32WindowContext(window, delegate)
            new Win32WindowContext(host, delegate)
#else
            new QtWindowContext(window, delegate)
            new QtWindowContext(host, window, delegate)
#endif
            ;
        if (!handler->setup()) {
            delete handler;
        if (!ctx->setup()) {
            delete ctx;
            ctx = nullptr;
            return false;
        }
        eventHandler.reset(handler);
        context = ctx;
        return true;
    }
@@ -46,12 +47,12 @@
    void CoreWindowAgent::showSystemMenu(const QPoint &pos) {
        Q_D(CoreWindowAgent);
        d->eventHandler->showSystemMenu(pos);
        d->context->showSystemMenu(pos);
    }
    void CoreWindowAgent::startSystemMove(const QPoint &pos) {
        Q_D(CoreWindowAgent);
        auto win = d->eventHandler->window();
        auto win = d->context->window();
        if (!win) {
            return;
        }
@@ -62,7 +63,7 @@
    void CoreWindowAgent::startSystemResize(Qt::Edges edges, const QPoint &pos) {
        Q_D(CoreWindowAgent);
        auto win = d->eventHandler->window();
        auto win = d->context->window();
        if (!win) {
            return;
        }