Move handling around deco_rect_before_block to AbstractClient

The usage was always to trigger repaints on the old and the new
visibleRect. And store the new visibleRect as the future old one.

This is now encapsulated in a dedicated method called
addRepaintDuringGeometryUpdates().
This commit is contained in:
Martin Gräßlin 2015-10-15 12:50:28 +02:00
parent 0c159e0106
commit a186e407bf
4 changed files with 18 additions and 13 deletions

View file

@ -1038,4 +1038,12 @@ bool AbstractClient::isDecorated() const
return false;
}
void AbstractClient::addRepaintDuringGeometryUpdates()
{
const QRect deco_rect = visibleRect();
addLayerRepaint(m_visibleRectBeforeGeometryUpdate);
addLayerRepaint(deco_rect); // trigger repaint of window's new location
m_visibleRectBeforeGeometryUpdate = deco_rect;
}
}

View file

@ -577,6 +577,12 @@ protected:
};
PendingGeometry_t pendingGeometryUpdate() const;
void setPendingGeometryUpdate(PendingGeometry_t update);
/**
* Schedules a repaint for the visibleRect before and after a
* geometry update. The current visibleRect is stored for the
* next time this method is called as the before geometry.
**/
void addRepaintDuringGeometryUpdates();
private:
void handlePaletteChange();
@ -621,6 +627,7 @@ private:
int m_blockGeometryUpdates = 0; // > 0 = New geometry is remembered, but not actually set
PendingGeometry_t m_pendingGeometryUpdate = PendingGeometryNone;
friend class GeometryUpdatesBlocker;
QRect m_visibleRectBeforeGeometryUpdate;
};
/**

View file

@ -699,7 +699,6 @@ private:
NET::Actions allowed_actions;
QSize client_size;
QRect geom_before_block;
QRect deco_rect_before_block;
bool shade_geometry_change;
struct {
xcb_sync_counter_t counter;

View file

@ -1969,11 +1969,8 @@ void Client::setGeometry(int x, int y, int w, int h, ForceGeometry_t force)
discardWindowPixmap();
emit geometryShapeChanged(this, geom_before_block);
}
const QRect deco_rect = visibleRect();
addLayerRepaint(deco_rect_before_block);
addLayerRepaint(deco_rect);
addRepaintDuringGeometryUpdates();
geom_before_block = geom;
deco_rect_before_block = deco_rect;
// Update states of all other windows in this group
if (tabGroup())
@ -2034,11 +2031,8 @@ void Client::plainResize(int w, int h, ForceGeometry_t force)
if (oldClientSize != QSize(w,h))
discardWindowPixmap();
emit geometryShapeChanged(this, geom_before_block);
const QRect deco_rect = visibleRect();
addLayerRepaint(deco_rect_before_block);
addLayerRepaint(deco_rect);
addRepaintDuringGeometryUpdates();
geom_before_block = geom;
deco_rect_before_block = deco_rect;
// Update states of all other windows in this group
if (tabGroup())
@ -2080,11 +2074,8 @@ void Client::move(int x, int y, ForceGeometry_t force)
Compositor::self()->checkUnredirect();
}
// client itself is not damaged
const QRect deco_rect = visibleRect();
addLayerRepaint(deco_rect_before_block);
addLayerRepaint(deco_rect); // trigger repaint of window's new location
addRepaintDuringGeometryUpdates();
geom_before_block = geom;
deco_rect_before_block = deco_rect;
// Update states of all other windows in this group
if (tabGroup())