Unvirtualize Toplevel::bufferGeometry()
This makes the implementation of the buffer geometry consistent with the frame geometry and the client geometry and removes a virtual method call from a few hot paths.
This commit is contained in:
parent
7c0bb4180a
commit
3c2e1a71c4
13 changed files with 11 additions and 35 deletions
|
@ -71,7 +71,6 @@ void Deleted::copyToDeleted(Toplevel* c)
|
|||
{
|
||||
Q_ASSERT(dynamic_cast< Deleted* >(c) == nullptr);
|
||||
Toplevel::copyToDeleted(c);
|
||||
m_bufferGeometry = c->bufferGeometry();
|
||||
m_frameMargins = c->frameMargins();
|
||||
m_bufferScale = c->bufferScale();
|
||||
desk = c->desktop();
|
||||
|
@ -135,11 +134,6 @@ void Deleted::unrefWindow()
|
|||
deleteLater();
|
||||
}
|
||||
|
||||
QRect Deleted::bufferGeometry() const
|
||||
{
|
||||
return m_bufferGeometry;
|
||||
}
|
||||
|
||||
QMargins Deleted::frameMargins() const
|
||||
{
|
||||
return m_frameMargins;
|
||||
|
|
|
@ -32,7 +32,6 @@ public:
|
|||
void refWindow();
|
||||
void unrefWindow();
|
||||
void discard();
|
||||
QRect bufferGeometry() const override;
|
||||
QMargins frameMargins() const override;
|
||||
qreal bufferScale() const override;
|
||||
int desktop() const override;
|
||||
|
@ -112,7 +111,6 @@ private:
|
|||
void copyToDeleted(Toplevel* c);
|
||||
~Deleted() override; // deleted only using unrefWindow()
|
||||
|
||||
QRect m_bufferGeometry;
|
||||
QMargins m_frameMargins;
|
||||
|
||||
int delete_refcount;
|
||||
|
|
|
@ -1256,6 +1256,7 @@ void Unmanaged::configureNotifyEvent(xcb_configure_notify_event_t *e)
|
|||
QRect old = m_frameGeometry;
|
||||
m_clientGeometry = newgeom;
|
||||
m_frameGeometry = newgeom;
|
||||
m_bufferGeometry = newgeom;
|
||||
emit bufferGeometryChanged(this, old);
|
||||
emit clientGeometryChanged(this, old);
|
||||
emit frameGeometryChanged(this, old);
|
||||
|
|
|
@ -102,11 +102,6 @@ bool InternalClient::eventFilter(QObject *watched, QEvent *event)
|
|||
return false;
|
||||
}
|
||||
|
||||
QRect InternalClient::bufferGeometry() const
|
||||
{
|
||||
return m_clientGeometry;
|
||||
}
|
||||
|
||||
qreal InternalClient::bufferScale() const
|
||||
{
|
||||
if (m_internalWindow) {
|
||||
|
@ -477,6 +472,7 @@ void InternalClient::commitGeometry(const QRect &rect)
|
|||
|
||||
m_clientGeometry = frameRectToClientRect(rect);
|
||||
m_frameGeometry = rect;
|
||||
m_bufferGeometry = m_clientGeometry;
|
||||
|
||||
addWorkspaceRepaint(visibleGeometry());
|
||||
updateGeometryBeforeUpdateBlocking();
|
||||
|
|
|
@ -24,7 +24,6 @@ public:
|
|||
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
QRect bufferGeometry() const override;
|
||||
qreal bufferScale() const override;
|
||||
QString captionNormal() const override;
|
||||
QString captionSuffix() const override;
|
||||
|
|
|
@ -104,6 +104,7 @@ void Toplevel::detectShape(xcb_window_t id)
|
|||
void Toplevel::copyToDeleted(Toplevel* c)
|
||||
{
|
||||
m_internalId = c->internalId();
|
||||
m_bufferGeometry = c->m_bufferGeometry;
|
||||
m_frameGeometry = c->m_frameGeometry;
|
||||
m_clientGeometry = c->m_clientGeometry;
|
||||
m_visual = c->m_visual;
|
||||
|
|
|
@ -306,7 +306,7 @@ public:
|
|||
* For Wayland clients, this method returns rectangle that the main surface
|
||||
* occupies on the screen, in global screen coordinates.
|
||||
*/
|
||||
virtual QRect bufferGeometry() const = 0;
|
||||
QRect bufferGeometry() const;
|
||||
/**
|
||||
* Returns the geometry of the Toplevel, excluding invisible portions, e.g.
|
||||
* server-side and client-side drop shadows, etc.
|
||||
|
@ -701,6 +701,7 @@ protected:
|
|||
void setDepth(int depth);
|
||||
QRect m_frameGeometry;
|
||||
QRect m_clientGeometry;
|
||||
QRect m_bufferGeometry;
|
||||
xcb_visualid_t m_visual;
|
||||
int bit_depth;
|
||||
NETWinInfo* info;
|
||||
|
@ -744,6 +745,11 @@ inline void Toplevel::setWindowHandles(xcb_window_t w)
|
|||
m_client.reset(w, false);
|
||||
}
|
||||
|
||||
inline QRect Toplevel::bufferGeometry() const
|
||||
{
|
||||
return m_bufferGeometry;
|
||||
}
|
||||
|
||||
inline QRect Toplevel::clientGeometry() const
|
||||
{
|
||||
return m_clientGeometry;
|
||||
|
|
|
@ -98,6 +98,7 @@ bool Unmanaged::track(xcb_window_t w)
|
|||
}
|
||||
setWindowHandles(w); // the window is also the frame
|
||||
Xcb::selectInput(w, attr->your_event_mask | XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_PROPERTY_CHANGE);
|
||||
m_bufferGeometry = geo.rect();
|
||||
m_frameGeometry = geo.rect();
|
||||
m_clientGeometry = geo.rect();
|
||||
checkScreen();
|
||||
|
@ -160,11 +161,6 @@ bool Unmanaged::hasScheduledRelease() const
|
|||
return m_scheduledRelease;
|
||||
}
|
||||
|
||||
QRect Unmanaged::bufferGeometry() const
|
||||
{
|
||||
return m_frameGeometry;
|
||||
}
|
||||
|
||||
int Unmanaged::desktop() const
|
||||
{
|
||||
return NET::OnAllDesktops; // TODO for some window types should be the current desktop?
|
||||
|
|
|
@ -26,7 +26,6 @@ public:
|
|||
bool track(xcb_window_t w);
|
||||
bool hasScheduledRelease() const;
|
||||
static void deleteUnmanaged(Unmanaged* c);
|
||||
QRect bufferGeometry() const override;
|
||||
int desktop() const override;
|
||||
QStringList activities() const override;
|
||||
QVector<VirtualDesktop *> desktops() const override;
|
||||
|
|
|
@ -329,11 +329,6 @@ QRect WaylandClient::requestedClientGeometry() const
|
|||
return m_requestedClientGeometry;
|
||||
}
|
||||
|
||||
QRect WaylandClient::bufferGeometry() const
|
||||
{
|
||||
return m_bufferGeometry;
|
||||
}
|
||||
|
||||
QSize WaylandClient::requestedClientSize() const
|
||||
{
|
||||
return requestedClientGeometry().size();
|
||||
|
|
|
@ -23,7 +23,6 @@ class WaylandClient : public AbstractClient
|
|||
public:
|
||||
WaylandClient(KWaylandServer::SurfaceInterface *surface);
|
||||
|
||||
QRect bufferGeometry() const override;
|
||||
QString captionNormal() const override;
|
||||
QString captionSuffix() const override;
|
||||
QPoint clientContentPos() const override;
|
||||
|
@ -76,7 +75,6 @@ private:
|
|||
QString m_captionNormal;
|
||||
QString m_captionSuffix;
|
||||
QRect m_requestedFrameGeometry;
|
||||
QRect m_bufferGeometry;
|
||||
QRect m_requestedClientGeometry;
|
||||
SyncMode m_positionSyncMode = SyncMode::Sync;
|
||||
SyncMode m_sizeSyncMode = SyncMode::Sync;
|
||||
|
|
|
@ -2494,11 +2494,6 @@ QRect X11Client::inputGeometry() const
|
|||
return m_bufferGeometry;
|
||||
}
|
||||
|
||||
QRect X11Client::bufferGeometry() const
|
||||
{
|
||||
return m_bufferGeometry;
|
||||
}
|
||||
|
||||
QPoint X11Client::framePosToClientPos(const QPoint &point) const
|
||||
{
|
||||
int x = point.x();
|
||||
|
|
|
@ -81,7 +81,6 @@ public:
|
|||
xcb_window_t frameId() const override;
|
||||
|
||||
QRect inputGeometry() const override;
|
||||
QRect bufferGeometry() const override;
|
||||
|
||||
QPoint framePosToClientPos(const QPoint &point) const override;
|
||||
QPoint clientPosToFramePos(const QPoint &point) const override;
|
||||
|
@ -475,7 +474,6 @@ private:
|
|||
} m_fullscreenMode;
|
||||
|
||||
MaximizeMode max_mode;
|
||||
QRect m_bufferGeometry;
|
||||
xcb_colormap_t m_colormap;
|
||||
QString cap_normal, cap_iconic, cap_suffix;
|
||||
Group* in_group;
|
||||
|
|
Loading…
Reference in a new issue