Changeset View
Changeset View
Standalone View
Standalone View
effects/slidingpopups/slidingpopups.cpp
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 35 | { | |||
---|---|---|---|---|---|
43 | 43 | | |||
44 | mAtom = effects->announceSupportProperty("_KDE_SLIDE", this); | 44 | mAtom = effects->announceSupportProperty("_KDE_SLIDE", this); | ||
45 | connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*))); | 45 | connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*))); | ||
46 | connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*))); | 46 | connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*))); | ||
47 | connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*))); | 47 | connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*))); | ||
48 | connect(effects, SIGNAL(propertyNotify(KWin::EffectWindow*,long)), this, SLOT(slotPropertyNotify(KWin::EffectWindow*,long))); | 48 | connect(effects, SIGNAL(propertyNotify(KWin::EffectWindow*,long)), this, SLOT(slotPropertyNotify(KWin::EffectWindow*,long))); | ||
49 | connect(effects, &EffectsHandler::windowShown, this, &SlidingPopupsEffect::startForShow); | 49 | connect(effects, &EffectsHandler::windowShown, this, &SlidingPopupsEffect::startForShow); | ||
50 | connect(effects, &EffectsHandler::windowHidden, this, &SlidingPopupsEffect::slotWindowClosed); | 50 | connect(effects, &EffectsHandler::windowHidden, this, &SlidingPopupsEffect::slotWindowClosed); | ||
51 | connect(effects, &EffectsHandler::xcbConnectionChanged, this, | ||||
52 | [this] { | ||||
53 | mAtom = effects->announceSupportProperty(QByteArrayLiteral("_KDE_SLIDE"), this); | ||||
54 | } | ||||
55 | ); | ||||
51 | reconfigure(ReconfigureAll); | 56 | reconfigure(ReconfigureAll); | ||
52 | } | 57 | } | ||
53 | 58 | | |||
54 | SlidingPopupsEffect::~SlidingPopupsEffect() | 59 | SlidingPopupsEffect::~SlidingPopupsEffect() | ||
55 | { | 60 | { | ||
56 | } | 61 | } | ||
57 | 62 | | |||
58 | void SlidingPopupsEffect::reconfigure(ReconfigureFlags flags) | 63 | void SlidingPopupsEffect::reconfigure(ReconfigureFlags flags) | ||
▲ Show 20 Lines • Show All 209 Lines • ▼ Show 20 Line(s) | 272 | if (mAppearingWindows.contains(w) || mDisappearingWindows.contains(w)) { | |||
268 | w->addRepaintFull(); // trigger next animation repaint | 273 | w->addRepaintFull(); // trigger next animation repaint | ||
269 | } | 274 | } | ||
270 | effects->postPaintWindow(w); | 275 | effects->postPaintWindow(w); | ||
271 | } | 276 | } | ||
272 | 277 | | |||
273 | void SlidingPopupsEffect::slotWindowAdded(EffectWindow *w) | 278 | void SlidingPopupsEffect::slotWindowAdded(EffectWindow *w) | ||
274 | { | 279 | { | ||
275 | //X11 | 280 | //X11 | ||
281 | if (mAtom != XCB_ATOM_NONE) { | ||||
276 | slotPropertyNotify(w, mAtom); | 282 | slotPropertyNotify(w, mAtom); | ||
283 | } | ||||
277 | 284 | | |||
278 | //Wayland | 285 | //Wayland | ||
279 | if (auto surf = w->surface()) { | 286 | if (auto surf = w->surface()) { | ||
280 | slotWaylandSlideOnShowChanged(w); | 287 | slotWaylandSlideOnShowChanged(w); | ||
281 | connect(surf, &KWayland::Server::SurfaceInterface::slideOnShowHideChanged, this, [this, surf] { | 288 | connect(surf, &KWayland::Server::SurfaceInterface::slideOnShowHideChanged, this, [this, surf] { | ||
282 | slotWaylandSlideOnShowChanged(effects->findWindow(surf)); | 289 | slotWaylandSlideOnShowChanged(effects->findWindow(surf)); | ||
283 | }); | 290 | }); | ||
284 | } | 291 | } | ||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Line(s) | 355 | { | |||
349 | delete mAppearingWindows.take(w); | 356 | delete mAppearingWindows.take(w); | ||
350 | delete mDisappearingWindows.take(w); | 357 | delete mDisappearingWindows.take(w); | ||
351 | mWindowsData.remove(w); | 358 | mWindowsData.remove(w); | ||
352 | effects->addRepaint(w->expandedGeometry()); | 359 | effects->addRepaint(w->expandedGeometry()); | ||
353 | } | 360 | } | ||
354 | 361 | | |||
355 | void SlidingPopupsEffect::slotPropertyNotify(EffectWindow* w, long a) | 362 | void SlidingPopupsEffect::slotPropertyNotify(EffectWindow* w, long a) | ||
356 | { | 363 | { | ||
357 | if (!w || a != mAtom) | 364 | if (!w || a != mAtom || mAtom == XCB_ATOM_NONE) | ||
358 | return; | 365 | return; | ||
359 | 366 | | |||
360 | QByteArray data = w->readProperty(mAtom, mAtom, 32); | 367 | QByteArray data = w->readProperty(mAtom, mAtom, 32); | ||
361 | 368 | | |||
362 | if (data.length() < 1) { | 369 | if (data.length() < 1) { | ||
363 | // Property was removed, thus also remove the effect for window | 370 | // Property was removed, thus also remove the effect for window | ||
364 | if (w->data(WindowClosedGrabRole).value<void *>() == this) { | 371 | if (w->data(WindowClosedGrabRole).value<void *>() == this) { | ||
365 | w->setData(WindowClosedGrabRole, QVariant()); | 372 | w->setData(WindowClosedGrabRole, QVariant()); | ||
▲ Show 20 Lines • Show All 120 Lines • Show Last 20 Lines |