Merge branch 'Plasma/5.18'

This commit is contained in:
Vlad Zahorodnii 2020-01-28 18:42:35 +02:00
commit a073a79a97
7 changed files with 24 additions and 8 deletions

View file

@ -67,6 +67,7 @@ DecoratedClientImpl::DecoratedClientImpl(AbstractClient *client, KDecoration2::D
if (oldSize.height() != m_clientSize.height()) {
emit decoratedClient->heightChanged(m_clientSize.height());
}
emit decoratedClient->sizeChanged(m_clientSize);
}
);
connect(client, &AbstractClient::desktopChanged, this,
@ -273,6 +274,11 @@ int DecoratedClientImpl::height() const
return m_clientSize.height();
}
QSize DecoratedClientImpl::size() const
{
return m_clientSize;
}
bool DecoratedClientImpl::isMaximizedVertically() const
{
return m_client->requestedMaximizeMode() & MaximizeVertical;

View file

@ -66,6 +66,7 @@ public:
QPalette palette() const override;
QColor color(KDecoration2::ColorGroup group, KDecoration2::ColorRole role) const override;
bool providesContextHelp() const override;
QSize size() const override;
int width() const override;
WId windowId() const override;

View file

@ -40,12 +40,12 @@ Renderer::Renderer(DecoratedClientImpl *client)
, m_imageSizesDirty(true)
{
auto markImageSizesDirty = [this]{
schedule(m_client->client()->rect());
m_imageSizesDirty = true;
};
connect(client->client(), &AbstractClient::screenScaleChanged, this, markImageSizesDirty);
connect(client->decoration(), &KDecoration2::Decoration::bordersChanged, this, markImageSizesDirty);
connect(client->decoratedClient(), &KDecoration2::DecoratedClient::widthChanged, this, markImageSizesDirty);
connect(client->decoratedClient(), &KDecoration2::DecoratedClient::heightChanged, this, markImageSizesDirty);
connect(client->decoratedClient(), &KDecoration2::DecoratedClient::sizeChanged, this, markImageSizesDirty);
}
Renderer::~Renderer() = default;

View file

@ -111,6 +111,11 @@ PreviewClient::PreviewClient(DecoratedClient *c, Decoration *decoration)
connect(this, &PreviewClient::bordersLeftEdgeChanged, this, emitEdgesChanged);
connect(this, &PreviewClient::bordersRightEdgeChanged, this, emitEdgesChanged);
connect(this, &PreviewClient::bordersBottomEdgeChanged, this, emitEdgesChanged);
auto emitSizeChanged = [this, c]() {
emit c->sizeChanged(c->size());
};
connect(this, &PreviewClient::widthChanged, this, emitSizeChanged);
connect(this, &PreviewClient::heightChanged, this, emitSizeChanged);
qApp->installEventFilter(this);
}
@ -133,6 +138,11 @@ int PreviewClient::height() const
return m_height;
}
QSize PreviewClient::size() const
{
return QSize(m_width, m_height);
}
QString PreviewClient::caption() const
{
return m_caption;

View file

@ -90,6 +90,7 @@ public:
int width() const override;
int height() const override;
QSize size() const override;
QPalette palette() const override;
QColor color(ColorGroup group, ColorRole role) const override;
Qt::Edges adjacentScreenEdges() const override;

View file

@ -2562,11 +2562,10 @@ static void clamp(QImage &image, const QRect &viewport)
void SceneOpenGLDecorationRenderer::render()
{
const QRegion scheduled = getScheduled();
const bool dirty = areImageSizesDirty();
if (scheduled.isEmpty() && !dirty) {
if (scheduled.isEmpty()) {
return;
}
if (dirty) {
if (areImageSizesDirty()) {
resizeTexture();
resetImageSizesDirty();
}
@ -2579,8 +2578,6 @@ void SceneOpenGLDecorationRenderer::render()
QRect left, top, right, bottom;
client()->client()->layoutDecorationRects(left, top, right, bottom);
const QRect geometry = dirty ? QRect(QPoint(0, 0), client()->client()->size()) : scheduled.boundingRect();
// We pad each part in the decoration atlas in order to avoid texture bleeding.
const int padding = 1;
@ -2634,6 +2631,8 @@ void SceneOpenGLDecorationRenderer::render()
m_texture->update(image, (position + dirtyOffset - viewport.topLeft()) * image.devicePixelRatio());
};
const QRect geometry = scheduled.boundingRect();
const QPoint topPosition(padding, padding);
const QPoint bottomPosition(padding, topPosition.y() + top.height() + 2 * padding);
const QPoint leftPosition(padding, bottomPosition.y() + bottom.height() + 2 * padding);

View file

@ -1229,7 +1229,6 @@ void SceneXRenderDecorationRenderer::render()
if (areImageSizesDirty()) {
resizePixmaps();
resetImageSizesDirty();
scheduled = client()->client()->decorationRect();
}
const QRect top(QPoint(0, 0), m_sizes[int(DecorationPart::Top)]);