Sine Striker
2023-12-13 bbd0f1932fcf7a730d8ab9410e158f2b1035bc23
Add cocoa
2个文件已修改
2个文件已添加
70 ■■■■ 已修改文件
src/core/CMakeLists.txt 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/cocoawindowcontext.mm 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/cocoawindowcontext_p.h 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/windowagentbase.cpp 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/CMakeLists.txt
@@ -27,6 +27,11 @@
        qwindowkit_windows.h
        qwindowkit_windows.cpp
    )
elseif(NOT APPLE)
    list(APPEND _src
        qwindowkit_linux.h
    )
endif()
    if(QWINDOWKIT_FORCE_QT_WINDOW_CONTEXT)
        list(APPEND _src
@@ -35,22 +40,20 @@
        )
        list(APPEND _defines_private QWINDOWKIT_FORCE_QT_WINDOW_CONTEXT)
    else()
    if(WIN32)
        list(APPEND _src
            contexts/win32windowcontext_p.h
            contexts/win32windowcontext.cpp
        )
    endif()
    elseif(APPLE)
        list(APPEND _src
            contexts/cocoawindowcontext_p.h
            contexts/cocoawindowcontext.cpp
        )
else()
    list(APPEND _src
        contexts/qtwindowcontext_p.h
        contexts/qtwindowcontext.cpp
    )
    if(APPLE)
    # add files
    else()
        list(APPEND _src
            qwindowkit_linux.h
        )
    endif()
endif()
src/core/contexts/cocoawindowcontext.mm
New file
@@ -0,0 +1,22 @@
#include "cocoawindowcontext_p.h"
namespace QWK {
    CocoaWindowContext::CocoaWindowContext() {
    }
    CocoaWindowContext::~CocoaWindowContext() {
    }
    QString CocoaWindowContext::key() const {
        return "cocoa";
    }
    void CocoaWindowContext::virtual_hook(int id, void *data) {
    }
    bool CocoaWindowContext::setupHost() {
        return false;
    }
}
src/core/contexts/cocoawindowcontext_p.h
New file
@@ -0,0 +1,24 @@
#ifndef COCOAWINDOWCONTEXT_P_H
#define COCOAWINDOWCONTEXT_P_H
#include <QWKCore/private/abstractwindowcontext_p.h>
namespace QWK {
    class CocoaWindowContext : public AbstractWindowContext {
        Q_OBJECT
    public:
        CocoaWindowContext();
        ~CocoaWindowContext() override;
        QString key() const override;
        void virtual_hook(int id, void *data) override;
    protected:
        bool setupHost() override;
    };
}
#endif // COCOAWINDOWCONTEXT_P_H
src/core/windowagentbase.cpp
@@ -5,6 +5,8 @@
#if defined(Q_OS_WINDOWS) && !defined(QWINDOWKIT_FORCE_QT_WINDOW_CONTEXT)
#  include "win32windowcontext_p.h"
#elif defined(Q_OS_MAC) && !defined(QWINDOWKIT_FORCE_QT_WINDOW_CONTEXT)
#  include "cocoawindowcontext_p.h"
#else
#  include "qtwindowcontext_p.h"
#endif
@@ -28,8 +30,11 @@
        if (windowContextFactoryMethod) {
            return windowContextFactoryMethod();
        }
#if defined(Q_OS_WINDOWS) && !defined(QWINDOWKIT_FORCE_QT_WINDOW_CONTEXT)
        return new Win32WindowContext();
#elif defined(Q_OS_MAC) && !defined(QWINDOWKIT_FORCE_QT_WINDOW_CONTEXT)
        return new CocoaWindowContext();
#else
        return new QtWindowContext();
#endif