Fix quick initialization failure
| | |
| | | m_windowAttributes.insert(it.key(), it.value()); |
| | | } |
| | | } |
| | | |
| | | // Send to shared dispatchers |
| | | if (oldWinId != m_windowId) { |
| | | QEvent e(QEvent::WinIdChange); |
| | | sharedDispatch(m_host, &e); |
| | | } |
| | | } |
| | | |
| | | QVariant AbstractWindowContext::windowAttribute(const QString &key) const { |
| | |
| | | |
| | | inline QObject *host() const; |
| | | inline QWindow *window() const; |
| | | inline WId windowId() const; |
| | | inline WindowItemDelegate *delegate() const; |
| | | |
| | | inline bool isHitTestVisible(const QObject *obj) const; |
| | |
| | | return m_windowHandle; |
| | | } |
| | | |
| | | inline WId AbstractWindowContext::windowId() const { |
| | | return m_windowId; |
| | | } |
| | | |
| | | inline WindowItemDelegate *AbstractWindowContext::delegate() const { |
| | | return m_delegate.get(); |
| | | } |
| | |
| | | |
| | | namespace QWK { |
| | | |
| | | WindowWinIdChangeEventFilter::WindowWinIdChangeEventFilter(QWindow *host, |
| | | AbstractWindowContext *context) |
| | | : WinIdChangeEventFilter(host, context), win(host), isAboutToBeDestroyed(false) { |
| | | host->installEventFilter(this); |
| | | } |
| | | |
| | | WId WindowWinIdChangeEventFilter::winId() const { |
| | | auto win = static_cast<QWindow *>(host); |
| | | if (isAboutToBeDestroyed) |
| | |
| | | |
| | | class QWK_CORE_EXPORT WindowWinIdChangeEventFilter : public WinIdChangeEventFilter { |
| | | public: |
| | | WindowWinIdChangeEventFilter(QObject *host, AbstractWindowContext *context) |
| | | : WinIdChangeEventFilter(host, context), win(static_cast<QWindow *>(host)), |
| | | isAboutToBeDestroyed(false) { |
| | | } |
| | | WindowWinIdChangeEventFilter(QWindow *host, AbstractWindowContext *context); |
| | | |
| | | WId winId() const override; |
| | | |
| | |
| | | WinIdChangeEventFilter * |
| | | WindowItemDelegate::createWinIdEventFilter(QObject *host, |
| | | AbstractWindowContext *context) const { |
| | | return new WindowWinIdChangeEventFilter(host, context); |
| | | return new WindowWinIdChangeEventFilter(static_cast<QWindow *>(host), context); |
| | | } |
| | | |
| | | } |
| | |
| | | anchors->setLeft(parentPri->left()); |
| | | anchors->setRight(parentPri->right()); |
| | | |
| | | setZ(std::numeric_limits<qreal>::max()); // Make sure our fake border always above everything in the window. |
| | | setZ(std::numeric_limits<qreal>::max()); // Make sure our fake border always above |
| | | // everything in the window. |
| | | |
| | | context->installNativeEventFilter(this); |
| | | context->installSharedEventFilter(this); |
| | |
| | | |
| | | bool BorderItem::sharedEventFilter(QObject *obj, QEvent *event) { |
| | | Q_UNUSED(obj) |
| | | |
| | | |
| | | switch (event->type()) { |
| | | case QEvent::WinIdChange: { |
| | | if (auto winId = context->windowId()) { |
| | | updateGeometry(); |
| | | } |
| | | break; |
| | | } |
| | | case QEvent::WindowStateChange: { |
| | | updateGeometry(); |
| | | break; |
| | |
| | | Q_UNUSED(obj) |
| | | |
| | | auto window = widget->windowHandle(); |
| | | switch (event->type()) { |
| | | case QEvent::Expose: { |
| | | // Qt will absolutely send a QExposeEvent or QResizeEvent to the QWindow when it |
| | | // receives a WM_PAINT message. When the control flow enters the expose handler, |
| | | // Qt must have already called BeginPaint() and it's the best time for us to |
| | | // draw the top border. |
| | | |
| | | // Qt will absolutely send a QExposeEvent or QResizeEvent to the QWindow when it |
| | | // receives a WM_PAINT message. When the control flow enters the expose handler, Qt |
| | | // must have already called BeginPaint() and it's the best time for us to draw the |
| | | // top border. |
| | | |
| | | // Since a QExposeEvent will be sent immediately after the QResizeEvent, we can simply |
| | | // ignore it. |
| | | if (event->type() == QEvent::Expose) { |
| | | auto ee = static_cast<QExposeEvent *>(event); |
| | | if (window->isExposed() && isNormalWindow() && !ee->region().isNull()) { |
| | | resumeWindowEventAndDraw(window, event); |
| | | return true; |
| | | // Since a QExposeEvent will be sent immediately after the QResizeEvent, we can |
| | | // simply ignore it. |
| | | auto ee = static_cast<QExposeEvent *>(event); |
| | | if (window->isExposed() && isNormalWindow() && !ee->region().isNull()) { |
| | | resumeWindowEventAndDraw(window, event); |
| | | return true; |
| | | } |
| | | break; |
| | | } |
| | | case QEvent::WinIdChange: { |
| | | if (auto winId = ctx->windowId()) { |
| | | updateGeometry(); |
| | | } |
| | | break; |
| | | } |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |