Move Window::info to X11Window

This commit is contained in:
Vlad Zahorodnii 2023-03-29 12:39:10 +03:00
parent bf19234df3
commit e403c5bf63
4 changed files with 24 additions and 20 deletions

View file

@ -66,7 +66,6 @@ std::shared_ptr<Decoration::DecorationPalette> Window::s_defaultPalette;
Window::Window()
: m_output(workspace()->activeOutput())
, info(nullptr)
, ready_for_painting(false)
, m_internalId(QUuid::createUuid())
, m_client()
@ -120,7 +119,6 @@ Window::~Window()
m_tile->removeWindow(this);
}
Q_ASSERT(m_blockGeometryUpdates == 0);
delete info;
}
void Window::ref()
@ -253,14 +251,6 @@ xcb_window_t Window::wmClientLeader() const
return window();
}
void Window::getResourceClass()
{
if (!info) {
return;
}
setResourceClass(QString::fromLatin1(info->windowClassName()), QString::fromLatin1(info->windowClassClass()));
}
void Window::setResourceClass(const QString &name, const QString &className)
{
resource_name = name;
@ -417,10 +407,7 @@ void Window::elevate(bool elevate)
pid_t Window::pid() const
{
if (!info) {
return -1;
}
return info->pid();
return -1;
}
xcb_window_t Window::frameId() const
@ -487,10 +474,7 @@ void Window::setStackingOrder(int order)
QString Window::windowRole() const
{
if (!info) {
return {};
}
return QString::fromLatin1(info->windowRole());
return QString();
}
QRegion Window::inputShape() const

View file

@ -1482,7 +1482,6 @@ protected:
virtual std::unique_ptr<WindowItem> createItem(Scene *scene) = 0;
void getResourceClass();
void setResourceClass(const QString &name, const QString &className = QString());
Xcb::Property fetchSkipCloseAnimation() const;
void readSkipCloseAnimation(Xcb::Property &prop);
@ -1492,7 +1491,6 @@ protected:
QRectF m_frameGeometry;
QRectF m_clientGeometry;
QRectF m_bufferGeometry;
NETWinInfo *info;
bool ready_for_painting;
protected:

View file

@ -356,6 +356,8 @@ X11Window::X11Window()
*/
X11Window::~X11Window()
{
delete info;
if (m_killHelperPID && !::kill(m_killHelperPID, 0)) { // means the process is alive
::kill(m_killHelperPID, SIGTERM);
m_killHelperPID = 0;
@ -2888,6 +2890,16 @@ QMatrix4x4 X11Window::inputTransformation() const
return matrix;
}
pid_t X11Window::pid() const
{
return info->pid();
}
QString X11Window::windowRole() const
{
return QString::fromLatin1(info->windowRole());
}
Xcb::Property X11Window::fetchShowOnScreenEdge() const
{
return Xcb::Property(false, window(), atoms->kde_screen_edge_show, XCB_ATOM_CARDINAL, 0, 1);
@ -3826,6 +3838,11 @@ QSizeF X11Window::constrainClientSize(const QSizeF &size, SizeMode mode) const
return QSizeF(w, h);
}
void X11Window::getResourceClass()
{
setResourceClass(QString::fromLatin1(info->windowClassName()), QString::fromLatin1(info->windowClassClass()));
}
/**
* Gets the client's normal WM hints and reconfigures itself respectively.
*/

View file

@ -97,6 +97,8 @@ public:
QVector<QRectF> shapeRegion() const;
QMatrix4x4 inputTransformation() const override;
pid_t pid() const override;
QString windowRole() const override;
bool isTransient() const override;
bool groupTransient() const override;
@ -359,6 +361,7 @@ private:
bool isManaged() const; ///< Returns false if this client is not yet managed
void updateAllowedActions(bool force = false);
QRect fullscreenMonitorsArea(NETFullscreenMonitors topology) const;
void getResourceClass();
void getWmNormalHints();
void getMotifHints();
void getIcons();
@ -458,6 +461,8 @@ private:
void cleanGrouping();
void checkGroupTransients();
void setTransient(xcb_window_t new_transient_for_id);
NETWinInfo *info = nullptr;
xcb_window_t m_transientForId;
xcb_window_t m_originalTransientForId;
X11Window *shade_below;