helpers: refactor class member vars (#10218)
This commit is contained in:
parent
b8a204c21d
commit
50e1bec85f
63 changed files with 1770 additions and 1769 deletions
|
|
@ -40,9 +40,9 @@ CHyprlandCTMControlResource::CHyprlandCTMControlResource(SP<CHyprlandCtmControlM
|
|||
}
|
||||
}
|
||||
|
||||
ctms[PMONITOR->szName] = MAT;
|
||||
ctms[PMONITOR->m_name] = MAT;
|
||||
|
||||
LOGM(LOG, "CTM set for output {}: {}", PMONITOR->szName, ctms.at(PMONITOR->szName).toString());
|
||||
LOGM(LOG, "CTM set for output {}: {}", PMONITOR->m_name, ctms.at(PMONITOR->m_name).toString());
|
||||
});
|
||||
|
||||
resource->setCommit([this](CHyprlandCtmControlManagerV1* r) {
|
||||
|
|
@ -52,12 +52,12 @@ CHyprlandCTMControlResource::CHyprlandCTMControlResource(SP<CHyprlandCtmControlM
|
|||
LOGM(LOG, "Committing ctms to outputs");
|
||||
|
||||
for (auto& m : g_pCompositor->m_monitors) {
|
||||
if (!ctms.contains(m->szName)) {
|
||||
if (!ctms.contains(m->m_name)) {
|
||||
PROTO::ctm->setCTM(m, Mat3x3::identity());
|
||||
continue;
|
||||
}
|
||||
|
||||
PROTO::ctm->setCTM(m, ctms.at(m->szName));
|
||||
PROTO::ctm->setCTM(m, ctms.at(m->m_name));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ CColorManagementOutput::CColorManagementOutput(SP<CWpColorManagementOutputV1> re
|
|||
if (!m_monitor.valid())
|
||||
RESOURCE->m_resource->sendFailed(WP_IMAGE_DESCRIPTION_V1_CAUSE_NO_OUTPUT, "No output");
|
||||
else {
|
||||
RESOURCE->settings = m_monitor->imageDescription;
|
||||
RESOURCE->settings = m_monitor->m_imageDescription;
|
||||
RESOURCE->m_resource->sendReady(RESOURCE->settings.updateId());
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe
|
|||
requested = request->requested;
|
||||
|
||||
for (auto const& m : requested) {
|
||||
if (!m->monitor || m->monitor->isBeingLeased) {
|
||||
LOGM(ERR, "Rejecting lease: no monitor or monitor is being leased for {}", (m->monitor ? m->monitor->szName : "null"));
|
||||
if (!m->monitor || m->monitor->m_isBeingLeased) {
|
||||
LOGM(ERR, "Rejecting lease: no monitor or monitor is being leased for {}", (m->monitor ? m->monitor->m_name : "null"));
|
||||
resource->sendFinished();
|
||||
return;
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe
|
|||
LOGM(LOG, "Leasing outputs: {}", [this]() {
|
||||
std::string roll;
|
||||
for (auto const& o : requested) {
|
||||
roll += std::format("{} ", o->monitor->szName);
|
||||
roll += std::format("{} ", o->monitor->m_name);
|
||||
}
|
||||
return roll;
|
||||
}());
|
||||
|
|
@ -39,7 +39,7 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe
|
|||
outputs.reserve(requested.size());
|
||||
|
||||
for (auto const& m : requested) {
|
||||
outputs.emplace_back(m->monitor->output);
|
||||
outputs.emplace_back(m->monitor->m_output);
|
||||
}
|
||||
|
||||
auto aqlease = Aquamarine::CDRMLease::create(outputs);
|
||||
|
|
@ -52,13 +52,13 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe
|
|||
lease = aqlease;
|
||||
|
||||
for (auto const& m : requested) {
|
||||
m->monitor->isBeingLeased = true;
|
||||
m->monitor->m_isBeingLeased = true;
|
||||
}
|
||||
|
||||
listeners.destroyLease = lease->events.destroy.registerListener([this](std::any d) {
|
||||
for (auto const& m : requested) {
|
||||
if (m && m->monitor)
|
||||
m->monitor->isBeingLeased = false;
|
||||
m->monitor->m_isBeingLeased = false;
|
||||
}
|
||||
|
||||
resource->sendFinished();
|
||||
|
|
@ -143,7 +143,7 @@ CDRMLeaseConnectorResource::CDRMLeaseConnectorResource(SP<CWpDrmLeaseConnectorV1
|
|||
|
||||
resource->setData(this);
|
||||
|
||||
listeners.destroyMonitor = monitor->events.destroy.registerListener([this](std::any d) {
|
||||
listeners.destroyMonitor = monitor->m_events.destroy.registerListener([this](std::any d) {
|
||||
resource->sendWithdrawn();
|
||||
dead = true;
|
||||
});
|
||||
|
|
@ -154,10 +154,10 @@ bool CDRMLeaseConnectorResource::good() {
|
|||
}
|
||||
|
||||
void CDRMLeaseConnectorResource::sendData() {
|
||||
resource->sendName(monitor->szName.c_str());
|
||||
resource->sendDescription(monitor->szDescription.c_str());
|
||||
resource->sendName(monitor->m_name.c_str());
|
||||
resource->sendDescription(monitor->m_description.c_str());
|
||||
|
||||
auto AQDRMOutput = (Aquamarine::CDRMOutput*)monitor->output.get();
|
||||
auto AQDRMOutput = (Aquamarine::CDRMOutput*)monitor->m_output.get();
|
||||
resource->sendConnectorId(AQDRMOutput->getConnectorID());
|
||||
|
||||
resource->sendDone();
|
||||
|
|
@ -220,7 +220,7 @@ void CDRMLeaseDeviceResource::sendConnector(PHLMONITOR monitor) {
|
|||
RESOURCE->parent = self;
|
||||
RESOURCE->self = RESOURCE;
|
||||
|
||||
LOGM(LOG, "Sending new connector {}", monitor->szName);
|
||||
LOGM(LOG, "Sending new connector {}", monitor->m_name);
|
||||
|
||||
connectorsSent.emplace_back(RESOURCE);
|
||||
PROTO::lease->m_vConnectors.emplace_back(RESOURCE);
|
||||
|
|
@ -297,11 +297,11 @@ void CDRMLeaseProtocol::offer(PHLMONITOR monitor) {
|
|||
if (std::find(primaryDevice->offeredOutputs.begin(), primaryDevice->offeredOutputs.end(), monitor) != primaryDevice->offeredOutputs.end())
|
||||
return;
|
||||
|
||||
if (monitor->output->getBackend()->type() != Aquamarine::AQ_BACKEND_DRM)
|
||||
if (monitor->m_output->getBackend()->type() != Aquamarine::AQ_BACKEND_DRM)
|
||||
return;
|
||||
|
||||
if (monitor->output->getBackend() != primaryDevice->backend) {
|
||||
LOGM(ERR, "Monitor {} cannot be leased: primaryDevice lease is for a different device", monitor->szName);
|
||||
if (monitor->m_output->getBackend() != primaryDevice->backend) {
|
||||
LOGM(ERR, "Monitor {} cannot be leased: primaryDevice lease is for a different device", monitor->m_name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHand
|
|||
if (!wpMonitor.expired()) {
|
||||
const auto monitor = wpMonitor.lock();
|
||||
|
||||
if (PWINDOW->m_workspace != monitor->activeWorkspace) {
|
||||
g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, monitor->activeWorkspace);
|
||||
if (PWINDOW->m_workspace != monitor->m_activeWorkspace) {
|
||||
g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, monitor->m_activeWorkspace);
|
||||
g_pCompositor->setActiveMonitor(monitor);
|
||||
}
|
||||
}
|
||||
|
|
@ -145,26 +145,26 @@ wl_resource* CForeignToplevelHandleWlr::res() {
|
|||
}
|
||||
|
||||
void CForeignToplevelHandleWlr::sendMonitor(PHLMONITOR pMonitor) {
|
||||
if (lastMonitorID == pMonitor->ID)
|
||||
if (lastMonitorID == pMonitor->m_id)
|
||||
return;
|
||||
|
||||
const auto CLIENT = resource->client();
|
||||
|
||||
if (const auto PLASTMONITOR = g_pCompositor->getMonitorFromID(lastMonitorID); PLASTMONITOR && PROTO::outputs.contains(PLASTMONITOR->szName)) {
|
||||
const auto OLDRESOURCE = PROTO::outputs.at(PLASTMONITOR->szName)->outputResourceFrom(CLIENT);
|
||||
if (const auto PLASTMONITOR = g_pCompositor->getMonitorFromID(lastMonitorID); PLASTMONITOR && PROTO::outputs.contains(PLASTMONITOR->m_name)) {
|
||||
const auto OLDRESOURCE = PROTO::outputs.at(PLASTMONITOR->m_name)->outputResourceFrom(CLIENT);
|
||||
|
||||
if LIKELY (OLDRESOURCE)
|
||||
resource->sendOutputLeave(OLDRESOURCE->getResource()->resource());
|
||||
}
|
||||
|
||||
if (PROTO::outputs.contains(pMonitor->szName)) {
|
||||
const auto NEWRESOURCE = PROTO::outputs.at(pMonitor->szName)->outputResourceFrom(CLIENT);
|
||||
if (PROTO::outputs.contains(pMonitor->m_name)) {
|
||||
const auto NEWRESOURCE = PROTO::outputs.at(pMonitor->m_name)->outputResourceFrom(CLIENT);
|
||||
|
||||
if LIKELY (NEWRESOURCE)
|
||||
resource->sendOutputEnter(NEWRESOURCE->getResource()->resource());
|
||||
}
|
||||
|
||||
lastMonitorID = pMonitor->ID;
|
||||
lastMonitorID = pMonitor->m_id;
|
||||
}
|
||||
|
||||
void CForeignToplevelHandleWlr::sendState() {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
|
|||
|
||||
pMonitor = OUTPUTRES->monitor;
|
||||
|
||||
if UNLIKELY (!pMonitor || !pMonitor->output) {
|
||||
if UNLIKELY (!pMonitor || !pMonitor->m_output) {
|
||||
LOGM(ERR, "No CMonitor");
|
||||
resource->sendFailed();
|
||||
return;
|
||||
|
|
@ -33,10 +33,10 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
|
|||
}
|
||||
}
|
||||
|
||||
gammaSize = pMonitor->output->getGammaSize();
|
||||
gammaSize = pMonitor->m_output->getGammaSize();
|
||||
|
||||
if UNLIKELY (gammaSize <= 0) {
|
||||
LOGM(ERR, "Output {} doesn't support gamma", pMonitor->szName);
|
||||
LOGM(ERR, "Output {} doesn't support gamma", pMonitor->m_name);
|
||||
resource->sendFailed();
|
||||
return;
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
|
|||
return;
|
||||
}
|
||||
|
||||
LOGM(LOG, "setGamma for {}", pMonitor->szName);
|
||||
LOGM(LOG, "setGamma for {}", pMonitor->m_name);
|
||||
|
||||
// TODO: make CFileDescriptor getflags use F_GETFL
|
||||
int fdFlags = fcntl(gammaFd.get(), F_GETFL, 0);
|
||||
|
|
@ -108,16 +108,16 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
|
|||
|
||||
resource->sendGammaSize(gammaSize);
|
||||
|
||||
listeners.monitorDestroy = pMonitor->events.destroy.registerListener([this](std::any) { this->onMonitorDestroy(); });
|
||||
listeners.monitorDisconnect = pMonitor->events.disconnect.registerListener([this](std::any) { this->onMonitorDestroy(); });
|
||||
listeners.monitorDestroy = pMonitor->m_events.destroy.registerListener([this](std::any) { this->onMonitorDestroy(); });
|
||||
listeners.monitorDisconnect = pMonitor->m_events.disconnect.registerListener([this](std::any) { this->onMonitorDestroy(); });
|
||||
}
|
||||
|
||||
CGammaControl::~CGammaControl() {
|
||||
if (!gammaTableSet || !pMonitor || !pMonitor->output)
|
||||
if (!gammaTableSet || !pMonitor || !pMonitor->m_output)
|
||||
return;
|
||||
|
||||
// reset the LUT if the client dies for whatever reason and doesn't unset the gamma
|
||||
pMonitor->output->state->setGammaLut({});
|
||||
pMonitor->m_output->state->setGammaLut({});
|
||||
}
|
||||
|
||||
bool CGammaControl::good() {
|
||||
|
|
@ -125,21 +125,21 @@ bool CGammaControl::good() {
|
|||
}
|
||||
|
||||
void CGammaControl::applyToMonitor() {
|
||||
if UNLIKELY (!pMonitor || !pMonitor->output)
|
||||
if UNLIKELY (!pMonitor || !pMonitor->m_output)
|
||||
return; // ??
|
||||
|
||||
LOGM(LOG, "setting to monitor {}", pMonitor->szName);
|
||||
LOGM(LOG, "setting to monitor {}", pMonitor->m_name);
|
||||
|
||||
if (!gammaTableSet) {
|
||||
pMonitor->output->state->setGammaLut({});
|
||||
pMonitor->m_output->state->setGammaLut({});
|
||||
return;
|
||||
}
|
||||
|
||||
pMonitor->output->state->setGammaLut(gammaTable);
|
||||
pMonitor->m_output->state->setGammaLut(gammaTable);
|
||||
|
||||
if (!pMonitor->state.test()) {
|
||||
LOGM(LOG, "setting to monitor {} failed", pMonitor->szName);
|
||||
pMonitor->output->state->setGammaLut({});
|
||||
if (!pMonitor->m_state.test()) {
|
||||
LOGM(LOG, "setting to monitor {} failed", pMonitor->m_name);
|
||||
pMonitor->m_output->state->setGammaLut({});
|
||||
}
|
||||
|
||||
g_pHyprRenderer->damageMonitor(pMonitor.lock());
|
||||
|
|
@ -150,7 +150,7 @@ PHLMONITOR CGammaControl::getMonitor() {
|
|||
}
|
||||
|
||||
void CGammaControl::onMonitorDestroy() {
|
||||
LOGM(LOG, "Destroying gamma control for {}", pMonitor->szName);
|
||||
LOGM(LOG, "Destroying gamma control for {}", pMonitor->m_name);
|
||||
resource->sendFailed();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ CLayerShellResource::CLayerShellResource(SP<CZwlrLayerSurfaceV1> resource_, SP<C
|
|||
return;
|
||||
|
||||
current.layer = layer;
|
||||
monitor = pMonitor ? pMonitor->szName : "";
|
||||
monitor = pMonitor ? pMonitor->m_name : "";
|
||||
|
||||
resource->setDestroy([this](CZwlrLayerSurfaceV1* r) {
|
||||
events.destroy.emit();
|
||||
|
|
|
|||
|
|
@ -436,7 +436,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
|
|||
auto tranche = SDMABUFTranche{
|
||||
.device = mainDevice,
|
||||
.flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT,
|
||||
.formats = mon->output->getRenderFormats(),
|
||||
.formats = mon->m_output->getRenderFormats(),
|
||||
};
|
||||
tches.emplace_back(std::make_pair<>(mon, tranche));
|
||||
}
|
||||
|
|
@ -446,7 +446,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
|
|||
auto tranche = SDMABUFTranche{
|
||||
.device = mainDevice,
|
||||
.flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT,
|
||||
.formats = pMonitor->output->getRenderFormats(),
|
||||
.formats = pMonitor->m_output->getRenderFormats(),
|
||||
};
|
||||
formatTable->monitorTranches.emplace_back(std::make_pair<>(pMonitor, tranche));
|
||||
resetFormatTable();
|
||||
|
|
@ -500,7 +500,7 @@ void CLinuxDMABufV1Protocol::resetFormatTable() {
|
|||
auto HLSurface = CWLSurface::fromResource(feedback->surface);
|
||||
if (auto w = HLSurface->getWindow(); w)
|
||||
if (auto m = w->m_monitor.lock(); m)
|
||||
mon = m->self.lock();
|
||||
mon = m->m_self.lock();
|
||||
|
||||
if (!mon) {
|
||||
feedback->sendDefaultFeedback();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ COutputManager::COutputManager(SP<CZwlrOutputManagerV1> resource_) : resource(re
|
|||
if (m == g_pCompositor->m_unsafeOutput)
|
||||
continue;
|
||||
|
||||
LOGM(LOG, " | sending output head for {}", m->szName);
|
||||
LOGM(LOG, " | sending output head for {}", m->m_name);
|
||||
|
||||
makeAndSendNewHead(m);
|
||||
}
|
||||
|
|
@ -96,7 +96,7 @@ COutputHead::COutputHead(SP<CZwlrOutputHeadV1> resource_, PHLMONITOR pMonitor_)
|
|||
resource->setRelease([this](CZwlrOutputHeadV1* r) { PROTO::outputManagement->destroyResource(this); });
|
||||
resource->setOnDestroy([this](CZwlrOutputHeadV1* r) { PROTO::outputManagement->destroyResource(this); });
|
||||
|
||||
listeners.monitorDestroy = pMonitor->events.destroy.registerListener([this](std::any d) {
|
||||
listeners.monitorDestroy = pMonitor->m_events.destroy.registerListener([this](std::any d) {
|
||||
resource->sendFinished();
|
||||
|
||||
for (auto const& mw : modes) {
|
||||
|
|
@ -114,7 +114,7 @@ COutputHead::COutputHead(SP<CZwlrOutputHeadV1> resource_, PHLMONITOR pMonitor_)
|
|||
}
|
||||
});
|
||||
|
||||
listeners.monitorModeChange = pMonitor->events.modeChanged.registerListener([this](std::any d) { updateMode(); });
|
||||
listeners.monitorModeChange = pMonitor->m_events.modeChanged.registerListener([this](std::any d) { updateMode(); });
|
||||
}
|
||||
|
||||
bool COutputHead::good() {
|
||||
|
|
@ -124,54 +124,54 @@ bool COutputHead::good() {
|
|||
void COutputHead::sendAllData() {
|
||||
const auto VERSION = resource->version();
|
||||
|
||||
resource->sendName(pMonitor->szName.c_str());
|
||||
resource->sendDescription(pMonitor->szDescription.c_str());
|
||||
if (pMonitor->output->physicalSize.x > 0 && pMonitor->output->physicalSize.y > 0)
|
||||
resource->sendPhysicalSize(pMonitor->output->physicalSize.x, pMonitor->output->physicalSize.y);
|
||||
resource->sendEnabled(pMonitor->m_bEnabled);
|
||||
resource->sendName(pMonitor->m_name.c_str());
|
||||
resource->sendDescription(pMonitor->m_description.c_str());
|
||||
if (pMonitor->m_output->physicalSize.x > 0 && pMonitor->m_output->physicalSize.y > 0)
|
||||
resource->sendPhysicalSize(pMonitor->m_output->physicalSize.x, pMonitor->m_output->physicalSize.y);
|
||||
resource->sendEnabled(pMonitor->m_enabled);
|
||||
|
||||
if (pMonitor->m_bEnabled) {
|
||||
resource->sendPosition(pMonitor->vecPosition.x, pMonitor->vecPosition.y);
|
||||
resource->sendTransform(pMonitor->transform);
|
||||
resource->sendScale(wl_fixed_from_double(pMonitor->scale));
|
||||
if (pMonitor->m_enabled) {
|
||||
resource->sendPosition(pMonitor->m_position.x, pMonitor->m_position.y);
|
||||
resource->sendTransform(pMonitor->m_transform);
|
||||
resource->sendScale(wl_fixed_from_double(pMonitor->m_scale));
|
||||
}
|
||||
|
||||
if (!pMonitor->output->make.empty() && VERSION >= 2)
|
||||
resource->sendMake(pMonitor->output->make.c_str());
|
||||
if (!pMonitor->output->model.empty() && VERSION >= 2)
|
||||
resource->sendModel(pMonitor->output->model.c_str());
|
||||
if (!pMonitor->output->serial.empty() && VERSION >= 2)
|
||||
resource->sendSerialNumber(pMonitor->output->serial.c_str());
|
||||
if (!pMonitor->m_output->make.empty() && VERSION >= 2)
|
||||
resource->sendMake(pMonitor->m_output->make.c_str());
|
||||
if (!pMonitor->m_output->model.empty() && VERSION >= 2)
|
||||
resource->sendModel(pMonitor->m_output->model.c_str());
|
||||
if (!pMonitor->m_output->serial.empty() && VERSION >= 2)
|
||||
resource->sendSerialNumber(pMonitor->m_output->serial.c_str());
|
||||
|
||||
if (VERSION >= 4)
|
||||
resource->sendAdaptiveSync(pMonitor->vrrActive ? ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_ENABLED : ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_DISABLED);
|
||||
resource->sendAdaptiveSync(pMonitor->m_vrrActive ? ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_ENABLED : ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_DISABLED);
|
||||
|
||||
// send all available modes
|
||||
|
||||
if (modes.empty()) {
|
||||
if (!pMonitor->output->modes.empty()) {
|
||||
for (auto const& m : pMonitor->output->modes) {
|
||||
if (!pMonitor->m_output->modes.empty()) {
|
||||
for (auto const& m : pMonitor->m_output->modes) {
|
||||
makeAndSendNewMode(m);
|
||||
}
|
||||
} else if (pMonitor->output->state->state().customMode) {
|
||||
makeAndSendNewMode(pMonitor->output->state->state().customMode);
|
||||
} else if (pMonitor->m_output->state->state().customMode) {
|
||||
makeAndSendNewMode(pMonitor->m_output->state->state().customMode);
|
||||
} else
|
||||
makeAndSendNewMode(nullptr);
|
||||
}
|
||||
|
||||
// send current mode
|
||||
if (pMonitor->m_bEnabled) {
|
||||
if (pMonitor->m_enabled) {
|
||||
for (auto const& mw : modes) {
|
||||
auto m = mw.lock();
|
||||
|
||||
if (!m)
|
||||
continue;
|
||||
|
||||
if (m->mode == pMonitor->output->state->state().mode) {
|
||||
if (m->mode == pMonitor->m_output->state->state().mode) {
|
||||
if (m->mode)
|
||||
LOGM(LOG, " | sending current mode for {}: {}x{}@{}", pMonitor->szName, m->mode->pixelSize.x, m->mode->pixelSize.y, m->mode->refreshRate);
|
||||
LOGM(LOG, " | sending current mode for {}: {}x{}@{}", pMonitor->m_name, m->mode->pixelSize.x, m->mode->pixelSize.y, m->mode->refreshRate);
|
||||
else
|
||||
LOGM(LOG, " | sending current mode for {}: null (fake)", pMonitor->szName);
|
||||
LOGM(LOG, " | sending current mode for {}: null (fake)", pMonitor->m_name);
|
||||
resource->sendCurrentMode(m->resource.get());
|
||||
break;
|
||||
}
|
||||
|
|
@ -180,29 +180,29 @@ void COutputHead::sendAllData() {
|
|||
}
|
||||
|
||||
void COutputHead::updateMode() {
|
||||
resource->sendEnabled(pMonitor->m_bEnabled);
|
||||
resource->sendEnabled(pMonitor->m_enabled);
|
||||
|
||||
if (pMonitor->m_bEnabled) {
|
||||
resource->sendPosition(pMonitor->vecPosition.x, pMonitor->vecPosition.y);
|
||||
resource->sendTransform(pMonitor->transform);
|
||||
resource->sendScale(wl_fixed_from_double(pMonitor->scale));
|
||||
if (pMonitor->m_enabled) {
|
||||
resource->sendPosition(pMonitor->m_position.x, pMonitor->m_position.y);
|
||||
resource->sendTransform(pMonitor->m_transform);
|
||||
resource->sendScale(wl_fixed_from_double(pMonitor->m_scale));
|
||||
}
|
||||
|
||||
if (resource->version() >= 4)
|
||||
resource->sendAdaptiveSync(pMonitor->vrrActive ? ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_ENABLED : ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_DISABLED);
|
||||
resource->sendAdaptiveSync(pMonitor->m_vrrActive ? ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_ENABLED : ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_DISABLED);
|
||||
|
||||
if (pMonitor->m_bEnabled) {
|
||||
if (pMonitor->m_enabled) {
|
||||
for (auto const& mw : modes) {
|
||||
auto m = mw.lock();
|
||||
|
||||
if (!m)
|
||||
continue;
|
||||
|
||||
if (m->mode == pMonitor->currentMode) {
|
||||
if (m->mode == pMonitor->m_currentMode) {
|
||||
if (m->mode)
|
||||
LOGM(LOG, " | sending current mode for {}: {}x{}@{}", pMonitor->szName, m->mode->pixelSize.x, m->mode->pixelSize.y, m->mode->refreshRate);
|
||||
LOGM(LOG, " | sending current mode for {}: {}x{}@{}", pMonitor->m_name, m->mode->pixelSize.x, m->mode->pixelSize.y, m->mode->refreshRate);
|
||||
else
|
||||
LOGM(LOG, " | sending current mode for {}: null (fake)", pMonitor->szName);
|
||||
LOGM(LOG, " | sending current mode for {}: null (fake)", pMonitor->m_name);
|
||||
resource->sendCurrentMode(m->resource.get());
|
||||
break;
|
||||
}
|
||||
|
|
@ -290,7 +290,7 @@ COutputConfiguration::COutputConfiguration(SP<CZwlrOutputConfigurationV1> resour
|
|||
|
||||
heads.emplace_back(RESOURCE);
|
||||
|
||||
LOGM(LOG, "enableHead on {}. For now, doing nothing. Waiting for apply().", PMONITOR->szName);
|
||||
LOGM(LOG, "enableHead on {}. For now, doing nothing. Waiting for apply().", PMONITOR->m_name);
|
||||
});
|
||||
|
||||
resource->setDisableHead([this](CZwlrOutputConfigurationV1* r, wl_resource* outputHead) {
|
||||
|
|
@ -308,17 +308,17 @@ COutputConfiguration::COutputConfiguration(SP<CZwlrOutputConfigurationV1> resour
|
|||
return;
|
||||
}
|
||||
|
||||
LOGM(LOG, "disableHead on {}", PMONITOR->szName);
|
||||
LOGM(LOG, "disableHead on {}", PMONITOR->m_name);
|
||||
|
||||
SWlrManagerSavedOutputState newState;
|
||||
if (owner->monitorStates.contains(PMONITOR->szName))
|
||||
newState = owner->monitorStates.at(PMONITOR->szName);
|
||||
if (owner->monitorStates.contains(PMONITOR->m_name))
|
||||
newState = owner->monitorStates.at(PMONITOR->m_name);
|
||||
|
||||
newState.enabled = false;
|
||||
|
||||
g_pConfigManager->m_wantsMonitorReload = true;
|
||||
|
||||
owner->monitorStates[PMONITOR->szName] = newState;
|
||||
owner->monitorStates[PMONITOR->m_name] = newState;
|
||||
});
|
||||
|
||||
resource->setTest([this](CZwlrOutputConfigurationV1* r) {
|
||||
|
|
@ -370,11 +370,11 @@ bool COutputConfiguration::applyTestConfiguration(bool test) {
|
|||
if (!PMONITOR)
|
||||
continue;
|
||||
|
||||
LOGM(LOG, "Saving config for monitor {}", PMONITOR->szName);
|
||||
LOGM(LOG, "Saving config for monitor {}", PMONITOR->m_name);
|
||||
|
||||
SWlrManagerSavedOutputState newState;
|
||||
if (owner->monitorStates.contains(PMONITOR->szName))
|
||||
newState = owner->monitorStates.at(PMONITOR->szName);
|
||||
if (owner->monitorStates.contains(PMONITOR->m_name))
|
||||
newState = owner->monitorStates.at(PMONITOR->m_name);
|
||||
|
||||
newState.enabled = true;
|
||||
|
||||
|
|
@ -419,7 +419,7 @@ bool COutputConfiguration::applyTestConfiguration(bool test) {
|
|||
|
||||
g_pConfigManager->m_wantsMonitorReload = true;
|
||||
|
||||
owner->monitorStates[PMONITOR->szName] = newState;
|
||||
owner->monitorStates[PMONITOR->m_name] = newState;
|
||||
}
|
||||
|
||||
LOGM(LOG, "Saved configuration");
|
||||
|
|
@ -454,7 +454,7 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe
|
|||
state.committedProperties |= OUTPUT_HEAD_COMMITTED_MODE;
|
||||
state.mode = MODE;
|
||||
|
||||
LOGM(LOG, " | configHead for {}: set mode to {}x{}@{}", pMonitor->szName, MODE->getMode()->pixelSize.x, MODE->getMode()->pixelSize.y, MODE->getMode()->refreshRate);
|
||||
LOGM(LOG, " | configHead for {}: set mode to {}x{}@{}", pMonitor->m_name, MODE->getMode()->pixelSize.x, MODE->getMode()->pixelSize.y, MODE->getMode()->refreshRate);
|
||||
});
|
||||
|
||||
resource->setSetCustomMode([this](CZwlrOutputConfigurationHeadV1* r, int32_t w, int32_t h, int32_t refresh) {
|
||||
|
|
@ -474,14 +474,14 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe
|
|||
}
|
||||
|
||||
if (refresh == 0) {
|
||||
LOGM(LOG, " | configHead for {}: refreshRate 0, using old refresh rate of {:.2f}Hz", pMonitor->szName, pMonitor->refreshRate);
|
||||
refresh = std::round(pMonitor->refreshRate * 1000.F);
|
||||
LOGM(LOG, " | configHead for {}: refreshRate 0, using old refresh rate of {:.2f}Hz", pMonitor->m_name, pMonitor->m_refreshRate);
|
||||
refresh = std::round(pMonitor->m_refreshRate * 1000.F);
|
||||
}
|
||||
|
||||
state.committedProperties |= OUTPUT_HEAD_COMMITTED_CUSTOM_MODE;
|
||||
state.customMode = {{w, h}, (uint32_t)refresh};
|
||||
|
||||
LOGM(LOG, " | configHead for {}: set custom mode to {}x{}@{}", pMonitor->szName, w, h, refresh);
|
||||
LOGM(LOG, " | configHead for {}: set custom mode to {}x{}@{}", pMonitor->m_name, w, h, refresh);
|
||||
});
|
||||
|
||||
resource->setSetPosition([this](CZwlrOutputConfigurationHeadV1* r, int32_t x, int32_t y) {
|
||||
|
|
@ -498,7 +498,7 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe
|
|||
state.committedProperties |= OUTPUT_HEAD_COMMITTED_POSITION;
|
||||
state.position = {x, y};
|
||||
|
||||
LOGM(LOG, " | configHead for {}: set pos to {}, {}", pMonitor->szName, x, y);
|
||||
LOGM(LOG, " | configHead for {}: set pos to {}, {}", pMonitor->m_name, x, y);
|
||||
});
|
||||
|
||||
resource->setSetTransform([this](CZwlrOutputConfigurationHeadV1* r, int32_t transform) {
|
||||
|
|
@ -520,7 +520,7 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe
|
|||
state.committedProperties |= OUTPUT_HEAD_COMMITTED_TRANSFORM;
|
||||
state.transform = (wl_output_transform)transform;
|
||||
|
||||
LOGM(LOG, " | configHead for {}: set transform to {}", pMonitor->szName, transform);
|
||||
LOGM(LOG, " | configHead for {}: set transform to {}", pMonitor->m_name, transform);
|
||||
});
|
||||
|
||||
resource->setSetScale([this](CZwlrOutputConfigurationHeadV1* r, wl_fixed_t scale_) {
|
||||
|
|
@ -544,7 +544,7 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe
|
|||
state.committedProperties |= OUTPUT_HEAD_COMMITTED_SCALE;
|
||||
state.scale = scale;
|
||||
|
||||
LOGM(LOG, " | configHead for {}: set scale to {:.2f}", pMonitor->szName, scale);
|
||||
LOGM(LOG, " | configHead for {}: set scale to {:.2f}", pMonitor->m_name, scale);
|
||||
});
|
||||
|
||||
resource->setSetAdaptiveSync([this](CZwlrOutputConfigurationHeadV1* r, uint32_t as) {
|
||||
|
|
@ -566,7 +566,7 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe
|
|||
state.committedProperties |= OUTPUT_HEAD_COMMITTED_ADAPTIVE_SYNC;
|
||||
state.adaptiveSync = as;
|
||||
|
||||
LOGM(LOG, " | configHead for {}: set adaptiveSync to {}", pMonitor->szName, as);
|
||||
LOGM(LOG, " | configHead for {}: set adaptiveSync to {}", pMonitor->m_name, as);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -638,10 +638,10 @@ SP<COutputMode> COutputManagementProtocol::modeFromResource(wl_resource* r) {
|
|||
|
||||
SP<SWlrManagerSavedOutputState> COutputManagementProtocol::getOutputStateFor(PHLMONITOR pMonitor) {
|
||||
for (auto const& m : m_vManagers) {
|
||||
if (!m->monitorStates.contains(pMonitor->szName))
|
||||
if (!m->monitorStates.contains(pMonitor->m_name))
|
||||
continue;
|
||||
|
||||
return makeShared<SWlrManagerSavedOutputState>(m->monitorStates.at(pMonitor->szName));
|
||||
return makeShared<SWlrManagerSavedOutputState>(m->monitorStates.at(pMonitor->m_name));
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
|
|
|||
|
|
@ -13,25 +13,25 @@ COutputPower::COutputPower(SP<CZwlrOutputPowerV1> resource_, PHLMONITOR pMonitor
|
|||
if (!pMonitor)
|
||||
return;
|
||||
|
||||
pMonitor->dpmsStatus = mode == ZWLR_OUTPUT_POWER_V1_MODE_ON;
|
||||
pMonitor->m_dpmsStatus = mode == ZWLR_OUTPUT_POWER_V1_MODE_ON;
|
||||
|
||||
pMonitor->output->state->setEnabled(mode == ZWLR_OUTPUT_POWER_V1_MODE_ON);
|
||||
pMonitor->m_output->state->setEnabled(mode == ZWLR_OUTPUT_POWER_V1_MODE_ON);
|
||||
|
||||
if (!pMonitor->state.commit())
|
||||
LOGM(ERR, "Couldn't set dpms to {} for {}", pMonitor->dpmsStatus, pMonitor->szName);
|
||||
if (!pMonitor->m_state.commit())
|
||||
LOGM(ERR, "Couldn't set dpms to {} for {}", pMonitor->m_dpmsStatus, pMonitor->m_name);
|
||||
});
|
||||
|
||||
resource->sendMode(pMonitor->dpmsStatus ? ZWLR_OUTPUT_POWER_V1_MODE_ON : ZWLR_OUTPUT_POWER_V1_MODE_OFF);
|
||||
resource->sendMode(pMonitor->m_dpmsStatus ? ZWLR_OUTPUT_POWER_V1_MODE_ON : ZWLR_OUTPUT_POWER_V1_MODE_OFF);
|
||||
|
||||
listeners.monitorDestroy = pMonitor->events.destroy.registerListener([this](std::any v) {
|
||||
listeners.monitorDestroy = pMonitor->m_events.destroy.registerListener([this](std::any v) {
|
||||
pMonitor.reset();
|
||||
resource->sendFailed();
|
||||
});
|
||||
|
||||
listeners.monitorDpms = pMonitor->events.dpmsChanged.registerListener(
|
||||
[this](std::any v) { resource->sendMode(pMonitor->dpmsStatus ? ZWLR_OUTPUT_POWER_V1_MODE_ON : ZWLR_OUTPUT_POWER_V1_MODE_OFF); });
|
||||
listeners.monitorState = pMonitor->events.modeChanged.registerListener(
|
||||
[this](std::any v) { resource->sendMode(pMonitor->dpmsStatus ? ZWLR_OUTPUT_POWER_V1_MODE_ON : ZWLR_OUTPUT_POWER_V1_MODE_OFF); });
|
||||
listeners.monitorDpms = pMonitor->m_events.dpmsChanged.registerListener(
|
||||
[this](std::any v) { resource->sendMode(pMonitor->m_dpmsStatus ? ZWLR_OUTPUT_POWER_V1_MODE_ON : ZWLR_OUTPUT_POWER_V1_MODE_OFF); });
|
||||
listeners.monitorState = pMonitor->m_events.modeChanged.registerListener(
|
||||
[this](std::any v) { resource->sendMode(pMonitor->m_dpmsStatus ? ZWLR_OUTPUT_POWER_V1_MODE_ON : ZWLR_OUTPUT_POWER_V1_MODE_OFF); });
|
||||
}
|
||||
|
||||
bool COutputPower::good() {
|
||||
|
|
|
|||
|
|
@ -43,13 +43,13 @@ bool CPresentationFeedback::good() {
|
|||
void CPresentationFeedback::sendQueued(SP<CQueuedPresentationData> data, const Time::steady_tp& when, uint32_t untilRefreshNs, uint64_t seq, uint32_t reportedFlags) {
|
||||
auto client = resource->client();
|
||||
|
||||
if LIKELY (PROTO::outputs.contains(data->pMonitor->szName)) {
|
||||
if LIKELY (auto outputResource = PROTO::outputs.at(data->pMonitor->szName)->outputResourceFrom(client); outputResource)
|
||||
if LIKELY (PROTO::outputs.contains(data->pMonitor->m_name)) {
|
||||
if LIKELY (auto outputResource = PROTO::outputs.at(data->pMonitor->m_name)->outputResourceFrom(client); outputResource)
|
||||
resource->sendSyncOutput(outputResource->getResource()->resource());
|
||||
}
|
||||
|
||||
uint32_t flags = 0;
|
||||
if (!data->pMonitor->tearingState.activelyTearing)
|
||||
if (!data->pMonitor->m_tearingState.activelyTearing)
|
||||
flags |= WP_PRESENTATION_FEEDBACK_KIND_VSYNC;
|
||||
if (data->zeroCopy)
|
||||
flags |= WP_PRESENTATION_FEEDBACK_KIND_ZERO_COPY;
|
||||
|
|
|
|||
|
|
@ -58,15 +58,15 @@ CScreencopyFrame::CScreencopyFrame(SP<CZwlrScreencopyFrameV1> resource_, int32_t
|
|||
return;
|
||||
}
|
||||
|
||||
dmabufFormat = pMonitor->output->state->state().drmFormat;
|
||||
dmabufFormat = pMonitor->m_output->state->state().drmFormat;
|
||||
|
||||
if (box_.width == 0 && box_.height == 0)
|
||||
box = {0, 0, (int)(pMonitor->vecSize.x), (int)(pMonitor->vecSize.y)};
|
||||
box = {0, 0, (int)(pMonitor->m_size.x), (int)(pMonitor->m_size.y)};
|
||||
else {
|
||||
box = box_;
|
||||
}
|
||||
|
||||
box.transform(wlTransformToHyprutils(pMonitor->transform), pMonitor->vecTransformedSize.x, pMonitor->vecTransformedSize.y).scale(pMonitor->scale).round();
|
||||
box.transform(wlTransformToHyprutils(pMonitor->m_transform), pMonitor->m_transformedSize.x, pMonitor->m_transformedSize.y).scale(pMonitor->m_scale).round();
|
||||
|
||||
shmStride = NFormatUtils::minStride(PSHMINFO, box.w);
|
||||
|
||||
|
|
@ -189,7 +189,7 @@ void CScreencopyFrame::share() {
|
|||
|
||||
void CScreencopyFrame::copyDmabuf(std::function<void(bool)> callback) {
|
||||
const auto PERM = g_pDynamicPermissionManager->clientPermissionMode(resource->client(), PERMISSION_TYPE_SCREENCOPY);
|
||||
auto TEXTURE = makeShared<CTexture>(pMonitor->output->state->state().buffer);
|
||||
auto TEXTURE = makeShared<CTexture>(pMonitor->m_output->state->state().buffer);
|
||||
|
||||
CRegion fakeDamage = {0, 0, INT16_MAX, INT16_MAX};
|
||||
|
||||
|
|
@ -200,9 +200,9 @@ void CScreencopyFrame::copyDmabuf(std::function<void(bool)> callback) {
|
|||
}
|
||||
|
||||
if (PERM == PERMISSION_RULE_ALLOW_MODE_ALLOW) {
|
||||
CBox monbox = CBox{0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y}
|
||||
CBox monbox = CBox{0, 0, pMonitor->m_pixelSize.x, pMonitor->m_pixelSize.y}
|
||||
.translate({-box.x, -box.y}) // vvvv kinda ass-backwards but that's how I designed the renderer... sigh.
|
||||
.transform(wlTransformToHyprutils(invertTransform(pMonitor->transform)), pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y);
|
||||
.transform(wlTransformToHyprutils(invertTransform(pMonitor->m_transform)), pMonitor->m_pixelSize.x, pMonitor->m_pixelSize.y);
|
||||
g_pHyprOpenGL->setMonitorTransformEnabled(true);
|
||||
g_pHyprOpenGL->setRenderModifEnabled(false);
|
||||
g_pHyprOpenGL->renderTexture(TEXTURE, monbox, 1);
|
||||
|
|
@ -210,13 +210,13 @@ void CScreencopyFrame::copyDmabuf(std::function<void(bool)> callback) {
|
|||
g_pHyprOpenGL->setMonitorTransformEnabled(false);
|
||||
if (overlayCursor)
|
||||
g_pPointerManager->renderSoftwareCursorsFor(pMonitor.lock(), Time::steadyNow(), fakeDamage,
|
||||
g_pInputManager->getMouseCoordsInternal() - pMonitor->vecPosition - box.pos(), true);
|
||||
g_pInputManager->getMouseCoordsInternal() - pMonitor->m_position - box.pos(), true);
|
||||
} else if (PERM == PERMISSION_RULE_ALLOW_MODE_PENDING)
|
||||
g_pHyprOpenGL->clear(Colors::BLACK);
|
||||
else {
|
||||
g_pHyprOpenGL->clear(Colors::BLACK);
|
||||
CBox texbox =
|
||||
CBox{pMonitor->vecTransformedSize / 2.F, g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize}.translate(-g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize / 2.F);
|
||||
CBox{pMonitor->m_transformedSize / 2.F, g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize}.translate(-g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize / 2.F);
|
||||
g_pHyprOpenGL->renderTexture(g_pHyprOpenGL->m_pScreencopyDeniedTexture, texbox, 1);
|
||||
}
|
||||
|
||||
|
|
@ -230,7 +230,7 @@ void CScreencopyFrame::copyDmabuf(std::function<void(bool)> callback) {
|
|||
|
||||
bool CScreencopyFrame::copyShm() {
|
||||
const auto PERM = g_pDynamicPermissionManager->clientPermissionMode(resource->client(), PERMISSION_TYPE_SCREENCOPY);
|
||||
auto TEXTURE = makeShared<CTexture>(pMonitor->output->state->state().buffer);
|
||||
auto TEXTURE = makeShared<CTexture>(pMonitor->m_output->state->state().buffer);
|
||||
|
||||
auto shm = buffer->shm();
|
||||
auto [pixelData, fmt, bufLen] = buffer->beginDataPtr(0); // no need for end, cuz it's shm
|
||||
|
|
@ -240,7 +240,7 @@ bool CScreencopyFrame::copyShm() {
|
|||
g_pHyprRenderer->makeEGLCurrent();
|
||||
|
||||
CFramebuffer fb;
|
||||
fb.alloc(box.w, box.h, pMonitor->output->state->state().drmFormat);
|
||||
fb.alloc(box.w, box.h, pMonitor->m_output->state->state().drmFormat);
|
||||
|
||||
if (!g_pHyprRenderer->beginRender(pMonitor.lock(), fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, &fb, true)) {
|
||||
LOGM(ERR, "Can't copy: failed to begin rendering");
|
||||
|
|
@ -248,7 +248,7 @@ bool CScreencopyFrame::copyShm() {
|
|||
}
|
||||
|
||||
if (PERM == PERMISSION_RULE_ALLOW_MODE_ALLOW) {
|
||||
CBox monbox = CBox{0, 0, pMonitor->vecTransformedSize.x, pMonitor->vecTransformedSize.y}.translate({-box.x, -box.y});
|
||||
CBox monbox = CBox{0, 0, pMonitor->m_transformedSize.x, pMonitor->m_transformedSize.y}.translate({-box.x, -box.y});
|
||||
g_pHyprOpenGL->setMonitorTransformEnabled(true);
|
||||
g_pHyprOpenGL->setRenderModifEnabled(false);
|
||||
g_pHyprOpenGL->renderTexture(TEXTURE, monbox, 1);
|
||||
|
|
@ -256,13 +256,13 @@ bool CScreencopyFrame::copyShm() {
|
|||
g_pHyprOpenGL->setMonitorTransformEnabled(false);
|
||||
if (overlayCursor)
|
||||
g_pPointerManager->renderSoftwareCursorsFor(pMonitor.lock(), Time::steadyNow(), fakeDamage,
|
||||
g_pInputManager->getMouseCoordsInternal() - pMonitor->vecPosition - box.pos(), true);
|
||||
g_pInputManager->getMouseCoordsInternal() - pMonitor->m_position - box.pos(), true);
|
||||
} else if (PERM == PERMISSION_RULE_ALLOW_MODE_PENDING)
|
||||
g_pHyprOpenGL->clear(Colors::BLACK);
|
||||
else {
|
||||
g_pHyprOpenGL->clear(Colors::BLACK);
|
||||
CBox texbox =
|
||||
CBox{pMonitor->vecTransformedSize / 2.F, g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize}.translate(-g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize / 2.F);
|
||||
CBox{pMonitor->m_transformedSize / 2.F, g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize}.translate(-g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize / 2.F);
|
||||
g_pHyprOpenGL->renderTexture(g_pHyprOpenGL->m_pScreencopyDeniedTexture, texbox, 1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,11 +56,11 @@ CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_,
|
|||
pSurface.reset();
|
||||
});
|
||||
|
||||
PROTO::fractional->sendScale(surface_, pMonitor_->scale);
|
||||
PROTO::fractional->sendScale(surface_, pMonitor_->m_scale);
|
||||
|
||||
sendConfigure();
|
||||
|
||||
listeners.monitorMode = pMonitor->events.modeChanged.registerListener([this](std::any data) { sendConfigure(); });
|
||||
listeners.monitorMode = pMonitor->m_events.modeChanged.registerListener([this](std::any data) { sendConfigure(); });
|
||||
}
|
||||
|
||||
CSessionLockSurface::~CSessionLockSurface() {
|
||||
|
|
@ -73,7 +73,7 @@ CSessionLockSurface::~CSessionLockSurface() {
|
|||
|
||||
void CSessionLockSurface::sendConfigure() {
|
||||
const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->seatResourceForClient(resource->client()));
|
||||
resource->sendConfigure(SERIAL, pMonitor->vecSize.x, pMonitor->vecSize.y);
|
||||
resource->sendConfigure(SERIAL, pMonitor->m_size.x, pMonitor->m_size.y);
|
||||
}
|
||||
|
||||
bool CSessionLockSurface::good() {
|
||||
|
|
|
|||
|
|
@ -114,11 +114,11 @@ CToplevelExportFrame::CToplevelExportFrame(SP<CHyprlandToplevelExportFrameV1> re
|
|||
return;
|
||||
}
|
||||
|
||||
dmabufFormat = PMONITOR->output->state->state().drmFormat;
|
||||
dmabufFormat = PMONITOR->m_output->state->state().drmFormat;
|
||||
|
||||
box = {0, 0, (int)(pWindow->m_realSize->value().x * PMONITOR->scale), (int)(pWindow->m_realSize->value().y * PMONITOR->scale)};
|
||||
box = {0, 0, (int)(pWindow->m_realSize->value().x * PMONITOR->m_scale), (int)(pWindow->m_realSize->value().y * PMONITOR->m_scale)};
|
||||
|
||||
box.transform(wlTransformToHyprutils(PMONITOR->transform), PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y).round();
|
||||
box.transform(wlTransformToHyprutils(PMONITOR->m_transform), PMONITOR->m_transformedSize.x, PMONITOR->m_transformedSize.y).round();
|
||||
|
||||
shmStride = NFormatUtils::minStride(PSHMINFO, box.w);
|
||||
|
||||
|
|
@ -236,18 +236,18 @@ bool CToplevelExportFrame::copyShm(const Time::steady_tp& now) {
|
|||
|
||||
// render the client
|
||||
const auto PMONITOR = pWindow->m_monitor.lock();
|
||||
CRegion fakeDamage{0, 0, PMONITOR->vecPixelSize.x * 10, PMONITOR->vecPixelSize.y * 10};
|
||||
CRegion fakeDamage{0, 0, PMONITOR->m_pixelSize.x * 10, PMONITOR->m_pixelSize.y * 10};
|
||||
|
||||
g_pHyprRenderer->makeEGLCurrent();
|
||||
|
||||
CFramebuffer outFB;
|
||||
outFB.alloc(PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y, PMONITOR->output->state->state().drmFormat);
|
||||
outFB.alloc(PMONITOR->m_pixelSize.x, PMONITOR->m_pixelSize.y, PMONITOR->m_output->state->state().drmFormat);
|
||||
|
||||
auto overlayCursor = shouldOverlayCursor();
|
||||
|
||||
if (overlayCursor) {
|
||||
g_pPointerManager->lockSoftwareForMonitor(PMONITOR->self.lock());
|
||||
g_pPointerManager->damageCursor(PMONITOR->self.lock());
|
||||
g_pPointerManager->lockSoftwareForMonitor(PMONITOR->m_self.lock());
|
||||
g_pPointerManager->damageCursor(PMONITOR->m_self.lock());
|
||||
}
|
||||
|
||||
if (!g_pHyprRenderer->beginRender(PMONITOR, fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, &outFB))
|
||||
|
|
@ -262,10 +262,10 @@ bool CToplevelExportFrame::copyShm(const Time::steady_tp& now) {
|
|||
g_pHyprRenderer->m_bBlockSurfaceFeedback = false;
|
||||
|
||||
if (overlayCursor)
|
||||
g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_realPosition->value());
|
||||
g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->m_self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_realPosition->value());
|
||||
} else if (PERM == PERMISSION_RULE_ALLOW_MODE_DENY) {
|
||||
CBox texbox =
|
||||
CBox{PMONITOR->vecTransformedSize / 2.F, g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize}.translate(-g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize / 2.F);
|
||||
CBox{PMONITOR->m_transformedSize / 2.F, g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize}.translate(-g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize / 2.F);
|
||||
g_pHyprOpenGL->renderTexture(g_pHyprOpenGL->m_pScreencopyDeniedTexture, texbox, 1);
|
||||
}
|
||||
|
||||
|
|
@ -291,21 +291,21 @@ bool CToplevelExportFrame::copyShm(const Time::steady_tp& now) {
|
|||
auto glFormat = PFORMAT->flipRB ? GL_BGRA_EXT : GL_RGBA;
|
||||
|
||||
auto origin = Vector2D(0, 0);
|
||||
switch (PMONITOR->transform) {
|
||||
switch (PMONITOR->m_transform) {
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
||||
case WL_OUTPUT_TRANSFORM_90: {
|
||||
origin.y = PMONITOR->vecPixelSize.y - box.height;
|
||||
origin.y = PMONITOR->m_pixelSize.y - box.height;
|
||||
break;
|
||||
}
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||
case WL_OUTPUT_TRANSFORM_180: {
|
||||
origin.x = PMONITOR->vecPixelSize.x - box.width;
|
||||
origin.y = PMONITOR->vecPixelSize.y - box.height;
|
||||
origin.x = PMONITOR->m_pixelSize.x - box.width;
|
||||
origin.y = PMONITOR->m_pixelSize.y - box.height;
|
||||
break;
|
||||
}
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED:
|
||||
case WL_OUTPUT_TRANSFORM_270: {
|
||||
origin.x = PMONITOR->vecPixelSize.x - box.width;
|
||||
origin.x = PMONITOR->m_pixelSize.x - box.width;
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
|
|
@ -314,8 +314,8 @@ bool CToplevelExportFrame::copyShm(const Time::steady_tp& now) {
|
|||
glReadPixels(origin.x, origin.y, box.width, box.height, glFormat, PFORMAT->glType, pixelData);
|
||||
|
||||
if (overlayCursor) {
|
||||
g_pPointerManager->unlockSoftwareForMonitor(PMONITOR->self.lock());
|
||||
g_pPointerManager->damageCursor(PMONITOR->self.lock());
|
||||
g_pPointerManager->unlockSoftwareForMonitor(PMONITOR->m_self.lock());
|
||||
g_pPointerManager->damageCursor(PMONITOR->m_self.lock());
|
||||
}
|
||||
|
||||
outFB.unbind();
|
||||
|
|
@ -336,8 +336,8 @@ bool CToplevelExportFrame::copyDmabuf(const Time::steady_tp& now) {
|
|||
auto overlayCursor = shouldOverlayCursor();
|
||||
|
||||
if (overlayCursor) {
|
||||
g_pPointerManager->lockSoftwareForMonitor(PMONITOR->self.lock());
|
||||
g_pPointerManager->damageCursor(PMONITOR->self.lock());
|
||||
g_pPointerManager->lockSoftwareForMonitor(PMONITOR->m_self.lock());
|
||||
g_pPointerManager->damageCursor(PMONITOR->m_self.lock());
|
||||
}
|
||||
|
||||
if (!g_pHyprRenderer->beginRender(PMONITOR, fakeDamage, RENDER_MODE_TO_BUFFER, buffer.buffer))
|
||||
|
|
@ -350,10 +350,10 @@ bool CToplevelExportFrame::copyDmabuf(const Time::steady_tp& now) {
|
|||
g_pHyprRenderer->m_bBlockSurfaceFeedback = false;
|
||||
|
||||
if (overlayCursor)
|
||||
g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_realPosition->value());
|
||||
g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->m_self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_realPosition->value());
|
||||
} else if (PERM == PERMISSION_RULE_ALLOW_MODE_DENY) {
|
||||
CBox texbox =
|
||||
CBox{PMONITOR->vecTransformedSize / 2.F, g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize}.translate(-g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize / 2.F);
|
||||
CBox{PMONITOR->m_transformedSize / 2.F, g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize}.translate(-g_pHyprOpenGL->m_pScreencopyDeniedTexture->m_vSize / 2.F);
|
||||
g_pHyprOpenGL->renderTexture(g_pHyprOpenGL->m_pScreencopyDeniedTexture, texbox, 1);
|
||||
}
|
||||
|
||||
|
|
@ -361,8 +361,8 @@ bool CToplevelExportFrame::copyDmabuf(const Time::steady_tp& now) {
|
|||
g_pHyprRenderer->endRender();
|
||||
|
||||
if (overlayCursor) {
|
||||
g_pPointerManager->unlockSoftwareForMonitor(PMONITOR->self.lock());
|
||||
g_pPointerManager->damageCursor(PMONITOR->self.lock());
|
||||
g_pPointerManager->unlockSoftwareForMonitor(PMONITOR->m_self.lock());
|
||||
g_pPointerManager->damageCursor(PMONITOR->m_self.lock());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -450,7 +450,7 @@ void CToplevelExportProtocol::onOutputCommit(PHLMONITOR pMonitor) {
|
|||
|
||||
CBox geometry = {PWINDOW->m_realPosition->value().x, PWINDOW->m_realPosition->value().y, PWINDOW->m_realSize->value().x, PWINDOW->m_realSize->value().y};
|
||||
|
||||
if (geometry.intersection({pMonitor->vecPosition, pMonitor->vecSize}).empty())
|
||||
if (geometry.intersection({pMonitor->m_position, pMonitor->m_size}).empty())
|
||||
continue;
|
||||
|
||||
f->share();
|
||||
|
|
|
|||
|
|
@ -65,14 +65,14 @@ void CXDGOutputProtocol::onManagerGetXDGOutput(CZxdgOutputManagerV1* mgr, uint32
|
|||
return;
|
||||
}
|
||||
|
||||
LOGM(LOG, "New xdg_output for {}: client {:x} ({})", PMONITOR->szName, (uintptr_t)CLIENT, pXDGOutput->isXWayland ? "xwayland" : "not xwayland");
|
||||
LOGM(LOG, "New xdg_output for {}: client {:x} ({})", PMONITOR->m_name, (uintptr_t)CLIENT, pXDGOutput->isXWayland ? "xwayland" : "not xwayland");
|
||||
|
||||
const auto XDGVER = pXDGOutput->resource->version();
|
||||
|
||||
if (XDGVER >= OUTPUT_NAME_SINCE_VERSION)
|
||||
pXDGOutput->resource->sendName(PMONITOR->szName.c_str());
|
||||
if (XDGVER >= OUTPUT_DESCRIPTION_SINCE_VERSION && !PMONITOR->output->description.empty())
|
||||
pXDGOutput->resource->sendDescription(PMONITOR->output->description.c_str());
|
||||
pXDGOutput->resource->sendName(PMONITOR->m_name.c_str());
|
||||
if (XDGVER >= OUTPUT_DESCRIPTION_SINCE_VERSION && !PMONITOR->m_output->description.empty())
|
||||
pXDGOutput->resource->sendDescription(PMONITOR->m_output->description.c_str());
|
||||
|
||||
pXDGOutput->sendDetails();
|
||||
|
||||
|
|
@ -110,13 +110,13 @@ void CXDGOutput::sendDetails() {
|
|||
if UNLIKELY (!monitor || !outputProto || outputProto->isDefunct())
|
||||
return;
|
||||
|
||||
const auto POS = isXWayland ? monitor->vecXWaylandPosition : monitor->vecPosition;
|
||||
const auto POS = isXWayland ? monitor->m_xwaylandPosition : monitor->m_position;
|
||||
resource->sendLogicalPosition(POS.x, POS.y);
|
||||
|
||||
if (*PXWLFORCESCALEZERO && isXWayland)
|
||||
resource->sendLogicalSize(monitor->vecTransformedSize.x, monitor->vecTransformedSize.y);
|
||||
resource->sendLogicalSize(monitor->m_transformedSize.x, monitor->m_transformedSize.y);
|
||||
else
|
||||
resource->sendLogicalSize(monitor->vecSize.x, monitor->vecSize.y);
|
||||
resource->sendLogicalSize(monitor->m_size.x, monitor->m_size.y);
|
||||
|
||||
if (resource->version() < OUTPUT_DONE_DEPRECATED_SINCE_VERSION)
|
||||
resource->sendDone();
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ CXDGToplevelResource::CXDGToplevelResource(SP<CXdgToplevel> resource_, SP<CXDGSu
|
|||
resource->setSetFullscreen([this](CXdgToplevel* r, wl_resource* output) {
|
||||
if (output)
|
||||
if (const auto PM = CWLOutputResource::fromResource(output)->monitor; PM)
|
||||
state.requestsFullscreenMonitor = PM->ID;
|
||||
state.requestsFullscreenMonitor = PM->m_id;
|
||||
|
||||
state.requestsFullscreen = true;
|
||||
events.stateChanged.emit();
|
||||
|
|
|
|||
|
|
@ -271,21 +271,21 @@ void CWLSurfaceResource::enter(PHLMONITOR monitor) {
|
|||
if (std::find(enteredOutputs.begin(), enteredOutputs.end(), monitor) != enteredOutputs.end())
|
||||
return;
|
||||
|
||||
if UNLIKELY (!PROTO::outputs.contains(monitor->szName)) {
|
||||
if UNLIKELY (!PROTO::outputs.contains(monitor->m_name)) {
|
||||
// can happen on unplug/replug
|
||||
LOGM(ERR, "enter() called on a non-existent output global");
|
||||
return;
|
||||
}
|
||||
|
||||
if UNLIKELY (PROTO::outputs.at(monitor->szName)->isDefunct()) {
|
||||
if UNLIKELY (PROTO::outputs.at(monitor->m_name)->isDefunct()) {
|
||||
LOGM(ERR, "enter() called on a defunct output global");
|
||||
return;
|
||||
}
|
||||
|
||||
auto output = PROTO::outputs.at(monitor->szName)->outputResourceFrom(pClient);
|
||||
auto output = PROTO::outputs.at(monitor->m_name)->outputResourceFrom(pClient);
|
||||
|
||||
if UNLIKELY (!output || !output->getResource() || !output->getResource()->resource()) {
|
||||
LOGM(ERR, "Cannot enter surface {:x} to {}, client hasn't bound the output", (uintptr_t)this, monitor->szName);
|
||||
LOGM(ERR, "Cannot enter surface {:x} to {}, client hasn't bound the output", (uintptr_t)this, monitor->m_name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -298,10 +298,10 @@ void CWLSurfaceResource::leave(PHLMONITOR monitor) {
|
|||
if UNLIKELY (std::find(enteredOutputs.begin(), enteredOutputs.end(), monitor) == enteredOutputs.end())
|
||||
return;
|
||||
|
||||
auto output = PROTO::outputs.at(monitor->szName)->outputResourceFrom(pClient);
|
||||
auto output = PROTO::outputs.at(monitor->m_name)->outputResourceFrom(pClient);
|
||||
|
||||
if UNLIKELY (!output) {
|
||||
LOGM(ERR, "Cannot leave surface {:x} from {}, client hasn't bound the output", (uintptr_t)this, monitor->szName);
|
||||
LOGM(ERR, "Cannot leave surface {:x} from {}, client hasn't bound the output", (uintptr_t)this, monitor->m_name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -809,7 +809,7 @@ void CWLDataDeviceProtocol::renderDND(PHLMONITOR pMonitor, const Time::steady_tp
|
|||
|
||||
surfacePos += dnd.dndSurface->current.offset;
|
||||
|
||||
CBox box = CBox{surfacePos, dnd.dndSurface->current.size}.translate(-pMonitor->vecPosition).scale(pMonitor->scale);
|
||||
CBox box = CBox{surfacePos, dnd.dndSurface->current.size}.translate(-pMonitor->m_position).scale(pMonitor->m_scale);
|
||||
|
||||
CTexPassElement::SRenderData data;
|
||||
data.tex = dnd.dndSurface->current.texture;
|
||||
|
|
|
|||
|
|
@ -15,17 +15,17 @@ CWLOutputResource::CWLOutputResource(SP<CWlOutput> resource_, PHLMONITOR pMonito
|
|||
return;
|
||||
|
||||
resource->setOnDestroy([this](CWlOutput* r) {
|
||||
if (monitor && PROTO::outputs.contains(monitor->szName))
|
||||
PROTO::outputs.at(monitor->szName)->destroyResource(this);
|
||||
if (monitor && PROTO::outputs.contains(monitor->m_name))
|
||||
PROTO::outputs.at(monitor->m_name)->destroyResource(this);
|
||||
});
|
||||
resource->setRelease([this](CWlOutput* r) {
|
||||
if (monitor && PROTO::outputs.contains(monitor->szName))
|
||||
PROTO::outputs.at(monitor->szName)->destroyResource(this);
|
||||
if (monitor && PROTO::outputs.contains(monitor->m_name))
|
||||
PROTO::outputs.at(monitor->m_name)->destroyResource(this);
|
||||
});
|
||||
|
||||
if (resource->version() >= 4) {
|
||||
resource->sendName(monitor->szName.c_str());
|
||||
resource->sendDescription(monitor->szDescription.c_str());
|
||||
resource->sendName(monitor->m_name.c_str());
|
||||
resource->sendDescription(monitor->m_description.c_str());
|
||||
}
|
||||
|
||||
updateState();
|
||||
|
|
@ -72,21 +72,21 @@ void CWLOutputResource::updateState() {
|
|||
return;
|
||||
|
||||
if (resource->version() >= 2)
|
||||
resource->sendScale(std::ceil(monitor->scale));
|
||||
resource->sendScale(std::ceil(monitor->m_scale));
|
||||
|
||||
resource->sendMode((wl_output_mode)(WL_OUTPUT_MODE_CURRENT), monitor->vecPixelSize.x, monitor->vecPixelSize.y, monitor->refreshRate * 1000.0);
|
||||
resource->sendMode((wl_output_mode)(WL_OUTPUT_MODE_CURRENT), monitor->m_pixelSize.x, monitor->m_pixelSize.y, monitor->m_refreshRate * 1000.0);
|
||||
|
||||
resource->sendGeometry(0, 0, monitor->output->physicalSize.x, monitor->output->physicalSize.y, (wl_output_subpixel)monitor->output->subpixel, monitor->output->make.c_str(),
|
||||
monitor->output->model.c_str(), monitor->transform);
|
||||
resource->sendGeometry(0, 0, monitor->m_output->physicalSize.x, monitor->m_output->physicalSize.y, (wl_output_subpixel)monitor->m_output->subpixel,
|
||||
monitor->m_output->make.c_str(), monitor->m_output->model.c_str(), monitor->m_transform);
|
||||
|
||||
if (resource->version() >= 2)
|
||||
resource->sendDone();
|
||||
}
|
||||
|
||||
CWLOutputProtocol::CWLOutputProtocol(const wl_interface* iface, const int& ver, const std::string& name, PHLMONITOR pMonitor) :
|
||||
IWaylandProtocol(iface, ver, name), monitor(pMonitor), szName(pMonitor->szName) {
|
||||
IWaylandProtocol(iface, ver, name), monitor(pMonitor), szName(pMonitor->m_name) {
|
||||
|
||||
listeners.modeChanged = monitor->events.modeChanged.registerListener([this](std::any d) {
|
||||
listeners.modeChanged = monitor->m_events.modeChanged.registerListener([this](std::any d) {
|
||||
for (auto const& o : m_vOutputs) {
|
||||
o->updateState();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue