Changeset View
Changeset View
Standalone View
Standalone View
src/server/surface_interface.cpp
Show All 16 Lines | |||||
17 | You should have received a copy of the GNU Lesser General Public | 17 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "surface_interface.h" | 20 | #include "surface_interface.h" | ||
21 | #include "surface_interface_p.h" | 21 | #include "surface_interface_p.h" | ||
22 | #include "buffer_interface.h" | 22 | #include "buffer_interface.h" | ||
23 | #include "clientconnection.h" | 23 | #include "clientconnection.h" | ||
24 | #include "compositor_interface.h" | 24 | #include "compositor_interface.h" | ||
25 | #include "idleinhibit_interface_p.h" | ||||
25 | #include "pointerconstraints_interface_p.h" | 26 | #include "pointerconstraints_interface_p.h" | ||
26 | #include "region_interface.h" | 27 | #include "region_interface.h" | ||
27 | #include "subcompositor_interface.h" | 28 | #include "subcompositor_interface.h" | ||
28 | #include "subsurface_interface_p.h" | 29 | #include "subsurface_interface_p.h" | ||
29 | // Qt | 30 | // Qt | ||
30 | #include <QListIterator> | 31 | #include <QListIterator> | ||
31 | // Wayland | 32 | // Wayland | ||
32 | #include <wayland-server.h> | 33 | #include <wayland-server.h> | ||
▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Line(s) | 202 | [this] { | |||
208 | disconnect(constrainsUnboundConnection); | 209 | disconnect(constrainsUnboundConnection); | ||
209 | constrainsUnboundConnection = QMetaObject::Connection(); | 210 | constrainsUnboundConnection = QMetaObject::Connection(); | ||
210 | emit q_func()->pointerConstraintsChanged(); | 211 | emit q_func()->pointerConstraintsChanged(); | ||
211 | } | 212 | } | ||
212 | ); | 213 | ); | ||
213 | emit q_func()->pointerConstraintsChanged(); | 214 | emit q_func()->pointerConstraintsChanged(); | ||
214 | } | 215 | } | ||
215 | 216 | | |||
217 | void SurfaceInterface::Private::installIdleInhibitor(IdleInhibitorInterface *inhibitor) | ||||
218 | { | ||||
219 | idleInhibitors << inhibitor; | ||||
220 | QObject::connect(inhibitor, &IdleInhibitorInterface::aboutToBeUnbound, q, | ||||
221 | [this, inhibitor] { | ||||
222 | idleInhibitors.removeOne(inhibitor); | ||||
223 | if (idleInhibitors.isEmpty()) { | ||||
224 | emit q_func()->inhibitsIdleChanged(); | ||||
225 | } | ||||
226 | } | ||||
227 | ); | ||||
228 | if (idleInhibitors.count() == 1) { | ||||
229 | emit q_func()->inhibitsIdleChanged(); | ||||
230 | } | ||||
231 | } | ||||
232 | | ||||
216 | void SurfaceInterface::Private::installPointerConstraint(ConfinedPointerInterface *confinement) | 233 | void SurfaceInterface::Private::installPointerConstraint(ConfinedPointerInterface *confinement) | ||
217 | { | 234 | { | ||
218 | Q_ASSERT(lockedPointer.isNull()); | 235 | Q_ASSERT(lockedPointer.isNull()); | ||
219 | Q_ASSERT(confinedPointer.isNull()); | 236 | Q_ASSERT(confinedPointer.isNull()); | ||
220 | confinedPointer = QPointer<ConfinedPointerInterface>(confinement); | 237 | confinedPointer = QPointer<ConfinedPointerInterface>(confinement); | ||
221 | if (confinement->lifeTime() == ConfinedPointerInterface::LifeTime::OneShot) { | 238 | if (confinement->lifeTime() == ConfinedPointerInterface::LifeTime::OneShot) { | ||
222 | constrainsOneShotConnection = QObject::connect(confinement, &ConfinedPointerInterface::confinedChanged, q_func(), | 239 | constrainsOneShotConnection = QObject::connect(confinement, &ConfinedPointerInterface::confinedChanged, q_func(), | ||
223 | [this] { | 240 | [this] { | ||
▲ Show 20 Lines • Show All 627 Lines • ▼ Show 20 Line(s) | |||||
851 | } | 868 | } | ||
852 | 869 | | |||
853 | QPointer<ConfinedPointerInterface> SurfaceInterface::confinedPointer() const | 870 | QPointer<ConfinedPointerInterface> SurfaceInterface::confinedPointer() const | ||
854 | { | 871 | { | ||
855 | Q_D(); | 872 | Q_D(); | ||
856 | return d->confinedPointer; | 873 | return d->confinedPointer; | ||
857 | } | 874 | } | ||
858 | 875 | | |||
876 | bool SurfaceInterface::inhibitsIdle() const | ||||
877 | { | ||||
878 | Q_D(); | ||||
879 | return !d->idleInhibitors.isEmpty(); | ||||
880 | } | ||||
881 | | ||||
859 | SurfaceInterface::Private *SurfaceInterface::d_func() const | 882 | SurfaceInterface::Private *SurfaceInterface::d_func() const | ||
860 | { | 883 | { | ||
861 | return reinterpret_cast<Private*>(d.data()); | 884 | return reinterpret_cast<Private*>(d.data()); | ||
862 | } | 885 | } | ||
863 | 886 | | |||
864 | } | 887 | } | ||
865 | } | 888 | } |