From bf19234df3662032cff215d65d324ba5bd336fe2 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 29 Mar 2023 11:09:43 +0300 Subject: [PATCH] Move Window::detectShape to X11Window --- src/events.cpp | 4 ++-- src/window.cpp | 5 ----- src/window.h | 2 -- src/x11window.cpp | 9 +++++++-- src/x11window.h | 2 ++ 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/events.cpp b/src/events.cpp index c5e2b2cd08..c71ad3a950 100644 --- a/src/events.cpp +++ b/src/events.cpp @@ -371,7 +371,7 @@ bool X11Window::windowEvent(xcb_generic_event_t *e) break; default: { if (eventType == Xcb::Extensions::self()->shapeNotifyEvent()) { - detectShape(window()); + detectShape(); Q_EMIT geometryShapeChanged(frameGeometry()); } if (eventType == Xcb::Extensions::self()->damageNotifyEvent()) { @@ -554,7 +554,7 @@ bool X11Window::windowEvent(xcb_generic_event_t *e) } default: if (eventType == Xcb::Extensions::self()->shapeNotifyEvent() && reinterpret_cast(e)->affected_window == window()) { - detectShape(window()); // workaround for #19644 + detectShape(); // workaround for #19644 updateShape(); } if (eventType == Xcb::Extensions::self()->damageNotifyEvent() && reinterpret_cast(e)->drawable == frameId()) { diff --git a/src/window.cpp b/src/window.cpp index f42e2ff3cf..0732a83d6f 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -168,11 +168,6 @@ QDebug operator<<(QDebug debug, const Window *window) return debug; } -void Window::detectShape(xcb_window_t id) -{ - is_shape = Xcb::Extensions::self()->hasShape(id); -} - QRectF Window::visibleGeometry() const { if (const WindowItem *item = windowItem()) { diff --git a/src/window.h b/src/window.h index 81d928c404..e12e01d0b6 100644 --- a/src/window.h +++ b/src/window.h @@ -1475,7 +1475,6 @@ Q_SIGNALS: protected: void setWindowHandles(xcb_window_t client); - void detectShape(xcb_window_t id); Xcb::Property fetchWmClientLeader() const; void readWmClientLeader(Xcb::Property &p); void getWmClientLeader(); @@ -1786,7 +1785,6 @@ protected: void cleanTabBox(); QStringList m_activityList; - bool is_shape = false; private Q_SLOTS: void shadeHover(); diff --git a/src/x11window.cpp b/src/x11window.cpp index 7040f5f288..5ca148faa7 100644 --- a/src/x11window.cpp +++ b/src/x11window.cpp @@ -548,7 +548,7 @@ bool X11Window::track(xcb_window_t w) if (Xcb::Extensions::self()->isShapeAvailable()) { xcb_shape_select_input(kwinApp()->x11Connection(), w, true); } - detectShape(w); + detectShape(); getWmOpaqueRegion(); getSkipCloseAnimation(); setupCompositing(); @@ -649,7 +649,7 @@ bool X11Window::manage(xcb_window_t w, bool isMapped) if (Xcb::Extensions::self()->isShapeAvailable()) { xcb_shape_select_input(kwinApp()->x11Connection(), window(), true); } - detectShape(window()); + detectShape(); detectNoBorder(); fetchIconicName(); setClientFrameExtents(info->gtkFrameExtents()); @@ -1528,6 +1528,11 @@ void X11Window::checkNoBorder() setNoBorder(app_noborder); } +void X11Window::detectShape() +{ + is_shape = Xcb::Extensions::self()->hasShape(window()); +} + void X11Window::updateShape() { if (is_shape) { diff --git a/src/x11window.h b/src/x11window.h index 7f6df77e92..5797f246f6 100644 --- a/src/x11window.h +++ b/src/x11window.h @@ -180,6 +180,7 @@ public: void invalidateDecoration() override; + void detectShape(); void updateShape(); /// resizeWithChecks() resizes according to gravity, and checks workarea position @@ -466,6 +467,7 @@ private: uint app_noborder : 1; ///< App requested no border via window type, shape extension, etc. uint ignore_focus_stealing : 1; ///< Don't apply focus stealing prevention to this client bool blocks_compositing; + bool is_shape = false; enum FullScreenMode { FullScreenNone,