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