From a186e407bf002acb901863618fac2167f24aa7bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 15 Oct 2015 12:50:28 +0200 Subject: [PATCH] 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(). --- abstract_client.cpp | 8 ++++++++ abstract_client.h | 7 +++++++ client.h | 1 - geometry.cpp | 15 +++------------ 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/abstract_client.cpp b/abstract_client.cpp index d34cab04d2..45158f0dae 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -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; +} + } diff --git a/abstract_client.h b/abstract_client.h index fcbbbf536b..ccc6722020 100644 --- a/abstract_client.h +++ b/abstract_client.h @@ -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; }; /** diff --git a/client.h b/client.h index 878c295b64..d7be3182b0 100644 --- a/client.h +++ b/client.h @@ -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; diff --git a/geometry.cpp b/geometry.cpp index 71dcb314e7..739d6c5f70 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -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())