Changeset View
Changeset View
Standalone View
Standalone View
effects/blur/blur.cpp
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | 41 | { | |||
---|---|---|---|---|---|
68 | } else { | 68 | } else { | ||
69 | net_wm_blur_region = 0; | 69 | net_wm_blur_region = 0; | ||
70 | } | 70 | } | ||
71 | 71 | | |||
72 | connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*))); | 72 | connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*))); | ||
73 | connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*))); | 73 | connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*))); | ||
74 | connect(effects, SIGNAL(propertyNotify(KWin::EffectWindow*,long)), this, SLOT(slotPropertyNotify(KWin::EffectWindow*,long))); | 74 | connect(effects, SIGNAL(propertyNotify(KWin::EffectWindow*,long)), this, SLOT(slotPropertyNotify(KWin::EffectWindow*,long))); | ||
75 | connect(effects, SIGNAL(screenGeometryChanged(QSize)), this, SLOT(slotScreenGeometryChanged())); | 75 | connect(effects, SIGNAL(screenGeometryChanged(QSize)), this, SLOT(slotScreenGeometryChanged())); | ||
76 | connect(effects, &EffectsHandler::xcbConnectionChanged, this, | ||||
davidedmundson: I was expecting you to do what you for the present windows effect with calling your local… | |||||
I didn't go for the lambda here as the if statement above does also the Wayland registering. So at least the if would have been needed to be duplicated anyway. graesslin: I didn't go for the lambda here as the if statement above does also the Wayland registering. So… | |||||
77 | [this] { | ||||
78 | if (shader && shader->isValid() && target->valid()) { | ||||
davidedmundson: same here. | |||||
79 | net_wm_blur_region = effects->announceSupportProperty(s_blurAtomName, this); | ||||
80 | } | ||||
81 | } | ||||
82 | ); | ||||
76 | 83 | | |||
77 | // Fetch the blur regions for all windows | 84 | // Fetch the blur regions for all windows | ||
78 | foreach (EffectWindow *window, effects->stackingOrder()) | 85 | foreach (EffectWindow *window, effects->stackingOrder()) | ||
79 | updateBlurRegion(window); | 86 | updateBlurRegion(window); | ||
80 | } | 87 | } | ||
81 | 88 | | |||
82 | BlurEffect::~BlurEffect() | 89 | BlurEffect::~BlurEffect() | ||
83 | { | 90 | { | ||
Show All 27 Lines | 116 | if (!shader || !shader->isValid()) { | |||
111 | delete m_blurManager; | 118 | delete m_blurManager; | ||
112 | m_blurManager = nullptr; | 119 | m_blurManager = nullptr; | ||
113 | } | 120 | } | ||
114 | } | 121 | } | ||
115 | 122 | | |||
116 | void BlurEffect::updateBlurRegion(EffectWindow *w) const | 123 | void BlurEffect::updateBlurRegion(EffectWindow *w) const | ||
117 | { | 124 | { | ||
118 | QRegion region; | 125 | QRegion region; | ||
126 | QByteArray value; | ||||
119 | 127 | | |||
120 | const QByteArray value = w->readProperty(net_wm_blur_region, XCB_ATOM_CARDINAL, 32); | 128 | if (net_wm_blur_region != XCB_ATOM_NONE) { | ||
129 | value = w->readProperty(net_wm_blur_region, XCB_ATOM_CARDINAL, 32); | ||||
121 | if (value.size() > 0 && !(value.size() % (4 * sizeof(uint32_t)))) { | 130 | if (value.size() > 0 && !(value.size() % (4 * sizeof(uint32_t)))) { | ||
122 | const uint32_t *cardinals = reinterpret_cast<const uint32_t*>(value.constData()); | 131 | const uint32_t *cardinals = reinterpret_cast<const uint32_t*>(value.constData()); | ||
123 | for (unsigned int i = 0; i < value.size() / sizeof(uint32_t);) { | 132 | for (unsigned int i = 0; i < value.size() / sizeof(uint32_t);) { | ||
124 | int x = cardinals[i++]; | 133 | int x = cardinals[i++]; | ||
125 | int y = cardinals[i++]; | 134 | int y = cardinals[i++]; | ||
126 | int w = cardinals[i++]; | 135 | int w = cardinals[i++]; | ||
127 | int h = cardinals[i++]; | 136 | int h = cardinals[i++]; | ||
128 | region += QRect(x, y, w, h); | 137 | region += QRect(x, y, w, h); | ||
129 | } | 138 | } | ||
130 | } | 139 | } | ||
140 | } | ||||
131 | 141 | | |||
132 | KWayland::Server::SurfaceInterface *surf = w->surface(); | 142 | KWayland::Server::SurfaceInterface *surf = w->surface(); | ||
133 | 143 | | |||
134 | if (surf && surf->blur()) { | 144 | if (surf && surf->blur()) { | ||
135 | region = surf->blur()->region(); | 145 | region = surf->blur()->region(); | ||
136 | } | 146 | } | ||
137 | 147 | | |||
138 | //!value.isNull() full window in X11 case, surf->blur() | 148 | //!value.isNull() full window in X11 case, surf->blur() | ||
Show All 27 Lines | 175 | { | |||
166 | if (windows.contains(w)) { | 176 | if (windows.contains(w)) { | ||
167 | disconnect(windows[w].blurChangedConnection); | 177 | disconnect(windows[w].blurChangedConnection); | ||
168 | windows.remove(w); | 178 | windows.remove(w); | ||
169 | } | 179 | } | ||
170 | } | 180 | } | ||
171 | 181 | | |||
172 | void BlurEffect::slotPropertyNotify(EffectWindow *w, long atom) | 182 | void BlurEffect::slotPropertyNotify(EffectWindow *w, long atom) | ||
173 | { | 183 | { | ||
174 | if (w && atom == net_wm_blur_region) { | 184 | if (w && atom == net_wm_blur_region && net_wm_blur_region != XCB_ATOM_NONE) { | ||
175 | updateBlurRegion(w); | 185 | updateBlurRegion(w); | ||
176 | CacheEntry it = windows.find(w); | 186 | CacheEntry it = windows.find(w); | ||
177 | if (it != windows.end()) { | 187 | if (it != windows.end()) { | ||
178 | const QRect screen = effects->virtualScreenGeometry(); | 188 | const QRect screen = effects->virtualScreenGeometry(); | ||
179 | it->damagedRegion = expand(blurRegion(w).translated(w->pos())) & screen; | 189 | it->damagedRegion = expand(blurRegion(w).translated(w->pos())) & screen; | ||
180 | } | 190 | } | ||
181 | } | 191 | } | ||
182 | } | 192 | } | ||
▲ Show 20 Lines • Show All 583 Lines • Show Last 20 Lines |
I was expecting you to do what you for the present windows effect with calling your local lambda announceSupportProperties.
IMHO it's neater than duplicating - but this is fine too.