cm: handle inert cm outputs (#11916)
This commit is contained in:
parent
b7ef892ecf
commit
76d998743a
2 changed files with 8 additions and 20 deletions
|
|
@ -68,20 +68,8 @@ CColorManager::CColorManager(SP<CWpColorManagerV1> resource) : m_resource(resour
|
||||||
|
|
||||||
const auto OUTPUTRESOURCE = CWLOutputResource::fromResource(output);
|
const auto OUTPUTRESOURCE = CWLOutputResource::fromResource(output);
|
||||||
|
|
||||||
if UNLIKELY (!OUTPUTRESOURCE) {
|
const auto RESOURCE = PROTO::colorManagement->m_outputs.emplace_back(
|
||||||
r->error(-1, "Invalid output (2)");
|
makeShared<CColorManagementOutput>(makeShared<CWpColorManagementOutputV1>(r->client(), r->version(), id), OUTPUTRESOURCE));
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto PMONITOR = OUTPUTRESOURCE->m_monitor.lock();
|
|
||||||
|
|
||||||
if UNLIKELY (!PMONITOR) {
|
|
||||||
r->error(-1, "Invalid output (2)");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto RESOURCE =
|
|
||||||
PROTO::colorManagement->m_outputs.emplace_back(makeShared<CColorManagementOutput>(makeShared<CWpColorManagementOutputV1>(r->client(), r->version(), id), PMONITOR));
|
|
||||||
|
|
||||||
if UNLIKELY (!RESOURCE->good()) {
|
if UNLIKELY (!RESOURCE->good()) {
|
||||||
r->noMemory();
|
r->noMemory();
|
||||||
|
|
@ -206,7 +194,7 @@ wl_client* CColorManager::client() {
|
||||||
return m_resource->client();
|
return m_resource->client();
|
||||||
}
|
}
|
||||||
|
|
||||||
CColorManagementOutput::CColorManagementOutput(SP<CWpColorManagementOutputV1> resource, WP<CMonitor> monitor) : m_resource(resource), m_monitor(monitor) {
|
CColorManagementOutput::CColorManagementOutput(SP<CWpColorManagementOutputV1> resource, WP<CWLOutputResource> output) : m_resource(resource), m_output(output) {
|
||||||
if UNLIKELY (!good())
|
if UNLIKELY (!good())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -231,10 +219,10 @@ CColorManagementOutput::CColorManagementOutput(SP<CWpColorManagementOutputV1> re
|
||||||
}
|
}
|
||||||
|
|
||||||
RESOURCE->m_self = RESOURCE;
|
RESOURCE->m_self = RESOURCE;
|
||||||
if (!m_monitor.valid())
|
if (!m_output || !m_output->m_monitor.valid())
|
||||||
RESOURCE->m_resource->sendFailed(WP_IMAGE_DESCRIPTION_V1_CAUSE_NO_OUTPUT, "No output");
|
RESOURCE->m_resource->sendFailed(WP_IMAGE_DESCRIPTION_V1_CAUSE_NO_OUTPUT, "No output");
|
||||||
else {
|
else {
|
||||||
RESOURCE->m_settings = m_monitor->m_imageDescription;
|
RESOURCE->m_settings = m_output->m_monitor->m_imageDescription;
|
||||||
RESOURCE->m_resource->sendReady(RESOURCE->m_settings.updateId());
|
RESOURCE->m_resource->sendReady(RESOURCE->m_settings.updateId());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -805,7 +793,7 @@ void CColorManagementProtocol::onImagePreferredChanged(uint32_t preferredId) {
|
||||||
|
|
||||||
void CColorManagementProtocol::onMonitorImageDescriptionChanged(WP<CMonitor> monitor) {
|
void CColorManagementProtocol::onMonitorImageDescriptionChanged(WP<CMonitor> monitor) {
|
||||||
for (auto const& output : m_outputs) {
|
for (auto const& output : m_outputs) {
|
||||||
if (output->m_monitor == monitor)
|
if (output->m_output && output->m_output->m_monitor == monitor)
|
||||||
output->m_resource->sendImageDescriptionChanged();
|
output->m_resource->sendImageDescriptionChanged();
|
||||||
}
|
}
|
||||||
// recheck feedbacks
|
// recheck feedbacks
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class CColorManager {
|
||||||
|
|
||||||
class CColorManagementOutput {
|
class CColorManagementOutput {
|
||||||
public:
|
public:
|
||||||
CColorManagementOutput(SP<CWpColorManagementOutputV1> resource, WP<CMonitor> monitor);
|
CColorManagementOutput(SP<CWpColorManagementOutputV1> resource, WP<CWLOutputResource> output);
|
||||||
|
|
||||||
bool good();
|
bool good();
|
||||||
wl_client* client();
|
wl_client* client();
|
||||||
|
|
@ -38,7 +38,7 @@ class CColorManagementOutput {
|
||||||
private:
|
private:
|
||||||
SP<CWpColorManagementOutputV1> m_resource;
|
SP<CWpColorManagementOutputV1> m_resource;
|
||||||
wl_client* m_client = nullptr;
|
wl_client* m_client = nullptr;
|
||||||
WP<CMonitor> m_monitor;
|
WP<CWLOutputResource> m_output;
|
||||||
|
|
||||||
friend class CColorManagementProtocol;
|
friend class CColorManagementProtocol;
|
||||||
friend class CColorManagementImageDescription;
|
friend class CColorManagementImageDescription;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue