From 902c2feb12b1d691ef2417e83bc74174cef6700a Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 28 Mar 2023 13:08:22 +0300 Subject: [PATCH] scripting: Drop Window.shaped property It should be irrelevant to the scripts and there's no matching abstraction on wayland. is_shape is made protected, but it will be eventually moved to an X11 specific subclass. --- src/window.cpp | 7 +------ src/window.h | 19 +------------------ src/x11window.cpp | 4 ++-- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/window.cpp b/src/window.cpp index 681efa9fcf..f75d0621cb 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -72,7 +72,6 @@ Window::Window() , ready_for_painting(false) , m_internalId(QUuid::createUuid()) , m_client() - , is_shape(false) , m_clientMachine(new ClientMachine(this)) , m_wmClientLeader(XCB_WINDOW_NONE) , m_skipCloseAnimation(false) @@ -175,11 +174,7 @@ QDebug operator<<(QDebug debug, const Window *window) void Window::detectShape(xcb_window_t id) { - const bool wasShape = is_shape; is_shape = Xcb::Extensions::self()->hasShape(id); - if (wasShape != is_shape) { - Q_EMIT shapedChanged(); - } } QRectF Window::visibleGeometry() const @@ -421,7 +416,7 @@ QVector Window::shapeRegion() const const QRectF bufferGeometry = this->bufferGeometry(); - if (shape()) { + if (is_shape) { auto cookie = xcb_shape_get_rectangles_unchecked(kwinApp()->x11Connection(), frameId(), XCB_SHAPE_SK_BOUNDING); UniqueCPtr reply(xcb_shape_get_rectangles_reply(kwinApp()->x11Connection(), cookie, nullptr)); if (reply) { diff --git a/src/window.h b/src/window.h index 5fa6ba1516..77fbec583b 100644 --- a/src/window.h +++ b/src/window.h @@ -243,11 +243,6 @@ class KWIN_EXPORT Window : public QObject */ Q_PROPERTY(bool deleted READ isDeleted CONSTANT) - /** - * Whether the window has an own shape - */ - Q_PROPERTY(bool shaped READ shape NOTIFY shapedChanged) - /** * Whether the window does not want to be animated on window close. * There are legit reasons for this like a screenshot application which does not want it's @@ -691,7 +686,6 @@ public: bool readyForPainting() const; // true if the window has been already painted its contents xcb_visualid_t visual() const; - bool shape() const; QRegion inputShape() const; void setOpacity(qreal opacity); qreal opacity() const; @@ -1395,12 +1389,6 @@ Q_SIGNALS: void closed(); void windowShown(KWin::Window *window); void windowHidden(KWin::Window *window); - /** - * Signal emitted when the window's shape state changed. That is if it did not have a shape - * and received one or if the shape was withdrawn. Think of Chromium enabling/disabling KWin's - * decoration. - */ - void shapedChanged(); /** * Emitted whenever the Window's screen changes. This can happen either in consequence to * a screen being removed/added or if the Window's geometry changes. @@ -1828,6 +1816,7 @@ protected: void cleanTabBox(); QStringList m_activityList; + bool is_shape = false; private Q_SLOTS: void shadeHover(); @@ -1840,7 +1829,6 @@ private: int m_refCount = 1; QUuid m_internalId; Xcb::Window m_client; - bool is_shape; std::unique_ptr m_effectWindow; std::unique_ptr m_windowItem; std::unique_ptr m_shadow; @@ -2159,11 +2147,6 @@ inline bool Window::isInternal() const return false; } -inline bool Window::shape() const -{ - return is_shape; -} - inline int Window::depth() const { return bit_depth; diff --git a/src/x11window.cpp b/src/x11window.cpp index cbd749b57c..2e3ee39b51 100644 --- a/src/x11window.cpp +++ b/src/x11window.cpp @@ -1243,7 +1243,7 @@ void X11Window::maybeDestroyX11DecorationRenderer() void X11Window::detectNoBorder() { - if (shape()) { + if (is_shape) { noborder = true; app_noborder = true; return; @@ -1384,7 +1384,7 @@ void X11Window::checkNoBorder() void X11Window::updateShape() { - if (shape()) { + if (is_shape) { // Workaround for #19644 - Shaped windows shouldn't have decoration if (!app_noborder) { // Only when shape is detected for the first time, still let the user to override