Changeset View
Changeset View
Standalone View
Standalone View
effects.cpp
Show All 37 Lines | |||||
38 | #include "tabbox.h" | 38 | #include "tabbox.h" | ||
39 | #endif | 39 | #endif | ||
40 | #include "screenedge.h" | 40 | #include "screenedge.h" | ||
41 | #include "scripting/scriptedeffect.h" | 41 | #include "scripting/scriptedeffect.h" | ||
42 | #include "screens.h" | 42 | #include "screens.h" | ||
43 | #include "screenlockerwatcher.h" | 43 | #include "screenlockerwatcher.h" | ||
44 | #include "thumbnailitem.h" | 44 | #include "thumbnailitem.h" | ||
45 | #include "virtualdesktops.h" | 45 | #include "virtualdesktops.h" | ||
46 | #include "window_property_notify_x11_filter.h" | ||||
46 | #include "workspace.h" | 47 | #include "workspace.h" | ||
47 | #include "kwinglutils.h" | 48 | #include "kwinglutils.h" | ||
48 | 49 | | |||
49 | #include <QDebug> | 50 | #include <QDebug> | ||
50 | #include <QDesktopWidget> | 51 | #include <QDesktopWidget> | ||
51 | 52 | | |||
52 | #include <Plasma/Theme> | 53 | #include <Plasma/Theme> | ||
53 | 54 | | |||
▲ Show 20 Lines • Show All 133 Lines • ▼ Show 20 Line(s) | 131 | { | |||
187 | connect(ws, &Workspace::deletedRemoved, this, | 188 | connect(ws, &Workspace::deletedRemoved, this, | ||
188 | [this](KWin::Deleted *d) { | 189 | [this](KWin::Deleted *d) { | ||
189 | emit windowDeleted(d->effectWindow()); | 190 | emit windowDeleted(d->effectWindow()); | ||
190 | elevated_windows.removeAll(d->effectWindow()); | 191 | elevated_windows.removeAll(d->effectWindow()); | ||
191 | } | 192 | } | ||
192 | ); | 193 | ); | ||
193 | connect(vds, &VirtualDesktopManager::countChanged, this, &EffectsHandler::numberDesktopsChanged); | 194 | connect(vds, &VirtualDesktopManager::countChanged, this, &EffectsHandler::numberDesktopsChanged); | ||
194 | connect(Cursor::self(), &Cursor::mouseChanged, this, &EffectsHandler::mouseChanged); | 195 | connect(Cursor::self(), &Cursor::mouseChanged, this, &EffectsHandler::mouseChanged); | ||
195 | connect(ws, &Workspace::propertyNotify, this, | | |||
196 | [this](long int atom) { | | |||
197 | if (!registered_atoms.contains(atom)) | | |||
198 | return; | | |||
199 | emit propertyNotify(nullptr, atom); | | |||
200 | } | | |||
201 | ); | | |||
202 | connect(screens(), &Screens::countChanged, this, &EffectsHandler::numberScreensChanged); | 196 | connect(screens(), &Screens::countChanged, this, &EffectsHandler::numberScreensChanged); | ||
203 | connect(screens(), &Screens::sizeChanged, this, &EffectsHandler::virtualScreenSizeChanged); | 197 | connect(screens(), &Screens::sizeChanged, this, &EffectsHandler::virtualScreenSizeChanged); | ||
204 | connect(screens(), &Screens::geometryChanged, this, &EffectsHandler::virtualScreenGeometryChanged); | 198 | connect(screens(), &Screens::geometryChanged, this, &EffectsHandler::virtualScreenGeometryChanged); | ||
205 | #ifdef KWIN_BUILD_ACTIVITIES | 199 | #ifdef KWIN_BUILD_ACTIVITIES | ||
206 | if (Activities *activities = Activities::self()) { | 200 | if (Activities *activities = Activities::self()) { | ||
207 | connect(activities, &Activities::added, this, &EffectsHandler::activityAdded); | 201 | connect(activities, &Activities::added, this, &EffectsHandler::activityAdded); | ||
208 | connect(activities, &Activities::removed, this, &EffectsHandler::activityRemoved); | 202 | connect(activities, &Activities::removed, this, &EffectsHandler::activityRemoved); | ||
209 | connect(activities, &Activities::currentChanged, this, &EffectsHandler::currentActivityChanged); | 203 | connect(activities, &Activities::currentChanged, this, &EffectsHandler::currentActivityChanged); | ||
Show All 17 Lines | 220 | for (auto it = m_propertiesForEffects.keyBegin(); it != m_propertiesForEffects.keyEnd(); it++) { | |||
227 | const auto atom = registerSupportProperty(*it); | 221 | const auto atom = registerSupportProperty(*it); | ||
228 | if (atom == XCB_ATOM_NONE) { | 222 | if (atom == XCB_ATOM_NONE) { | ||
229 | continue; | 223 | continue; | ||
230 | } | 224 | } | ||
231 | m_compositor->keepSupportProperty(atom); | 225 | m_compositor->keepSupportProperty(atom); | ||
232 | m_managedProperties.insert(*it, atom); | 226 | m_managedProperties.insert(*it, atom); | ||
233 | registerPropertyType(atom, true); | 227 | registerPropertyType(atom, true); | ||
234 | } | 228 | } | ||
229 | if (kwinApp()->x11Connection()) { | ||||
230 | m_x11WindowPropertyNotify = std::make_unique<WindowPropertyNotifyX11Filter>(this); | ||||
231 | } else { | ||||
232 | m_x11WindowPropertyNotify.reset(); | ||||
233 | } | ||||
235 | emit xcbConnectionChanged(); | 234 | emit xcbConnectionChanged(); | ||
236 | } | 235 | } | ||
237 | ); | 236 | ); | ||
238 | 237 | | |||
238 | if (kwinApp()->x11Connection()) { | ||||
239 | m_x11WindowPropertyNotify = std::make_unique<WindowPropertyNotifyX11Filter>(this); | ||||
240 | } | ||||
241 | | ||||
239 | // connect all clients | 242 | // connect all clients | ||
240 | for (Client *c : ws->clientList()) { | 243 | for (Client *c : ws->clientList()) { | ||
241 | setupClientConnections(c); | 244 | setupClientConnections(c); | ||
242 | } | 245 | } | ||
243 | for (Unmanaged *u : ws->unmanagedList()) { | 246 | for (Unmanaged *u : ws->unmanagedList()) { | ||
244 | setupUnmanagedConnections(u); | 247 | setupUnmanagedConnections(u); | ||
245 | } | 248 | } | ||
246 | if (auto w = waylandServer()) { | 249 | if (auto w = waylandServer()) { | ||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Line(s) | 337 | connect(c, &AbstractClient::windowHidden, this, | |||
337 | } | 340 | } | ||
338 | ); | 341 | ); | ||
339 | } | 342 | } | ||
340 | 343 | | |||
341 | void EffectsHandlerImpl::setupClientConnections(Client* c) | 344 | void EffectsHandlerImpl::setupClientConnections(Client* c) | ||
342 | { | 345 | { | ||
343 | setupAbstractClientConnections(c); | 346 | setupAbstractClientConnections(c); | ||
344 | connect(c, &Client::paddingChanged, this, &EffectsHandlerImpl::slotPaddingChanged); | 347 | connect(c, &Client::paddingChanged, this, &EffectsHandlerImpl::slotPaddingChanged); | ||
345 | connect(c, &Client::propertyNotify, this, &EffectsHandlerImpl::slotPropertyNotify); | | |||
346 | } | 348 | } | ||
347 | 349 | | |||
348 | void EffectsHandlerImpl::setupUnmanagedConnections(Unmanaged* u) | 350 | void EffectsHandlerImpl::setupUnmanagedConnections(Unmanaged* u) | ||
349 | { | 351 | { | ||
350 | connect(u, &Unmanaged::windowClosed, this, &EffectsHandlerImpl::slotWindowClosed); | 352 | connect(u, &Unmanaged::windowClosed, this, &EffectsHandlerImpl::slotWindowClosed); | ||
351 | connect(u, &Unmanaged::opacityChanged, this, &EffectsHandlerImpl::slotOpacityChanged); | 353 | connect(u, &Unmanaged::opacityChanged, this, &EffectsHandlerImpl::slotOpacityChanged); | ||
352 | connect(u, &Unmanaged::geometryShapeChanged, this, &EffectsHandlerImpl::slotGeometryShapeChanged); | 354 | connect(u, &Unmanaged::geometryShapeChanged, this, &EffectsHandlerImpl::slotGeometryShapeChanged); | ||
353 | connect(u, &Unmanaged::paddingChanged, this, &EffectsHandlerImpl::slotPaddingChanged); | 355 | connect(u, &Unmanaged::paddingChanged, this, &EffectsHandlerImpl::slotPaddingChanged); | ||
354 | connect(u, &Unmanaged::damaged, this, &EffectsHandlerImpl::slotWindowDamaged); | 356 | connect(u, &Unmanaged::damaged, this, &EffectsHandlerImpl::slotWindowDamaged); | ||
355 | connect(u, &Unmanaged::propertyNotify, this, &EffectsHandlerImpl::slotPropertyNotify); | | |||
356 | } | 357 | } | ||
357 | 358 | | |||
358 | void EffectsHandlerImpl::reconfigure() | 359 | void EffectsHandlerImpl::reconfigure() | ||
359 | { | 360 | { | ||
360 | m_effectLoader->queryAndLoadAll(); | 361 | m_effectLoader->queryAndLoadAll(); | ||
361 | } | 362 | } | ||
362 | 363 | | |||
363 | // the idea is that effects call this function again which calls the next one | 364 | // the idea is that effects call this function again which calls the next one | ||
▲ Show 20 Lines • Show All 439 Lines • ▼ Show 20 Line(s) | |||||
803 | { | 804 | { | ||
804 | m_scene->screenGeometryChanged(size); | 805 | m_scene->screenGeometryChanged(size); | ||
805 | if (m_mouseInterceptionWindow.isValid()) { | 806 | if (m_mouseInterceptionWindow.isValid()) { | ||
806 | m_mouseInterceptionWindow.setGeometry(QRect(0, 0, size.width(), size.height())); | 807 | m_mouseInterceptionWindow.setGeometry(QRect(0, 0, size.width(), size.height())); | ||
807 | } | 808 | } | ||
808 | emit screenGeometryChanged(size); | 809 | emit screenGeometryChanged(size); | ||
809 | } | 810 | } | ||
810 | 811 | | |||
811 | void EffectsHandlerImpl::slotPropertyNotify(Toplevel* t, long int atom) | | |||
812 | { | | |||
813 | if (!registered_atoms.contains(atom)) | | |||
814 | return; | | |||
815 | emit propertyNotify(t->effectWindow(), atom); | | |||
816 | } | | |||
817 | | ||||
818 | void EffectsHandlerImpl::registerPropertyType(long atom, bool reg) | 812 | void EffectsHandlerImpl::registerPropertyType(long atom, bool reg) | ||
819 | { | 813 | { | ||
820 | if (reg) | 814 | if (reg) | ||
821 | ++registered_atoms[ atom ]; // initialized to 0 if not present yet | 815 | ++registered_atoms[ atom ]; // initialized to 0 if not present yet | ||
822 | else { | 816 | else { | ||
823 | if (--registered_atoms[ atom ] == 0) | 817 | if (--registered_atoms[ atom ] == 0) | ||
824 | registered_atoms.remove(atom); | 818 | registered_atoms.remove(atom); | ||
825 | } | 819 | } | ||
▲ Show 20 Lines • Show All 1311 Lines • Show Last 20 Lines |