Commit 8570b643 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Rename visibleRect to visibleGeometry

"rect"s have their origin at the top-left corner of the frame. However,
visibleRect() returns a QRect that's in the global coordinates.
parent 311a370d
......@@ -88,7 +88,7 @@ AbstractClient::AbstractClient()
);
connect(this, &AbstractClient::paddingChanged, this, [this]() {
m_visibleRectBeforeGeometryUpdate = visibleRect();
m_visibleRectBeforeGeometryUpdate = visibleGeometry();
});
connect(ApplicationMenu::self(), &ApplicationMenu::applicationMenuEnabledChanged, this, [this] {
......@@ -236,7 +236,7 @@ void AbstractClient::markAsZombie()
{
Q_ASSERT(!m_zombie);
m_zombie = true;
addWorkspaceRepaint(visibleRect());
addWorkspaceRepaint(visibleGeometry());
}
Layer AbstractClient::layer() const
......@@ -709,7 +709,7 @@ void AbstractClient::minimize(bool avoid_animation)
}
// TODO: merge signal with s_minimized
addWorkspaceRepaint(visibleRect());
addWorkspaceRepaint(visibleGeometry());
emit clientMinimized(this, !avoid_animation);
emit minimizedChanged();
}
......@@ -2026,7 +2026,7 @@ BORDER(Top)
void AbstractClient::addRepaintDuringGeometryUpdates()
{
const QRect deco_rect = visibleRect();
const QRect deco_rect = visibleGeometry();
addLayerRepaint(m_visibleRectBeforeGeometryUpdate);
addLayerRepaint(deco_rect); // trigger repaint of window's new location
m_visibleRectBeforeGeometryUpdate = deco_rect;
......
......@@ -1811,7 +1811,7 @@ TOPLEVEL_HELPER(int, screen, screen)
TOPLEVEL_HELPER(QRect, geometry, frameGeometry)
TOPLEVEL_HELPER(QRect, frameGeometry, frameGeometry)
TOPLEVEL_HELPER(QRect, bufferGeometry, bufferGeometry)
TOPLEVEL_HELPER(QRect, expandedGeometry, visibleRect)
TOPLEVEL_HELPER(QRect, expandedGeometry, visibleGeometry)
TOPLEVEL_HELPER(QRect, rect, rect)
TOPLEVEL_HELPER(int, desktop, desktop)
TOPLEVEL_HELPER(bool, isDesktop, isDesktop)
......
......@@ -1370,7 +1370,7 @@ void Unmanaged::configureNotifyEvent(xcb_configure_notify_event_t *e)
static_cast<EffectsHandlerImpl*>(effects)->checkInputWindowStacking(); // keep them on top
QRect newgeom(e->x, e->y, e->width, e->height);
if (newgeom != m_frameGeometry) {
addWorkspaceRepaint(visibleRect()); // damage old area
addWorkspaceRepaint(visibleGeometry()); // damage old area
QRect old = m_frameGeometry;
m_clientGeometry = newgeom;
m_frameGeometry = newgeom;
......
......@@ -493,7 +493,7 @@ void InternalClient::commitGeometry(const QRect &rect)
m_clientGeometry = frameRectToClientRect(rect);
m_frameGeometry = rect;
addWorkspaceRepaint(visibleRect());
addWorkspaceRepaint(visibleGeometry());
updateGeometryBeforeUpdateBlocking();
syncGeometryToInternalWindow();
......
......@@ -198,7 +198,7 @@ void SceneQPainter::Window::performPaint(int mask, const QRegion &_region, const
{
QRegion region = _region;
if (!(mask & (PAINT_WINDOW_TRANSFORMED | PAINT_SCREEN_TRANSFORMED)))
region &= toplevel->visibleRect();
region &= toplevel->visibleGeometry();
if (region.isEmpty())
return;
......@@ -225,11 +225,11 @@ void SceneQPainter::Window::performPaint(int mask, const QRegion &_region, const
QPainter tempPainter;
if (!opaque) {
// need a temp render target which we later on blit to the screen
tempImage = QImage(toplevel->visibleRect().size(), QImage::Format_ARGB32_Premultiplied);
tempImage = QImage(toplevel->visibleGeometry().size(), QImage::Format_ARGB32_Premultiplied);
tempImage.fill(Qt::transparent);
tempPainter.begin(&tempImage);
tempPainter.save();
tempPainter.translate(toplevel->frameGeometry().topLeft() - toplevel->visibleRect().topLeft());
tempPainter.translate(toplevel->frameGeometry().topLeft() - toplevel->visibleGeometry().topLeft());
painter = &tempPainter;
}
renderShadow(painter);
......@@ -241,10 +241,10 @@ void SceneQPainter::Window::performPaint(int mask, const QRegion &_region, const
tempPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
QColor translucent(Qt::transparent);
translucent.setAlphaF(data.opacity());
tempPainter.fillRect(QRect(QPoint(0, 0), toplevel->visibleRect().size()), translucent);
tempPainter.fillRect(QRect(QPoint(0, 0), toplevel->visibleGeometry().size()), translucent);
tempPainter.end();
painter = scenePainter;
painter->drawImage(toplevel->visibleRect().topLeft() - toplevel->frameGeometry().topLeft(), tempImage);
painter->drawImage(toplevel->visibleGeometry().topLeft() - toplevel->frameGeometry().topLeft(), tempImage);
}
painter->restore();
......
......@@ -227,7 +227,7 @@ QRegion SceneXrender::Window::bufferToWindowRegion(const QRegion &region) const
void SceneXrender::Window::prepareTempPixmap()
{
const QSize oldSize = temp_visibleRect.size();
temp_visibleRect = toplevel->visibleRect().translated(-toplevel->pos());
temp_visibleRect = toplevel->visibleGeometry().translated(-toplevel->pos());
if (s_tempPicture && (oldSize.width() < temp_visibleRect.width() || oldSize.height() < temp_visibleRect.height())) {
delete s_tempPicture;
s_tempPicture = nullptr;
......@@ -261,7 +261,7 @@ void SceneXrender::Window::performPaint(int mask, const QRegion &_region, const
}*/
// Intersect the clip region with the rectangle the window occupies on the screen
if (!(mask & (PAINT_WINDOW_TRANSFORMED | PAINT_SCREEN_TRANSFORMED)))
region &= toplevel->visibleRect();
region &= toplevel->visibleGeometry();
if (region.isEmpty())
return;
......@@ -367,7 +367,7 @@ void SceneXrender::Window::performPaint(int mask, const QRegion &_region, const
xcb_render_picture_t renderTarget = m_scene->xrenderBufferPicture();
if (blitInTempPixmap) {
if (scene_xRenderOffscreenTarget()) {
temp_visibleRect = toplevel->visibleRect().translated(-toplevel->pos());
temp_visibleRect = toplevel->visibleGeometry().translated(-toplevel->pos());
renderTarget = *scene_xRenderOffscreenTarget();
} else {
prepareTempPixmap();
......
......@@ -57,7 +57,7 @@ private:
connect(scene, &Scene::frameRendered, this, &WindowStream::bufferToStream);
connect(m_toplevel, &Toplevel::damaged, this, &WindowStream::includeDamage);
m_damagedRegion = m_toplevel->visibleRect();
m_damagedRegion = m_toplevel->visibleGeometry();
m_toplevel->addRepaintFull();
}
......
......@@ -139,7 +139,7 @@ void Toplevel::disownDataPassedToDeleted()
info = nullptr;
}
QRect Toplevel::visibleRect() const
QRect Toplevel::visibleGeometry() const
{
// There's no strict order between frame geometry and buffer geometry.
QRect rect = frameGeometry() | bufferGeometry();
......@@ -451,7 +451,7 @@ void Toplevel::addLayerRepaint(const QRegion &region)
void Toplevel::addRepaintFull()
{
addLayerRepaint(visibleRect());
addLayerRepaint(visibleGeometry());
}
void Toplevel::addWorkspaceRepaint(int x, int y, int w, int h)
......@@ -555,7 +555,7 @@ bool Toplevel::isOnOutput(AbstractOutput *output) const
void Toplevel::updateShadow()
{
QRect dirtyRect; // old & new shadow region
const QRect oldVisibleRect = visibleRect();
const QRect oldVisibleRect = visibleGeometry();
addWorkspaceRepaint(oldVisibleRect);
if (shadow()) {
dirtyRect = shadow()->shadowRegion().boundingRect();
......@@ -568,7 +568,7 @@ void Toplevel::updateShadow()
}
if (shadow())
dirtyRect |= shadow()->shadowRegion().boundingRect();
if (oldVisibleRect != visibleRect())
if (oldVisibleRect != visibleGeometry())
emit paddingChanged(this, oldVisibleRect);
if (dirtyRect.isValid()) {
dirtyRect.translate(pos());
......@@ -642,7 +642,7 @@ void Toplevel::elevate(bool elevate)
return;
}
effectWindow()->elevate(elevate);
addWorkspaceRepaint(visibleRect());
addWorkspaceRepaint(visibleGeometry());
}
pid_t Toplevel::pid() const
......
......@@ -110,7 +110,7 @@ class KWIN_EXPORT Toplevel : public QObject
*/
Q_PROPERTY(int height READ height)
Q_PROPERTY(QRect visibleRect READ visibleRect)
Q_PROPERTY(QRect visibleRect READ visibleGeometry)
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
Q_PROPERTY(int screen READ screen NOTIFY screenChanged)
Q_PROPERTY(qulonglong windowId READ window CONSTANT)
......@@ -374,7 +374,7 @@ public:
/**
* Returns a rectangle that the window occupies on the screen, including drop-shadows.
*/
virtual QRect visibleRect() const;
virtual QRect visibleGeometry() const;
virtual QRect transparentRect() const = 0;
virtual bool isClient() const;
virtual bool isDeleted() const;
......
......@@ -87,7 +87,7 @@ bool Unmanaged::track(xcb_window_t w)
void Unmanaged::release(ReleaseReason releaseReason)
{
addWorkspaceRepaint(visibleRect());
addWorkspaceRepaint(visibleGeometry());
Deleted* del = nullptr;
if (releaseReason != ReleaseReason::KWinShutsDown) {
del = Deleted::create(this);
......
......@@ -325,7 +325,7 @@ void WaylandClient::internalHide()
leaveMoveResize();
}
m_isHidden = true;
addWorkspaceRepaint(visibleRect());
addWorkspaceRepaint(visibleGeometry());
workspace()->clientHidden(this);
emit windowHidden(this);
}
......
......@@ -222,7 +222,7 @@ void X11Client::releaseWindow(bool on_shutdown)
finishWindowRules();
blockGeometryUpdates();
if (isOnCurrentDesktop() && isShown(true))
addWorkspaceRepaint(visibleRect());
addWorkspaceRepaint(visibleGeometry());
// Grab X during the release to make removing of properties, setting to withdrawn state
// and repareting to root an atomic operation (https://lists.kde.org/?l=kde-devel&m=116448102901184&w=2)
grabXServer();
......@@ -292,7 +292,7 @@ void X11Client::destroyClient()
finishWindowRules();
blockGeometryUpdates();
if (isOnCurrentDesktop() && isShown(true))
addWorkspaceRepaint(visibleRect());
addWorkspaceRepaint(visibleGeometry());
setModal(false);
hidden = true; // So that it's not considered visible anymore
workspace()->clientHidden(this);
......@@ -1320,7 +1320,7 @@ void X11Client::updateShape()
updateInputShape();
if (compositing()) {
addRepaintFull();
addWorkspaceRepaint(visibleRect()); // In case shape change removes part of this window
addWorkspaceRepaint(visibleGeometry()); // In case shape change removes part of this window
}
emit geometryShapeChanged(this, frameGeometry());
}
......@@ -1466,7 +1466,7 @@ void X11Client::doSetShade(ShadeMode previousShadeMode)
// TODO: All this unmapping, resizing etc. feels too much duplicated from elsewhere
if (isShade()) {
// shade_mode == ShadeNormal
addWorkspaceRepaint(visibleRect());
addWorkspaceRepaint(visibleGeometry());
// Shade
shade_geometry_change = true;
QSize s(adjustedSize());
......@@ -1610,7 +1610,7 @@ void X11Client::internalHide()
unmap();
if (old == Kept)
updateHiddenPreview();
addWorkspaceRepaint(visibleRect());
addWorkspaceRepaint(visibleGeometry());
workspace()->clientHidden(this);
emit windowHidden(this);
}
......@@ -1628,7 +1628,7 @@ void X11Client::internalKeep()
if (isActive())
workspace()->focusToNull(); // get rid of input focus, bug #317484
updateHiddenPreview();
addWorkspaceRepaint(visibleRect());
addWorkspaceRepaint(visibleGeometry());
workspace()->clientHidden(this);
}
......@@ -1652,7 +1652,7 @@ void X11Client::map()
exportMappingState(XCB_ICCCM_WM_STATE_NORMAL);
} else
exportMappingState(XCB_ICCCM_WM_STATE_ICONIC);
addLayerRepaint(visibleRect());
addLayerRepaint(visibleGeometry());
}
/**
......@@ -2212,7 +2212,7 @@ void X11Client::setClientShown(bool shown)
unmap();
// Don't move tabs to the end of the list when another tab get's activated
FocusChain::self()->update(this, FocusChain::MakeLast);
addWorkspaceRepaint(visibleRect());
addWorkspaceRepaint(visibleGeometry());
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment