Changeset View
Changeset View
Standalone View
Standalone View
src/server/outputconfiguration_interface.cpp
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 43 | public: | |||
---|---|---|---|---|---|
50 | void clearPendingChanges(); | 50 | void clearPendingChanges(); | ||
51 | 51 | | |||
52 | bool hasPendingChanges(OutputDeviceInterface *outputdevice) const; | 52 | bool hasPendingChanges(OutputDeviceInterface *outputdevice) const; | ||
53 | OutputChangeSet* pendingChanges(OutputDeviceInterface *outputdevice); | 53 | OutputChangeSet* pendingChanges(OutputDeviceInterface *outputdevice); | ||
54 | 54 | | |||
55 | OutputManagementInterface *outputManagement; | 55 | OutputManagementInterface *outputManagement; | ||
56 | QHash<OutputDeviceInterface*, OutputChangeSet*> changes; | 56 | QHash<OutputDeviceInterface*, OutputChangeSet*> changes; | ||
57 | 57 | | |||
58 | static const quint32 s_version = 2; | 58 | static const quint32 s_version = 3; | ||
59 | 59 | | |||
60 | private: | 60 | private: | ||
61 | static void enableCallback(wl_client *client, wl_resource *resource, | 61 | static void enableCallback(wl_client *client, wl_resource *resource, | ||
62 | wl_resource * outputdevice, int32_t enable); | 62 | wl_resource * outputdevice, int32_t enable); | ||
63 | static void modeCallback(wl_client *client, wl_resource *resource, | 63 | static void modeCallback(wl_client *client, wl_resource *resource, | ||
64 | wl_resource * outputdevice, int32_t mode_id); | 64 | wl_resource * outputdevice, int32_t mode_id); | ||
65 | static void transformCallback(wl_client *client, wl_resource *resource, | 65 | static void transformCallback(wl_client *client, wl_resource *resource, | ||
66 | wl_resource * outputdevice, int32_t transform); | 66 | wl_resource * outputdevice, int32_t transform); | ||
67 | static void positionCallback(wl_client *client, wl_resource *resource, | 67 | static void positionCallback(wl_client *client, wl_resource *resource, | ||
68 | wl_resource * outputdevice, int32_t x, int32_t y); | 68 | wl_resource * outputdevice, int32_t x, int32_t y); | ||
69 | static void scaleCallback(wl_client *client, wl_resource *resource, | 69 | static void scaleCallback(wl_client *client, wl_resource *resource, | ||
70 | wl_resource * outputdevice, int32_t scale); | 70 | wl_resource * outputdevice, int32_t scale); | ||
71 | static void applyCallback(wl_client *client, wl_resource *resource); | 71 | static void applyCallback(wl_client *client, wl_resource *resource); | ||
72 | static void scaleFCallback(wl_client *client, wl_resource *resource, | 72 | static void scaleFCallback(wl_client *client, wl_resource *resource, | ||
73 | wl_resource * outputdevice, wl_fixed_t scale); | 73 | wl_resource * outputdevice, wl_fixed_t scale); | ||
74 | static void colorcurvesCallback(wl_client *client, wl_resource *resource, | 74 | static void colorcurvesCallback(wl_client *client, wl_resource *resource, | ||
75 | wl_resource * outputdevice, | 75 | wl_resource * outputdevice, | ||
76 | wl_array *red, wl_array *green, wl_array *blue); | 76 | wl_array *red, wl_array *green, wl_array *blue); | ||
77 | static void replicateCallback(wl_client *client, wl_resource *resource, | ||||
78 | wl_resource * outputdevice, wl_resource *source); | ||||
77 | 79 | | |||
78 | OutputConfigurationInterface *q_func() { | 80 | OutputConfigurationInterface *q_func() { | ||
79 | return reinterpret_cast<OutputConfigurationInterface *>(q); | 81 | return reinterpret_cast<OutputConfigurationInterface *>(q); | ||
80 | } | 82 | } | ||
81 | 83 | | |||
82 | static const struct org_kde_kwin_outputconfiguration_interface s_interface; | 84 | static const struct org_kde_kwin_outputconfiguration_interface s_interface; | ||
83 | }; | 85 | }; | ||
84 | 86 | | |||
85 | const struct org_kde_kwin_outputconfiguration_interface OutputConfigurationInterface::Private::s_interface = { | 87 | const struct org_kde_kwin_outputconfiguration_interface OutputConfigurationInterface::Private::s_interface = { | ||
86 | enableCallback, | 88 | enableCallback, | ||
87 | modeCallback, | 89 | modeCallback, | ||
88 | transformCallback, | 90 | transformCallback, | ||
89 | positionCallback, | 91 | positionCallback, | ||
90 | scaleCallback, | 92 | scaleCallback, | ||
91 | applyCallback, | 93 | applyCallback, | ||
92 | scaleFCallback, | 94 | scaleFCallback, | ||
93 | colorcurvesCallback, | 95 | colorcurvesCallback, | ||
94 | resourceDestroyedCallback | 96 | resourceDestroyedCallback, | ||
97 | replicateCallback | ||||
95 | }; | 98 | }; | ||
96 | 99 | | |||
97 | OutputConfigurationInterface::OutputConfigurationInterface(OutputManagementInterface* parent, wl_resource* parentResource): Resource(new Private(this, parent, parentResource)) | 100 | OutputConfigurationInterface::OutputConfigurationInterface(OutputManagementInterface* parent, wl_resource* parentResource): Resource(new Private(this, parent, parentResource)) | ||
98 | { | 101 | { | ||
99 | Q_D(); | 102 | Q_D(); | ||
100 | d->outputManagement = parent; | 103 | d->outputManagement = parent; | ||
101 | } | 104 | } | ||
102 | 105 | | |||
▲ Show 20 Lines • Show All 145 Lines • ▼ Show 20 Line(s) | 226 | { | |||
248 | }; | 251 | }; | ||
249 | fillVector(red, &cc.red); | 252 | fillVector(red, &cc.red); | ||
250 | fillVector(green, &cc.green); | 253 | fillVector(green, &cc.green); | ||
251 | fillVector(blue, &cc.blue); | 254 | fillVector(blue, &cc.blue); | ||
252 | 255 | | |||
253 | s->pendingChanges(o)->d_func()->colorCurves = cc; | 256 | s->pendingChanges(o)->d_func()->colorCurves = cc; | ||
254 | } | 257 | } | ||
255 | 258 | | |||
259 | void OutputConfigurationInterface::Private::replicateCallback(wl_client *client, wl_resource *resource, | ||||
260 | wl_resource *outputdevice, | ||||
261 | wl_resource *source) | ||||
262 | { | ||||
263 | Q_UNUSED(client); | ||||
264 | | ||||
265 | OutputDeviceInterface *src = OutputDeviceInterface::get(source); | ||||
266 | if (!src && source) { | ||||
267 | qCWarning(KWAYLAND_SERVER) << "Requested to clone output device from" << source << ", but does not exist."; | ||||
268 | return; | ||||
269 | } | ||||
270 | | ||||
271 | OutputDeviceInterface *o = OutputDeviceInterface::get(outputdevice); | ||||
272 | auto s = cast<Private>(resource); | ||||
273 | Q_ASSERT(s); | ||||
274 | s->pendingChanges(o)->d_func()->replicationSource = src; | ||||
275 | } | ||||
276 | | ||||
256 | void OutputConfigurationInterface::Private::emitConfigurationChangeRequested() const | 277 | void OutputConfigurationInterface::Private::emitConfigurationChangeRequested() const | ||
257 | { | 278 | { | ||
258 | auto configinterface = reinterpret_cast<OutputConfigurationInterface *>(q); | 279 | auto configinterface = reinterpret_cast<OutputConfigurationInterface *>(q); | ||
259 | emit outputManagement->configurationChangeRequested(configinterface); | 280 | emit outputManagement->configurationChangeRequested(configinterface); | ||
260 | } | 281 | } | ||
261 | 282 | | |||
262 | 283 | | |||
263 | OutputConfigurationInterface::Private::Private(OutputConfigurationInterface *q, OutputManagementInterface *c, wl_resource *parentResource) | 284 | OutputConfigurationInterface::Private::Private(OutputConfigurationInterface *q, OutputManagementInterface *c, wl_resource *parentResource) | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 341 | { | |||
321 | if (!changes.keys().contains(outputdevice)) { | 342 | if (!changes.keys().contains(outputdevice)) { | ||
322 | return false; | 343 | return false; | ||
323 | } | 344 | } | ||
324 | auto c = changes[outputdevice]; | 345 | auto c = changes[outputdevice]; | ||
325 | return c->enabledChanged() || | 346 | return c->enabledChanged() || | ||
326 | c->modeChanged() || | 347 | c->modeChanged() || | ||
327 | c->transformChanged() || | 348 | c->transformChanged() || | ||
328 | c->positionChanged() || | 349 | c->positionChanged() || | ||
329 | c->scaleChanged(); | 350 | c->scaleChanged() || | ||
351 | c->replicationSourceChanged(); | ||||
330 | } | 352 | } | ||
331 | 353 | | |||
332 | void OutputConfigurationInterface::Private::clearPendingChanges() | 354 | void OutputConfigurationInterface::Private::clearPendingChanges() | ||
333 | { | 355 | { | ||
334 | qDeleteAll(changes.begin(), changes.end()); | 356 | qDeleteAll(changes.begin(), changes.end()); | ||
335 | changes.clear(); | 357 | changes.clear(); | ||
336 | } | 358 | } | ||
337 | 359 | | |||
338 | 360 | | |||
339 | } | 361 | } | ||
340 | } | 362 | } |