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