diff --git a/src/window.cpp b/src/window.cpp index 0732a83d6f..68309fe5a3 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -66,7 +66,6 @@ std::shared_ptr 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 diff --git a/src/window.h b/src/window.h index e12e01d0b6..a0ef917e61 100644 --- a/src/window.h +++ b/src/window.h @@ -1482,7 +1482,6 @@ protected: virtual std::unique_ptr 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: diff --git a/src/x11window.cpp b/src/x11window.cpp index 5ca148faa7..3ecb051282 100644 --- a/src/x11window.cpp +++ b/src/x11window.cpp @@ -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. */ diff --git a/src/x11window.h b/src/x11window.h index 5797f246f6..1e64f41232 100644 --- a/src/x11window.h +++ b/src/x11window.h @@ -97,6 +97,8 @@ public: QVector 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;