Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: Ib137a0ec79dd9f0bbbbe24daafef881a096b2c47
This commit is contained in:
commit
315e731aae
@ -132,6 +132,7 @@ QMargins QWaylandBradientDecoration::margins() const
|
||||
|
||||
void QWaylandBradientDecoration::paint(QPaintDevice *device)
|
||||
{
|
||||
bool active = window()->handle()->isActive();
|
||||
QRect surfaceRect(QPoint(), window()->frameGeometry().size());
|
||||
QRect clips[] =
|
||||
{
|
||||
@ -183,7 +184,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device)
|
||||
|
||||
p.save();
|
||||
p.setClipRect(titleBar);
|
||||
p.setPen(window()->isActive() ? m_foregroundColor : m_foregroundInactiveColor);
|
||||
p.setPen(active ? m_foregroundColor : m_foregroundInactiveColor);
|
||||
QSizeF size = m_windowTitle.size();
|
||||
int dx = (top.width() - size.width()) /2;
|
||||
int dy = (top.height()- size.height()) /2;
|
||||
@ -199,7 +200,7 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device)
|
||||
QRectF rect;
|
||||
|
||||
// Default pen
|
||||
QPen pen(window()->isActive() ? m_foregroundColor : m_foregroundInactiveColor);
|
||||
QPen pen(active ? m_foregroundColor : m_foregroundInactiveColor);
|
||||
p.setPen(pen);
|
||||
|
||||
// Close button
|
||||
|
@ -413,6 +413,11 @@ void QWaylandDisplay::setLastInputDevice(QWaylandInputDevice *device, uint32_t s
|
||||
mLastInputWindow = win;
|
||||
}
|
||||
|
||||
bool QWaylandDisplay::isWindowActivated(const QWaylandWindow *window)
|
||||
{
|
||||
return mActiveWindows.contains(const_cast<QWaylandWindow *>(window));
|
||||
}
|
||||
|
||||
void QWaylandDisplay::handleWindowActivated(QWaylandWindow *window)
|
||||
{
|
||||
if (mActiveWindows.contains(window))
|
||||
|
@ -176,6 +176,7 @@ public:
|
||||
QWaylandWindow *lastInputWindow() const;
|
||||
void setLastInputDevice(QWaylandInputDevice *device, uint32_t serial, QWaylandWindow *window);
|
||||
|
||||
bool isWindowActivated(const QWaylandWindow *window);
|
||||
void handleWindowActivated(QWaylandWindow *window);
|
||||
void handleWindowDeactivated(QWaylandWindow *window);
|
||||
void handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice);
|
||||
|
@ -943,6 +943,11 @@ bool QWaylandWindow::isExposed() const
|
||||
return QPlatformWindow::isExposed();
|
||||
}
|
||||
|
||||
bool QWaylandWindow::isActive() const
|
||||
{
|
||||
return mDisplay->isWindowActivated(this);
|
||||
}
|
||||
|
||||
int QWaylandWindow::scale() const
|
||||
{
|
||||
return mScale;
|
||||
|
@ -146,6 +146,7 @@ public:
|
||||
|
||||
void requestActivateWindow() override;
|
||||
bool isExposed() const override;
|
||||
bool isActive() const override;
|
||||
void unfocus();
|
||||
|
||||
QWaylandAbstractDecoration *decoration() const;
|
||||
|
@ -806,6 +806,8 @@ bool Scanner::process()
|
||||
|
||||
printf(" %s::Resource *%s::Resource::fromResource(struct ::wl_resource *resource)\n", interfaceName, interfaceName);
|
||||
printf(" {\n");
|
||||
printf(" if (Q_UNLIKELY(!resource))\n");
|
||||
printf(" return nullptr;\n");
|
||||
printf(" if (wl_resource_instance_of(resource, &::%s_interface, %s))\n", interfaceName, interfaceMember.constData());
|
||||
printf(" return static_cast<Resource *>(resource->data);\n");
|
||||
printf(" return nullptr;\n");
|
||||
|
@ -107,7 +107,9 @@ bool Surface::isMapped() const
|
||||
|
||||
Surface *Surface::fromResource(struct ::wl_resource *resource)
|
||||
{
|
||||
return static_cast<Surface *>(Resource::fromResource(resource)->surface_object);
|
||||
if (auto *r = Resource::fromResource(resource))
|
||||
return static_cast<Surface *>(r->surface_object);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Surface::surface_destroy_resource(Resource *)
|
||||
|
Loading…
x
Reference in New Issue
Block a user