Changeset View
Changeset View
Standalone View
Standalone View
src/server/surface_interface_p.h
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 42 | struct State { | |||
---|---|---|---|---|---|
50 | bool shadowIsSet = false; | 50 | bool shadowIsSet = false; | ||
51 | bool blurIsSet = false; | 51 | bool blurIsSet = false; | ||
52 | bool contrastIsSet = false; | 52 | bool contrastIsSet = false; | ||
53 | bool slideIsSet = false; | 53 | bool slideIsSet = false; | ||
54 | bool inputIsInfinite = true; | 54 | bool inputIsInfinite = true; | ||
55 | bool childrenChanged = false; | 55 | bool childrenChanged = false; | ||
56 | bool scaleIsSet = false; | 56 | bool scaleIsSet = false; | ||
57 | bool transformIsSet = false; | 57 | bool transformIsSet = false; | ||
58 | bool sourceRectangleIsSet = false; | ||||
59 | bool destinationSizeIsSet = false; | ||||
58 | qint32 scale = 1; | 60 | qint32 scale = 1; | ||
59 | OutputInterface::Transform transform = OutputInterface::Transform::Normal; | 61 | OutputInterface::Transform transform = OutputInterface::Transform::Normal; | ||
60 | QList<wl_resource*> callbacks = QList<wl_resource*>(); | 62 | QList<wl_resource*> callbacks = QList<wl_resource*>(); | ||
61 | QPoint offset = QPoint(); | 63 | QPoint offset = QPoint(); | ||
62 | BufferInterface *buffer = nullptr; | 64 | BufferInterface *buffer = nullptr; | ||
65 | QRectF sourceRectangle = QRectF(); | ||||
66 | QSize destinationSize = QSize(); | ||||
63 | // stacking order: bottom (first) -> top (last) | 67 | // stacking order: bottom (first) -> top (last) | ||
64 | QList<QPointer<SubSurfaceInterface>> children; | 68 | QList<QPointer<SubSurfaceInterface>> children; | ||
65 | QPointer<ShadowInterface> shadow; | 69 | QPointer<ShadowInterface> shadow; | ||
66 | QPointer<BlurInterface> blur; | 70 | QPointer<BlurInterface> blur; | ||
67 | QPointer<ContrastInterface> contrast; | 71 | QPointer<ContrastInterface> contrast; | ||
68 | QPointer<SlideInterface> slide; | 72 | QPointer<SlideInterface> slide; | ||
69 | }; | 73 | }; | ||
70 | Private(SurfaceInterface *q, CompositorInterface *c, wl_resource *parentResource); | 74 | Private(SurfaceInterface *q, CompositorInterface *c, wl_resource *parentResource); | ||
71 | ~Private(); | 75 | ~Private(); | ||
72 | 76 | | |||
73 | void destroy(); | 77 | void destroy(); | ||
74 | 78 | | |||
75 | void addChild(QPointer<SubSurfaceInterface> subsurface); | 79 | void addChild(QPointer<SubSurfaceInterface> subsurface); | ||
76 | void removeChild(QPointer<SubSurfaceInterface> subsurface); | 80 | void removeChild(QPointer<SubSurfaceInterface> subsurface); | ||
77 | bool raiseChild(QPointer<SubSurfaceInterface> subsurface, SurfaceInterface *sibling); | 81 | bool raiseChild(QPointer<SubSurfaceInterface> subsurface, SurfaceInterface *sibling); | ||
78 | bool lowerChild(QPointer<SubSurfaceInterface> subsurface, SurfaceInterface *sibling); | 82 | bool lowerChild(QPointer<SubSurfaceInterface> subsurface, SurfaceInterface *sibling); | ||
79 | void setShadow(const QPointer<ShadowInterface> &shadow); | 83 | void setShadow(const QPointer<ShadowInterface> &shadow); | ||
80 | void setBlur(const QPointer<BlurInterface> &blur); | 84 | void setBlur(const QPointer<BlurInterface> &blur); | ||
81 | void setContrast(const QPointer<ContrastInterface> &contrast); | 85 | void setContrast(const QPointer<ContrastInterface> &contrast); | ||
82 | void setSlide(const QPointer<SlideInterface> &slide); | 86 | void setSlide(const QPointer<SlideInterface> &slide); | ||
87 | void setSourceRectangle(const QRectF &source); | ||||
88 | void setDestinationSize(const QSize &dest); | ||||
83 | void installPointerConstraint(LockedPointerInterface *lock); | 89 | void installPointerConstraint(LockedPointerInterface *lock); | ||
84 | void installPointerConstraint(ConfinedPointerInterface *confinement); | 90 | void installPointerConstraint(ConfinedPointerInterface *confinement); | ||
85 | void installIdleInhibitor(IdleInhibitorInterface *inhibitor); | 91 | void installIdleInhibitor(IdleInhibitorInterface *inhibitor); | ||
92 | void installViewport(ViewportInterface *vp); | ||||
86 | 93 | | |||
87 | void commitSubSurface(); | 94 | void commitSubSurface(); | ||
88 | void commit(); | 95 | void commit(); | ||
89 | 96 | | |||
90 | SurfaceRole *role = nullptr; | 97 | SurfaceRole *role = nullptr; | ||
91 | 98 | | |||
92 | State current; | 99 | State current; | ||
93 | State pending; | 100 | State pending; | ||
94 | State subSurfacePending; | 101 | State subSurfacePending; | ||
95 | QPointer<SubSurfaceInterface> subSurface; | 102 | QPointer<SubSurfaceInterface> subSurface; | ||
96 | QRegion trackedDamage; | 103 | QRegion trackedDamage; | ||
97 | 104 | | |||
98 | // workaround for https://bugreports.qt.io/browse/QTBUG-52192 | 105 | // workaround for https://bugreports.qt.io/browse/QTBUG-52192 | ||
99 | // A subsurface needs to be considered mapped even if it doesn't have a buffer attached | 106 | // A subsurface needs to be considered mapped even if it doesn't have a buffer attached | ||
100 | // Otherwise Qt's sub-surfaces will never be visible and the client will freeze due to | 107 | // Otherwise Qt's sub-surfaces will never be visible and the client will freeze due to | ||
101 | // waiting on the frame callback of the never visible surface | 108 | // waiting on the frame callback of the never visible surface | ||
102 | bool subSurfaceIsMapped = true; | 109 | bool subSurfaceIsMapped = true; | ||
103 | 110 | | |||
104 | QVector<OutputInterface *> outputs; | 111 | QVector<OutputInterface *> outputs; | ||
105 | 112 | | |||
106 | QPointer<LockedPointerInterface> lockedPointer; | 113 | QPointer<LockedPointerInterface> lockedPointer; | ||
107 | QPointer<ConfinedPointerInterface> confinedPointer; | 114 | QPointer<ConfinedPointerInterface> confinedPointer; | ||
115 | QPointer<ViewportInterface> viewport; | ||||
108 | QHash<OutputInterface*, QMetaObject::Connection> outputDestroyedConnections; | 116 | QHash<OutputInterface*, QMetaObject::Connection> outputDestroyedConnections; | ||
109 | QVector<IdleInhibitorInterface*> idleInhibitors; | 117 | QVector<IdleInhibitorInterface*> idleInhibitors; | ||
110 | 118 | | |||
111 | SurfaceInterface *dataProxy = nullptr; | 119 | SurfaceInterface *dataProxy = nullptr; | ||
112 | 120 | | |||
113 | private: | 121 | private: | ||
114 | QMetaObject::Connection constrainsOneShotConnection; | 122 | QMetaObject::Connection constrainsOneShotConnection; | ||
115 | QMetaObject::Connection constrainsUnboundConnection; | 123 | QMetaObject::Connection constrainsUnboundConnection; | ||
116 | 124 | | |||
117 | SurfaceInterface *q_func() { | 125 | SurfaceInterface *q_func() { | ||
118 | return reinterpret_cast<SurfaceInterface *>(q); | 126 | return reinterpret_cast<SurfaceInterface *>(q); | ||
119 | } | 127 | } | ||
120 | void swapStates(State *source, State *target, bool emitChanged); | 128 | void swapStates(State *source, State *target, bool emitChanged); | ||
121 | void damage(const QRect &rect); | 129 | void damage(const QRect &rect); | ||
122 | void damageBuffer(const QRect &rect); | 130 | void damageBuffer(const QRect &rect); | ||
123 | void setScale(qint32 scale); | 131 | void setScale(qint32 scale); | ||
124 | void setTransform(OutputInterface::Transform transform); | 132 | void setTransform(OutputInterface::Transform transform); | ||
125 | void addFrameCallback(uint32_t callback); | 133 | void addFrameCallback(uint32_t callback); | ||
126 | void attachBuffer(wl_resource *buffer, const QPoint &offset); | 134 | void attachBuffer(wl_resource *buffer, const QPoint &offset); | ||
127 | void setOpaque(const QRegion ®ion); | 135 | void setOpaque(const QRegion ®ion); | ||
128 | void setInput(const QRegion ®ion, bool isInfinite); | 136 | void setInput(const QRegion ®ion, bool isInfinite); | ||
129 | 137 | | |||
138 | /** | ||||
139 | * Posts Wayland error in case the source rectangle needs to be integer valued but is not. | ||||
140 | */ | ||||
141 | void soureRectangleIntegerCheck(const QSize &destinationSize, | ||||
142 | const QRectF &sourceRectangle) const; | ||||
143 | /** | ||||
144 | * Posts Wayland error in case the source rectangle is not contained in surface size. | ||||
145 | */ | ||||
146 | void soureRectangleContainCheck(const BufferInterface *buffer, | ||||
147 | OutputInterface::Transform transform, qint32 scale, | ||||
148 | const QRectF &sourceRectangle) const; | ||||
149 | | ||||
130 | static void destroyFrameCallback(wl_resource *r); | 150 | static void destroyFrameCallback(wl_resource *r); | ||
131 | 151 | | |||
132 | static void attachCallback(wl_client *client, wl_resource *resource, wl_resource *buffer, int32_t sx, int32_t sy); | 152 | static void attachCallback(wl_client *client, wl_resource *resource, wl_resource *buffer, int32_t sx, int32_t sy); | ||
133 | static void damageCallback(wl_client *client, wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height); | 153 | static void damageCallback(wl_client *client, wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height); | ||
134 | static void frameCallback(wl_client *client, wl_resource *resource, uint32_t callback); | 154 | static void frameCallback(wl_client *client, wl_resource *resource, uint32_t callback); | ||
135 | static void opaqueRegionCallback(wl_client *client, wl_resource *resource, wl_resource *region); | 155 | static void opaqueRegionCallback(wl_client *client, wl_resource *resource, wl_resource *region); | ||
136 | static void inputRegionCallback(wl_client *client, wl_resource *resource, wl_resource *region); | 156 | static void inputRegionCallback(wl_client *client, wl_resource *resource, wl_resource *region); | ||
137 | static void commitCallback(wl_client *client, wl_resource *resource); | 157 | static void commitCallback(wl_client *client, wl_resource *resource); | ||
Show All 14 Lines |