Changeset View
Changeset View
Standalone View
Standalone View
effects.cpp
Show First 20 Lines • Show All 910 Lines • ▼ Show 20 Line(s) | |||||
911 | void EffectsHandlerImpl::windowToDesktop(EffectWindow* w, int desktop) | 911 | void EffectsHandlerImpl::windowToDesktop(EffectWindow* w, int desktop) | ||
912 | { | 912 | { | ||
913 | AbstractClient* cl = dynamic_cast< AbstractClient* >(static_cast<EffectWindowImpl*>(w)->window()); | 913 | AbstractClient* cl = dynamic_cast< AbstractClient* >(static_cast<EffectWindowImpl*>(w)->window()); | ||
914 | if (cl && !cl->isDesktop() && !cl->isDock()) { | 914 | if (cl && !cl->isDesktop() && !cl->isDock()) { | ||
915 | Workspace::self()->sendClientToDesktop(cl, desktop, true); | 915 | Workspace::self()->sendClientToDesktop(cl, desktop, true); | ||
916 | } | 916 | } | ||
917 | } | 917 | } | ||
918 | 918 | | |||
919 | void EffectsHandlerImpl::windowToDesktops(EffectWindow *w, const QVector<uint> &desktopIds) | ||||
920 | { | ||||
921 | AbstractClient* cl = qobject_cast< AbstractClient* >(static_cast<EffectWindowImpl*>(w)->window()); | ||||
zzag: If we pass Deleted, then we don't have to do anything. Also, why not qobject_cast?
Coding… | |||||
VirtualDesktop *desktop = VirtualDesktopManager::self()->desktopForX11Id(desktop); if (!desktop) { return; } This part might be broken because of NET::OnAllDesktops. Sorry. zzag: ```lang=cpp
VirtualDesktop *desktop = VirtualDesktopManager::self()->desktopForX11Id(desktop)… | |||||
davidedmundson: >Why not qobject_cast?
Just consistency with the existing code
| |||||
922 | if (!cl || cl->isDesktop() || cl->isDock()) { | ||||
923 | return; | ||||
924 | } | ||||
925 | QVector<VirtualDesktop*> desktops; | ||||
926 | desktops.reserve(desktopIds.count()); | ||||
927 | for (uint x11Id: desktopIds) { | ||||
928 | if (x11Id > VirtualDesktopManager::self()->count()) { | ||||
929 | continue; | ||||
930 | } | ||||
931 | VirtualDesktop *d = VirtualDesktopManager::self()->desktopForX11Id(x11Id); | ||||
932 | Q_ASSERT(d); | ||||
933 | if (desktops.contains(d)) { | ||||
934 | continue; | ||||
935 | } | ||||
936 | desktops << d; | ||||
937 | } | ||||
938 | cl->setDesktops(desktops); | ||||
939 | } | ||||
940 | | ||||
919 | void EffectsHandlerImpl::windowToScreen(EffectWindow* w, int screen) | 941 | void EffectsHandlerImpl::windowToScreen(EffectWindow* w, int screen) | ||
920 | { | 942 | { | ||
921 | AbstractClient* cl = dynamic_cast< AbstractClient* >(static_cast<EffectWindowImpl*>(w)->window()); | 943 | AbstractClient* cl = dynamic_cast< AbstractClient* >(static_cast<EffectWindowImpl*>(w)->window()); | ||
922 | if (cl && !cl->isDesktop() && !cl->isDock()) | 944 | if (cl && !cl->isDesktop() && !cl->isDock()) | ||
923 | Workspace::self()->sendClientToScreen(cl, screen); | 945 | Workspace::self()->sendClientToScreen(cl, screen); | ||
924 | } | 946 | } | ||
925 | 947 | | |||
926 | void EffectsHandlerImpl::setShowingDesktop(bool showing) | 948 | void EffectsHandlerImpl::setShowingDesktop(bool showing) | ||
▲ Show 20 Lines • Show All 1178 Lines • Show Last 20 Lines |
If we pass Deleted, then we don't have to do anything. Also, why not qobject_cast?
Coding style nitpick: