| | |
| | | #include "corewindowagent.h" |
| | | #include "corewindowagent_p.h" |
| | | |
| | | #include "qwkcoreglobal_p.h" |
| | | |
| | | #ifdef Q_OS_WINDOWS |
| | | # include "handler/win32windowcontext_p.h" |
| | | # include "win32windowcontext_p.h" |
| | | #else |
| | | # include "handler/qtwindowcontext_p.h" |
| | | # include "qtwindowcontext_p.h" |
| | | #endif |
| | | |
| | | Q_LOGGING_CATEGORY(qWindowKitLog, "qwindowkit") |
| | | |
| | | namespace QWK { |
| | | |
| | | CoreWindowAgentPrivate::CoreWindowAgentPrivate() { |
| | | CoreWindowAgentPrivate::CoreWindowAgentPrivate() : q_ptr(nullptr), context(nullptr) { |
| | | } |
| | | |
| | | CoreWindowAgentPrivate::~CoreWindowAgentPrivate() { |
| | | if (context) { |
| | | delete context; |
| | | context = nullptr; |
| | | } |
| | | } |
| | | |
| | | void CoreWindowAgentPrivate::init() { |
| | | } |
| | | |
| | | void CoreWindowAgentPrivate::setup(QWindow *window, WindowItemDelegate *delegate) { |
| | | bool CoreWindowAgentPrivate::setup(const QObject *host, const WindowItemDelegate *delegate) { |
| | | auto ctx = |
| | | #ifdef Q_OS_WINDOWS |
| | | m_eventHandler = new Win32WindowContext(window, delegate); |
| | | new Win32WindowContext(host, delegate) |
| | | #else |
| | | m_eventHandler = new QtWindowContext(window, delegate); |
| | | new QtWindowContext(host, window, delegate) |
| | | #endif |
| | | ; |
| | | if (!ctx->setup()) { |
| | | delete ctx; |
| | | ctx = nullptr; |
| | | return false; |
| | | } |
| | | context = ctx; |
| | | return true; |
| | | } |
| | | |
| | | CoreWindowAgent::~CoreWindowAgent() { |
| | | } |
| | | CoreWindowAgent::~CoreWindowAgent() = default; |
| | | |
| | | void CoreWindowAgent::showSystemMenu(const QPoint &pos) { |
| | | Q_D(CoreWindowAgent); |
| | | d->m_eventHandler->showSystemMenu(pos); |
| | | d->context->showSystemMenu(pos); |
| | | } |
| | | |
| | | void CoreWindowAgent::startSystemMove(const QPoint &pos) { |
| | | Q_D(CoreWindowAgent); |
| | | auto win = d->m_eventHandler->window(); |
| | | auto win = d->context->window(); |
| | | if (!win) { |
| | | return; |
| | | } |
| | |
| | | |
| | | void CoreWindowAgent::startSystemResize(Qt::Edges edges, const QPoint &pos) { |
| | | Q_D(CoreWindowAgent); |
| | | auto win = d->m_eventHandler->window(); |
| | | auto win = d->context->window(); |
| | | if (!win) { |
| | | return; |
| | | } |