Changeset View
Changeset View
Standalone View
Standalone View
scripting/scriptedeffect.cpp
Show First 20 Lines • Show All 661 Lines • ▼ Show 20 Line(s) | 661 | { | |||
---|---|---|---|---|---|
662 | void *e = w->data(static_cast<KWin::DataRole>(grabRole)).value<void*>(); | 662 | void *e = w->data(static_cast<KWin::DataRole>(grabRole)).value<void*>(); | ||
663 | if (e) { | 663 | if (e) { | ||
664 | return e != this; | 664 | return e != this; | ||
665 | } else { | 665 | } else { | ||
666 | return false; | 666 | return false; | ||
667 | } | 667 | } | ||
668 | } | 668 | } | ||
669 | 669 | | |||
670 | bool ScriptedEffect::grab(EffectWindow *w, DataRole grabRole, bool force) | ||||
671 | { | ||||
672 | void *grabber = w->data(grabRole).value<void *>(); | ||||
673 | | ||||
674 | if (grabber == this) { | ||||
675 | return true; | ||||
676 | } | ||||
677 | | ||||
678 | if (grabber != nullptr && grabber != this && !force) { | ||||
679 | return false; | ||||
680 | } | ||||
681 | | ||||
682 | w->setData(grabRole, QVariant::fromValue(static_cast<void *>(this))); | ||||
davidedmundson: is this line the right way round? | |||||
Is it okay to grab windows unconditionally? I was thinking about force argument or something. zzag: Is it okay to grab windows unconditionally? I was thinking about `force` argument or something. | |||||
683 | | ||||
684 | return true; | ||||
685 | } | ||||
686 | | ||||
687 | bool ScriptedEffect::ungrab(EffectWindow *w, DataRole grabRole) | ||||
688 | { | ||||
689 | void *grabber = w->data(grabRole).value<void *>(); | ||||
690 | | ||||
691 | if (grabber == nullptr) { | ||||
692 | return true; | ||||
693 | } | ||||
694 | | ||||
695 | if (grabber != this) { | ||||
696 | return false; | ||||
697 | } | ||||
698 | | ||||
699 | w->setData(grabRole, QVariant()); | ||||
700 | | ||||
701 | return true; | ||||
702 | } | ||||
703 | | ||||
670 | void ScriptedEffect::reconfigure(ReconfigureFlags flags) | 704 | void ScriptedEffect::reconfigure(ReconfigureFlags flags) | ||
671 | { | 705 | { | ||
672 | AnimationEffect::reconfigure(flags); | 706 | AnimationEffect::reconfigure(flags); | ||
673 | if (m_config) { | 707 | if (m_config) { | ||
674 | m_config->read(); | 708 | m_config->read(); | ||
675 | } | 709 | } | ||
676 | emit configChanged(); | 710 | emit configChanged(); | ||
677 | } | 711 | } | ||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |
is this line the right way round?