Move Window::detectShape to X11Window

This commit is contained in:
Vlad Zahorodnii 2023-03-29 11:09:43 +03:00
parent fa8bd5c0d9
commit bf19234df3
5 changed files with 11 additions and 11 deletions

View file

@ -371,7 +371,7 @@ bool X11Window::windowEvent(xcb_generic_event_t *e)
break; break;
default: { default: {
if (eventType == Xcb::Extensions::self()->shapeNotifyEvent()) { if (eventType == Xcb::Extensions::self()->shapeNotifyEvent()) {
detectShape(window()); detectShape();
Q_EMIT geometryShapeChanged(frameGeometry()); Q_EMIT geometryShapeChanged(frameGeometry());
} }
if (eventType == Xcb::Extensions::self()->damageNotifyEvent()) { if (eventType == Xcb::Extensions::self()->damageNotifyEvent()) {
@ -554,7 +554,7 @@ bool X11Window::windowEvent(xcb_generic_event_t *e)
} }
default: default:
if (eventType == Xcb::Extensions::self()->shapeNotifyEvent() && reinterpret_cast<xcb_shape_notify_event_t *>(e)->affected_window == window()) { if (eventType == Xcb::Extensions::self()->shapeNotifyEvent() && reinterpret_cast<xcb_shape_notify_event_t *>(e)->affected_window == window()) {
detectShape(window()); // workaround for #19644 detectShape(); // workaround for #19644
updateShape(); updateShape();
} }
if (eventType == Xcb::Extensions::self()->damageNotifyEvent() && reinterpret_cast<xcb_damage_notify_event_t *>(e)->drawable == frameId()) { if (eventType == Xcb::Extensions::self()->damageNotifyEvent() && reinterpret_cast<xcb_damage_notify_event_t *>(e)->drawable == frameId()) {

View file

@ -168,11 +168,6 @@ QDebug operator<<(QDebug debug, const Window *window)
return debug; return debug;
} }
void Window::detectShape(xcb_window_t id)
{
is_shape = Xcb::Extensions::self()->hasShape(id);
}
QRectF Window::visibleGeometry() const QRectF Window::visibleGeometry() const
{ {
if (const WindowItem *item = windowItem()) { if (const WindowItem *item = windowItem()) {

View file

@ -1475,7 +1475,6 @@ Q_SIGNALS:
protected: protected:
void setWindowHandles(xcb_window_t client); void setWindowHandles(xcb_window_t client);
void detectShape(xcb_window_t id);
Xcb::Property fetchWmClientLeader() const; Xcb::Property fetchWmClientLeader() const;
void readWmClientLeader(Xcb::Property &p); void readWmClientLeader(Xcb::Property &p);
void getWmClientLeader(); void getWmClientLeader();
@ -1786,7 +1785,6 @@ protected:
void cleanTabBox(); void cleanTabBox();
QStringList m_activityList; QStringList m_activityList;
bool is_shape = false;
private Q_SLOTS: private Q_SLOTS:
void shadeHover(); void shadeHover();

View file

@ -548,7 +548,7 @@ bool X11Window::track(xcb_window_t w)
if (Xcb::Extensions::self()->isShapeAvailable()) { if (Xcb::Extensions::self()->isShapeAvailable()) {
xcb_shape_select_input(kwinApp()->x11Connection(), w, true); xcb_shape_select_input(kwinApp()->x11Connection(), w, true);
} }
detectShape(w); detectShape();
getWmOpaqueRegion(); getWmOpaqueRegion();
getSkipCloseAnimation(); getSkipCloseAnimation();
setupCompositing(); setupCompositing();
@ -649,7 +649,7 @@ bool X11Window::manage(xcb_window_t w, bool isMapped)
if (Xcb::Extensions::self()->isShapeAvailable()) { if (Xcb::Extensions::self()->isShapeAvailable()) {
xcb_shape_select_input(kwinApp()->x11Connection(), window(), true); xcb_shape_select_input(kwinApp()->x11Connection(), window(), true);
} }
detectShape(window()); detectShape();
detectNoBorder(); detectNoBorder();
fetchIconicName(); fetchIconicName();
setClientFrameExtents(info->gtkFrameExtents()); setClientFrameExtents(info->gtkFrameExtents());
@ -1528,6 +1528,11 @@ void X11Window::checkNoBorder()
setNoBorder(app_noborder); setNoBorder(app_noborder);
} }
void X11Window::detectShape()
{
is_shape = Xcb::Extensions::self()->hasShape(window());
}
void X11Window::updateShape() void X11Window::updateShape()
{ {
if (is_shape) { if (is_shape) {

View file

@ -180,6 +180,7 @@ public:
void invalidateDecoration() override; void invalidateDecoration() override;
void detectShape();
void updateShape(); void updateShape();
/// resizeWithChecks() resizes according to gravity, and checks workarea position /// 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 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 uint ignore_focus_stealing : 1; ///< Don't apply focus stealing prevention to this client
bool blocks_compositing; bool blocks_compositing;
bool is_shape = false;
enum FullScreenMode { enum FullScreenMode {
FullScreenNone, FullScreenNone,