diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2025-12-18 17:23:24 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-18 17:23:24 +0000 |
| commit | 6175ecd4c4ba817c4620f66a75e1e11da7c7a8ca (patch) | |
| tree | cf73852f1fc08b1dcee5a3a7380f914aaad9c50a /src/protocols | |
| parent | f88deb928a0f7dc02f427473f8c29e8f2bed14a3 (diff) | |
debug: move to hyprutils' logger (#12673)
Diffstat (limited to 'src/protocols')
56 files changed, 427 insertions, 425 deletions
diff --git a/src/protocols/AlphaModifier.cpp b/src/protocols/AlphaModifier.cpp index 167abe53..a4ebc635 100644 --- a/src/protocols/AlphaModifier.cpp +++ b/src/protocols/AlphaModifier.cpp @@ -85,7 +85,7 @@ void CAlphaModifierProtocol::getSurface(CWpAlphaModifierV1* manager, uint32_t id if (iter != m_alphaModifiers.end()) { if (iter->second->m_resource) { - LOGM(ERR, "AlphaModifier already present for surface {:x}", (uintptr_t)surface.get()); + LOGM(Log::ERR, "AlphaModifier already present for surface {:x}", (uintptr_t)surface.get()); manager->error(WP_ALPHA_MODIFIER_V1_ERROR_ALREADY_CONSTRUCTED, "AlphaModifier already present"); return; } else { diff --git a/src/protocols/CTMControl.cpp b/src/protocols/CTMControl.cpp index 9c241942..f94792dc 100644 --- a/src/protocols/CTMControl.cpp +++ b/src/protocols/CTMControl.cpp @@ -42,14 +42,14 @@ CHyprlandCTMControlResource::CHyprlandCTMControlResource(UP<CHyprlandCtmControlM m_ctms[PMONITOR->m_name] = MAT; - LOGM(LOG, "CTM set for output {}: {}", PMONITOR->m_name, m_ctms.at(PMONITOR->m_name).toString()); + LOGM(Log::DEBUG, "CTM set for output {}: {}", PMONITOR->m_name, m_ctms.at(PMONITOR->m_name).toString()); }); m_resource->setCommit([this](CHyprlandCtmControlManagerV1* r) { if (m_blocked) return; - LOGM(LOG, "Committing ctms to outputs"); + LOGM(Log::DEBUG, "Committing ctms to outputs"); for (auto& m : g_pCompositor->m_monitors) { if (!m_ctms.contains(m->m_name)) { @@ -100,7 +100,7 @@ void CHyprlandCTMControlProtocol::bindManager(wl_client* client, void* data, uin else m_manager = RESOURCE; - LOGM(LOG, "New CTM Manager at 0x{:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New CTM Manager at 0x{:x}", (uintptr_t)RESOURCE.get()); } void CHyprlandCTMControlProtocol::destroyResource(CHyprlandCTMControlResource* res) { diff --git a/src/protocols/ColorManagement.cpp b/src/protocols/ColorManagement.cpp index 408ade4d..4215a5e7 100644 --- a/src/protocols/ColorManagement.cpp +++ b/src/protocols/ColorManagement.cpp @@ -62,9 +62,9 @@ CColorManager::CColorManager(SP<CWpColorManagerV1> resource) : m_resource(resour m_resource->sendSupportedIntent(WP_COLOR_MANAGER_V1_RENDER_INTENT_RELATIVE_BPC); } - m_resource->setDestroy([](CWpColorManagerV1* r) { LOGM(TRACE, "Destroy WP_color_manager at {:x} (generated default)", (uintptr_t)r); }); + m_resource->setDestroy([](CWpColorManagerV1* r) { LOGM(Log::TRACE, "Destroy WP_color_manager at {:x} (generated default)", (uintptr_t)r); }); m_resource->setGetOutput([](CWpColorManagerV1* r, uint32_t id, wl_resource* output) { - LOGM(TRACE, "Get output for id={}, output={}", id, (uintptr_t)output); + LOGM(Log::TRACE, "Get output for id={}, output={}", id, (uintptr_t)output); const auto OUTPUTRESOURCE = CWLOutputResource::fromResource(output); @@ -80,11 +80,11 @@ CColorManager::CColorManager(SP<CWpColorManagerV1> resource) : m_resource(resour RESOURCE->m_self = RESOURCE; }); m_resource->setGetSurface([](CWpColorManagerV1* r, uint32_t id, wl_resource* surface) { - LOGM(TRACE, "Get surface for id={}, surface={}", id, (uintptr_t)surface); + LOGM(Log::TRACE, "Get surface for id={}, surface={}", id, (uintptr_t)surface); auto SURF = CWLSurfaceResource::fromResource(surface); if (!SURF) { - LOGM(ERR, "No surface for resource {}", (uintptr_t)surface); + LOGM(Log::ERR, "No surface for resource {}", (uintptr_t)surface); r->error(-1, "Invalid surface (2)"); return; } @@ -107,11 +107,11 @@ CColorManager::CColorManager(SP<CWpColorManagerV1> resource) : m_resource(resour SURF->m_colorManagement = RESOURCE; }); m_resource->setGetSurfaceFeedback([](CWpColorManagerV1* r, uint32_t id, wl_resource* surface) { - LOGM(TRACE, "Get feedback surface for id={}, surface={}", id, (uintptr_t)surface); + LOGM(Log::TRACE, "Get feedback surface for id={}, surface={}", id, (uintptr_t)surface); auto SURF = CWLSurfaceResource::fromResource(surface); if (!SURF) { - LOGM(ERR, "No surface for resource {}", (uintptr_t)surface); + LOGM(Log::ERR, "No surface for resource {}", (uintptr_t)surface); r->error(-1, "Invalid surface (2)"); return; } @@ -128,7 +128,7 @@ CColorManager::CColorManager(SP<CWpColorManagerV1> resource) : m_resource(resour RESOURCE->m_self = RESOURCE; }); m_resource->setCreateIccCreator([](CWpColorManagerV1* r, uint32_t id) { - LOGM(WARN, "New ICC creator for id={} (unsupported)", id); + LOGM(Log::WARN, "New ICC creator for id={} (unsupported)", id); if (!PROTO::colorManagement->m_debug) { r->error(WP_COLOR_MANAGER_V1_ERROR_UNSUPPORTED_FEATURE, "ICC profiles are not supported"); return; @@ -146,7 +146,7 @@ CColorManager::CColorManager(SP<CWpColorManagerV1> resource) : m_resource(resour RESOURCE->m_self = RESOURCE; }); m_resource->setCreateParametricCreator([](CWpColorManagerV1* r, uint32_t id) { - LOGM(TRACE, "New parametric creator for id={}", id); + LOGM(Log::TRACE, "New parametric creator for id={}", id); const auto RESOURCE = PROTO::colorManagement->m_parametricCreators.emplace_back( makeShared<CColorManagementParametricCreator>(makeShared<CWpImageDescriptionCreatorParamsV1>(r->client(), r->version(), id))); @@ -160,7 +160,7 @@ CColorManager::CColorManager(SP<CWpColorManagerV1> resource) : m_resource(resour RESOURCE->m_self = RESOURCE; }); m_resource->setCreateWindowsScrgb([](CWpColorManagerV1* r, uint32_t id) { - LOGM(WARN, "New Windows scRGB description id={}", id); + LOGM(Log::WARN, "New Windows scRGB description id={}", id); const auto RESOURCE = PROTO::colorManagement->m_imageDescriptions.emplace_back( makeShared<CColorManagementImageDescription>(makeShared<CWpImageDescriptionV1>(r->client(), r->version(), id), false)); @@ -204,7 +204,7 @@ CColorManagementOutput::CColorManagementOutput(SP<CWpColorManagementOutputV1> re m_resource->setOnDestroy([this](CWpColorManagementOutputV1* r) { PROTO::colorManagement->destroyResource(this); }); m_resource->setGetImageDescription([this](CWpColorManagementOutputV1* r, uint32_t id) { - LOGM(TRACE, "Get image description for output={}, id={}", (uintptr_t)r, id); + LOGM(Log::TRACE, "Get image description for output={}, id={}", (uintptr_t)r, id); if (m_imageDescription.valid()) PROTO::colorManagement->destroyResource(m_imageDescription.get()); @@ -247,16 +247,16 @@ CColorManagementSurface::CColorManagementSurface(SP<CWpColorManagementSurfaceV1> m_client = m_resource->client(); m_resource->setDestroy([this](CWpColorManagementSurfaceV1* r) { - LOGM(TRACE, "Destroy wp cm surface {}", (uintptr_t)m_surface); + LOGM(Log::TRACE, "Destroy wp cm surface {}", (uintptr_t)m_surface); PROTO::colorManagement->destroyResource(this); }); m_resource->setOnDestroy([this](CWpColorManagementSurfaceV1* r) { - LOGM(TRACE, "Destroy wp cm surface {}", (uintptr_t)m_surface); + LOGM(Log::TRACE, "Destroy wp cm surface {}", (uintptr_t)m_surface); PROTO::colorManagement->destroyResource(this); }); m_resource->setSetImageDescription([this](CWpColorManagementSurfaceV1* r, wl_resource* image_description, uint32_t render_intent) { - LOGM(TRACE, "Set image description for surface={}, desc={}, intent={}", (uintptr_t)r, (uintptr_t)image_description, render_intent); + LOGM(Log::TRACE, "Set image description for surface={}, desc={}, intent={}", (uintptr_t)r, (uintptr_t)image_description, render_intent); const auto PO = sc<CWpImageDescriptionV1*>(wl_resource_get_user_data(image_description)); if (!PO) { // FIXME check validity @@ -279,7 +279,7 @@ CColorManagementSurface::CColorManagementSurface(SP<CWpColorManagementSurfaceV1> m_imageDescription = imageDescription->get()->m_settings; }); m_resource->setUnsetImageDescription([this](CWpColorManagementSurfaceV1* r) { - LOGM(TRACE, "Unset image description for surface={}", (uintptr_t)r); + LOGM(Log::TRACE, "Unset image description for surface={}", (uintptr_t)r); m_imageDescription = SImageDescription{}; setHasImageDescription(false); }); @@ -295,7 +295,7 @@ wl_client* CColorManagementSurface::client() { const SImageDescription& CColorManagementSurface::imageDescription() { if (!hasImageDescription()) - LOGM(WARN, "Reading imageDescription while none set. Returns default or empty values"); + LOGM(Log::WARN, "Reading imageDescription while none set. Returns default or empty values"); return m_imageDescription; } @@ -344,16 +344,16 @@ CColorManagementFeedbackSurface::CColorManagementFeedbackSurface(SP<CWpColorMana m_client = m_resource->client(); m_resource->setDestroy([this](CWpColorManagementSurfaceFeedbackV1* r) { - LOGM(TRACE, "Destroy wp cm feedback surface {}", (uintptr_t)m_surface); + LOGM(Log::TRACE, "Destroy wp cm feedback surface {}", (uintptr_t)m_surface); PROTO::colorManagement->destroyResource(this); }); m_resource->setOnDestroy([this](CWpColorManagementSurfaceFeedbackV1* r) { - LOGM(TRACE, "Destroy wp cm feedback surface {}", (uintptr_t)m_surface); + LOGM(Log::TRACE, "Destroy wp cm feedback surface {}", (uintptr_t)m_surface); PROTO::colorManagement->destroyResource(this); }); m_resource->setGetPreferred([this](CWpColorManagementSurfaceFeedbackV1* r, uint32_t id) { - LOGM(TRACE, "Get preferred for id {}", id); + LOGM(Log::TRACE, "Get preferred for id {}", id); if (m_surface.expired()) { r->error(WP_COLOR_MANAGEMENT_SURFACE_FEEDBACK_V1_ERROR_INERT, "Surface is inert"); @@ -376,7 +376,7 @@ CColorManagementFeedbackSurface::CColorManagementFeedbackSurface(SP<CWpColorMana }); m_resource->setGetPreferredParametric([this](CWpColorManagementSurfaceFeedbackV1* r, uint32_t id) { - LOGM(TRACE, "Get preferred for id {}", id); + LOGM(Log::TRACE, "Get preferred for id {}", id); if (m_surface.expired()) { r->error(WP_COLOR_MANAGEMENT_SURFACE_FEEDBACK_V1_ERROR_INERT, "Surface is inert"); @@ -397,7 +397,7 @@ CColorManagementFeedbackSurface::CColorManagementFeedbackSurface(SP<CWpColorMana m_currentPreferredId = RESOURCE->m_settings.updateId(); if (!PROTO::colorManagement->m_debug && RESOURCE->m_settings.icc.fd >= 0) { - LOGM(ERR, "FIXME: parse icc profile"); + LOGM(Log::ERR, "FIXME: parse icc profile"); r->error(WP_COLOR_MANAGER_V1_ERROR_UNSUPPORTED_FEATURE, "ICC profiles are not supported"); return; } @@ -434,7 +434,7 @@ CColorManagementIccCreator::CColorManagementIccCreator(SP<CWpImageDescriptionCre m_resource->setOnDestroy([this](CWpImageDescriptionCreatorIccV1* r) { PROTO::colorManagement->destroyResource(this); }); m_resource->setCreate([this](CWpImageDescriptionCreatorIccV1* r, uint32_t id) { - LOGM(TRACE, "Create image description from icc for id {}", id); + LOGM(Log::TRACE, "Create image description from icc for id {}", id); // FIXME actually check completeness if (m_settings.icc.fd < 0 || !m_settings.icc.length) { @@ -451,7 +451,7 @@ CColorManagementIccCreator::CColorManagementIccCreator(SP<CWpImageDescriptionCre return; } - LOGM(ERR, "FIXME: Parse icc file {}({},{}) for id {}", m_settings.icc.fd, m_settings.icc.offset, m_settings.icc.length, id); + LOGM(Log::ERR, "FIXME: Parse icc file {}({},{}) for id {}", m_settings.icc.fd, m_settings.icc.offset, m_settings.icc.length, id); // FIXME actually check support if (m_settings.icc.fd < 0 || !m_settings.icc.length) { @@ -490,7 +490,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage m_resource->setOnDestroy([this](CWpImageDescriptionCreatorParamsV1* r) { PROTO::colorManagement->destroyResource(this); }); m_resource->setCreate([this](CWpImageDescriptionCreatorParamsV1* r, uint32_t id) { - LOGM(TRACE, "Create image description from params for id {}", id); + LOGM(Log::TRACE, "Create image description from params for id {}", id); // FIXME actually check completeness if (!m_valuesSet) { @@ -520,7 +520,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage PROTO::colorManagement->destroyResource(this); }); m_resource->setSetTfNamed([this](CWpImageDescriptionCreatorParamsV1* r, uint32_t tf) { - LOGM(TRACE, "Set image description transfer function to {}", tf); + LOGM(Log::TRACE, "Set image description transfer function to {}", tf); if (m_valuesSet & PC_TF) { r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Transfer function already set"); return; @@ -547,7 +547,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage m_valuesSet |= PC_TF; }); m_resource->setSetTfPower([this](CWpImageDescriptionCreatorParamsV1* r, uint32_t eexp) { - LOGM(TRACE, "Set image description tf power to {}", eexp); + LOGM(Log::TRACE, "Set image description tf power to {}", eexp); if (m_valuesSet & PC_TF_POWER) { r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Transfer function power already set"); return; @@ -564,7 +564,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage m_valuesSet |= PC_TF_POWER; }); m_resource->setSetPrimariesNamed([this](CWpImageDescriptionCreatorParamsV1* r, uint32_t primaries) { - LOGM(TRACE, "Set image description primaries by name {}", primaries); + LOGM(Log::TRACE, "Set image description primaries by name {}", primaries); if (m_valuesSet & PC_PRIMARIES) { r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Primaries already set"); return; @@ -594,7 +594,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage }); m_resource->setSetPrimaries( [this](CWpImageDescriptionCreatorParamsV1* r, int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) { - LOGM(TRACE, "Set image description primaries by values r:{},{} g:{},{} b:{},{} w:{},{}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y); + LOGM(Log::TRACE, "Set image description primaries by values r:{},{} g:{},{} b:{},{} w:{},{}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y); if (m_valuesSet & PC_PRIMARIES) { r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Primaries already set"); return; @@ -608,7 +608,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage }); m_resource->setSetLuminances([this](CWpImageDescriptionCreatorParamsV1* r, uint32_t min_lum, uint32_t max_lum, uint32_t reference_lum) { auto min = min_lum / 10000.0f; - LOGM(TRACE, "Set image description luminances to {} - {} ({})", min, max_lum, reference_lum); + LOGM(Log::TRACE, "Set image description luminances to {} - {} ({})", min, max_lum, reference_lum); if (m_valuesSet & PC_LUMINANCES) { r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Luminances already set"); return; @@ -622,7 +622,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage }); m_resource->setSetMasteringDisplayPrimaries( [this](CWpImageDescriptionCreatorParamsV1* r, int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) { - LOGM(TRACE, "Set image description mastering primaries by values r:{},{} g:{},{} b:{},{} w:{},{}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y); + LOGM(Log::TRACE, "Set image description mastering primaries by values r:{},{} g:{},{} b:{},{} w:{},{}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y); if (m_valuesSet & PC_MASTERING_PRIMARIES) { r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Mastering primaries already set"); return; @@ -644,7 +644,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage }); m_resource->setSetMasteringLuminance([this](CWpImageDescriptionCreatorParamsV1* r, uint32_t min_lum, uint32_t max_lum) { auto min = min_lum / 10000.0f; - LOGM(TRACE, "Set image description mastering luminances to {} - {}", min, max_lum); + LOGM(Log::TRACE, "Set image description mastering luminances to {} - {}", min, max_lum); // if (valuesSet & PC_MASTERING_LUMINANCES) { // r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Mastering luminances already set"); // return; @@ -661,7 +661,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage m_valuesSet |= PC_MASTERING_LUMINANCES; }); m_resource->setSetMaxCll([this](CWpImageDescriptionCreatorParamsV1* r, uint32_t max_cll) { - LOGM(TRACE, "Set image description max content light level to {}", max_cll); + LOGM(Log::TRACE, "Set image description max content light level to {}", max_cll); // if (valuesSet & PC_CLL) { // r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Max CLL already set"); // return; @@ -670,7 +670,7 @@ CColorManagementParametricCreator::CColorManagementParametricCreator(SP<CWpImage m_valuesSet |= PC_CLL; }); m_resource->setSetMaxFall([this](CWpImageDescriptionCreatorParamsV1* r, uint32_t max_fall) { - LOGM(TRACE, "Set image description max frame-average light level to {}", max_fall); + LOGM(Log::TRACE, "Set image description max frame-average light level to {}", max_fall); // if (valuesSet & PC_FALL) { // r->error(WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET, "Max FALL already set"); // return; @@ -699,7 +699,7 @@ CColorManagementImageDescription::CColorManagementImageDescription(SP<CWpImageDe m_resource->setOnDestroy([this](CWpImageDescriptionV1* r) { PROTO::colorManagement->destroyResource(this); }); m_resource->setGetInformation([this](CWpImageDescriptionV1* r, uint32_t id) { - LOGM(TRACE, "Get image information for image={}, id={}", (uintptr_t)r, id); + LOGM(Log::TRACE, "Get image information for image={}, id={}", (uintptr_t)r, id); if (!m_allowGetInformation) { r->error(WP_IMAGE_DESCRIPTION_V1_ERROR_NO_INFORMATION, "Image descriptions doesn't allow get_information request"); return; @@ -782,7 +782,7 @@ void CColorManagementProtocol::bindManager(wl_client* client, void* data, uint32 return; } - LOGM(TRACE, "New WP_color_manager at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::TRACE, "New WP_color_manager at {:x}", (uintptr_t)RESOURCE.get()); } void CColorManagementProtocol::onImagePreferredChanged(uint32_t preferredId) { diff --git a/src/protocols/ContentType.cpp b/src/protocols/ContentType.cpp index c32f54a2..7c8fdbc3 100644 --- a/src/protocols/ContentType.cpp +++ b/src/protocols/ContentType.cpp @@ -10,11 +10,11 @@ CContentTypeManager::CContentTypeManager(SP<CWpContentTypeManagerV1> resource) : m_resource->setOnDestroy([this](CWpContentTypeManagerV1* r) { PROTO::contentType->destroyResource(this); }); m_resource->setGetSurfaceContentType([](CWpContentTypeManagerV1* r, uint32_t id, wl_resource* surface) { - LOGM(TRACE, "Get surface for id={}, surface={}", id, (uintptr_t)surface); + LOGM(Log::TRACE, "Get surface for id={}, surface={}", id, (uintptr_t)surface); auto SURF = CWLSurfaceResource::fromResource(surface); if (!SURF) { - LOGM(ERR, "No surface for resource {}", (uintptr_t)surface); + LOGM(Log::ERR, "No surface for resource {}", (uintptr_t)surface); r->error(-1, "Invalid surface (2)"); return; } diff --git a/src/protocols/DRMLease.cpp b/src/protocols/DRMLease.cpp index 260497d3..2da7b04a 100644 --- a/src/protocols/DRMLease.cpp +++ b/src/protocols/DRMLease.cpp @@ -27,7 +27,7 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe for (auto const& m : m_requested) { if (!m->m_monitor || m->m_monitor->m_isBeingLeased) { - LOGM(ERR, "Rejecting lease: no monitor or monitor is being leased for {}", (m->m_monitor ? m->m_monitor->m_name : "null")); + LOGM(Log::ERR, "Rejecting lease: no monitor or monitor is being leased for {}", (m->m_monitor ? m->m_monitor->m_name : "null")); m_resource->sendFinished(); return; } @@ -35,7 +35,7 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe // grant the lease if it is seemingly valid - LOGM(LOG, "Leasing outputs: {}", [this]() { + LOGM(Log::DEBUG, "Leasing outputs: {}", [this]() { std::string roll; for (auto const& o : m_requested) { roll += std::format("{} ", o->m_monitor->m_name); @@ -53,7 +53,7 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe auto aqlease = Aquamarine::CDRMLease::create(outputs); if (!aqlease) { - LOGM(ERR, "Rejecting lease: backend failed to alloc a lease"); + LOGM(Log::ERR, "Rejecting lease: backend failed to alloc a lease"); m_resource->sendFinished(); return; } @@ -71,10 +71,10 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe } m_resource->sendFinished(); - LOGM(LOG, "Revoking lease for fd {}", m_lease->leaseFD); + LOGM(Log::DEBUG, "Revoking lease for fd {}", m_lease->leaseFD); }); - LOGM(LOG, "Granting lease, sending fd {}", m_lease->leaseFD); + LOGM(Log::DEBUG, "Granting lease, sending fd {}", m_lease->leaseFD); m_resource->sendLeaseFd(m_lease->leaseFD); @@ -211,18 +211,18 @@ CDRMLeaseDeviceResource::CDRMLeaseDeviceResource(std::string deviceName_, SP<CWp PROTO::lease.at(m_deviceName)->m_requests.emplace_back(RESOURCE); - LOGM(LOG, "New lease request {}", id); + LOGM(Log::DEBUG, "New lease request {}", id); RESOURCE->m_parent = m_self; }); CFileDescriptor fd{PROTO::lease.at(m_deviceName)->m_backend.get()->getNonMasterFD()}; if (!fd.isValid()) { - LOGM(ERR, "Failed to dup fd in lease"); + LOGM(Log::ERR, "Failed to dup fd in lease"); return; } - LOGM(LOG, "Sending DRMFD {} to new lease device", fd.get()); + LOGM(Log::DEBUG, "Sending DRMFD {} to new lease device", fd.get()); m_resource->sendDrmFd(fd.get()); for (auto const& m : PROTO::lease.at(m_deviceName)->m_offeredOutputs) { @@ -250,7 +250,7 @@ void CDRMLeaseDeviceResource::sendConnector(PHLMONITOR monitor) { RESOURCE->m_parent = m_self; RESOURCE->m_self = RESOURCE; - LOGM(LOG, "Sending new connector {}", monitor->m_name); + LOGM(Log::DEBUG, "Sending new connector {}", monitor->m_name); m_connectorsSent.emplace_back(RESOURCE); PROTO::lease.at(m_deviceName)->m_connectors.emplace_back(RESOURCE); @@ -271,7 +271,7 @@ CDRMLeaseProtocol::CDRMLeaseProtocol(const wl_interface* iface, const int& ver, CFileDescriptor fd{m_backend->getNonMasterFD()}; if (!fd.isValid()) { - LOGM(ERR, "Failed to dup fd for drm node {}", m_deviceName); + LOGM(Log::ERR, "Failed to dup fd for drm node {}", m_deviceName); return; } @@ -318,7 +318,7 @@ void CDRMLeaseProtocol::offer(PHLMONITOR monitor) { return; if (monitor->m_output->getBackend() != m_backend) { - LOGM(ERR, "Monitor {} cannot be leased: lease is for a different device", monitor->m_name); + LOGM(Log::ERR, "Monitor {} cannot be leased: lease is for a different device", monitor->m_name); return; } diff --git a/src/protocols/DRMSyncobj.cpp b/src/protocols/DRMSyncobj.cpp index 40869c0d..821796d0 100644 --- a/src/protocols/DRMSyncobj.cpp +++ b/src/protocols/DRMSyncobj.cpp @@ -21,7 +21,7 @@ WP<CSyncTimeline> CDRMSyncPointState::timeline() { UP<CSyncReleaser> CDRMSyncPointState::createSyncRelease() { if (m_releaseTaken) - Debug::log(ERR, "CDRMSyncPointState: creating a sync releaser on an already created SyncRelease"); + Log::logger->log(Log::ERR, "CDRMSyncPointState: creating a sync releaser on an already created SyncRelease"); m_releaseTaken = true; return makeUnique<CSyncReleaser>(m_timeline, m_point); @@ -180,7 +180,7 @@ CDRMSyncobjManagerResource::CDRMSyncobjManagerResource(UP<CWpLinuxDrmSyncobjMana SURF->m_syncobj = RESOURCE; - LOGM(LOG, "New linux_syncobj at {:x} for surface {:x}", (uintptr_t)RESOURCE.get(), (uintptr_t)SURF.get()); + LOGM(Log::DEBUG, "New linux_syncobj at {:x} for surface {:x}", (uintptr_t)RESOURCE.get(), (uintptr_t)SURF.get()); }); m_resource->setImportTimeline([this](CWpLinuxDrmSyncobjManagerV1* r, uint32_t id, int32_t fd) { @@ -192,7 +192,7 @@ CDRMSyncobjManagerResource::CDRMSyncobjManagerResource(UP<CWpLinuxDrmSyncobjMana return; } - LOGM(LOG, "New linux_drm_timeline at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New linux_drm_timeline at {:x}", (uintptr_t)RESOURCE.get()); }); } @@ -206,11 +206,11 @@ CDRMSyncobjProtocol::CDRMSyncobjProtocol(const wl_interface* iface, const int& v else if (g_pCompositor->m_drm.syncobjSupport) m_drmFD = g_pCompositor->m_drm.fd; else { - LOGM(ERR, "CDRMSyncobjProtocol: no nodes support explicit sync?"); + LOGM(Log::ERR, "CDRMSyncobjProtocol: no nodes support explicit sync?"); return; } - LOGM(LOG, "CDRMSyncobjProtocol: using fd {}", m_drmFD); + LOGM(Log::DEBUG, "CDRMSyncobjProtocol: using fd {}", m_drmFD); } void CDRMSyncobjProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) { diff --git a/src/protocols/DataDeviceWlr.cpp b/src/protocols/DataDeviceWlr.cpp index 835fbc01..d29106e0 100644 --- a/src/protocols/DataDeviceWlr.cpp +++ b/src/protocols/DataDeviceWlr.cpp @@ -14,16 +14,16 @@ CWLRDataOffer::CWLRDataOffer(SP<CZwlrDataControlOfferV1> resource_, SP<IDataSour m_resource->setReceive([this](CZwlrDataControlOfferV1* r, const char* mime, int32_t fd) { CFileDescriptor sendFd{fd}; if (!m_source) { - LOGM(WARN, "Possible bug: Receive on an offer w/o a source"); + LOGM(Log::WARN, "Possible bug: Receive on an offer w/o a source"); return; } if (m_dead) { - LOGM(WARN, "Possible bug: Receive on an offer that's dead"); + LOGM(Log::WARN, "Possible bug: Receive on an offer that's dead"); return; } - LOGM(LOG, "Offer {:x} asks to send data from source {:x}", (uintptr_t)this, (uintptr_t)m_source.get()); + LOGM(Log::DEBUG, "Offer {:x} asks to send data from source {:x}", (uintptr_t)this, (uintptr_t)m_source.get()); m_source->send(mime, std::move(sendFd)); }); @@ -79,7 +79,7 @@ std::vector<std::string> CWLRDataSource::mimes() { void CWLRDataSource::send(const std::string& mime, CFileDescriptor fd) { if (std::ranges::find(m_mimeTypes, mime) == m_mimeTypes.end()) { - LOGM(ERR, "Compositor/App bug: CWLRDataSource::sendAskSend with non-existent mime"); + LOGM(Log::ERR, "Compositor/App bug: CWLRDataSource::sendAskSend with non-existent mime"); return; } @@ -88,7 +88,7 @@ void CWLRDataSource::send(const std::string& mime, CFileDescriptor fd) { void CWLRDataSource::accepted(const std::string& mime) { if (std::ranges::find(m_mimeTypes, mime) == m_mimeTypes.end()) - LOGM(ERR, "Compositor/App bug: CWLRDataSource::sendAccepted with non-existent mime"); + LOGM(Log::ERR, "Compositor/App bug: CWLRDataSource::sendAccepted with non-existent mime"); // wlr has no accepted } @@ -113,34 +113,34 @@ CWLRDataDevice::CWLRDataDevice(SP<CZwlrDataControlDeviceV1> resource_) : m_resou m_resource->setSetSelection([](CZwlrDataControlDeviceV1* r, wl_resource* sourceR) { auto source = sourceR ? CWLRDataSource::fromResource(sourceR) : CSharedPointer<CWLRDataSource>{}; if (!source) { - LOGM(LOG, "wlr reset selection received"); + LOGM(Log::DEBUG, "wlr reset selection received"); g_pSeatManager->setCurrentSelection(nullptr); return; } if (source && source->used()) - LOGM(WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this."); + LOGM(Log::WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this."); source->markUsed(); - LOGM(LOG, "wlr manager requests selection to {:x}", (uintptr_t)source.get()); + LOGM(Log::DEBUG, "wlr manager requests selection to {:x}", (uintptr_t)source.get()); g_pSeatManager->setCurrentSelection(source); }); m_resource->setSetPrimarySelection([](CZwlrDataControlDeviceV1* r, wl_resource* sourceR) { auto source = sourceR ? CWLRDataSource::fromResource(sourceR) : CSharedPointer<CWLRDataSource>{}; if (!source) { - LOGM(LOG, "wlr reset primary selection received"); + LOGM(Log::DEBUG, "wlr reset primary selection received"); g_pSeatManager->setCurrentPrimarySelection(nullptr); return; } if (source && source->used()) - LOGM(WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this."); + LOGM(Log::WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this."); source->markUsed(); - LOGM(LOG, "wlr manager requests primary selection to {:x}", (uintptr_t)source.get()); + LOGM(Log::DEBUG, "wlr manager requests primary selection to {:x}", (uintptr_t)source.get()); g_pSeatManager->setCurrentPrimarySelection(source); }); } @@ -197,7 +197,7 @@ CWLRDataControlManagerResource::CWLRDataControlManagerResource(SP<CZwlrDataContr RESOURCE->sendInitialSelections(); - LOGM(LOG, "New wlr data device bound at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New wlr data device bound at {:x}", (uintptr_t)RESOURCE.get()); }); m_resource->setCreateDataSource([this](CZwlrDataControlManagerV1* r, uint32_t id) { @@ -213,13 +213,13 @@ CWLRDataControlManagerResource::CWLRDataControlManagerResource(SP<CZwlrDataContr } if (!m_device) - LOGM(WARN, "New data source before a device was created"); + LOGM(Log::WARN, "New data source before a device was created"); RESOURCE->m_self = RESOURCE; m_sources.emplace_back(RESOURCE); - LOGM(LOG, "New wlr data source bound at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New wlr data source bound at {:x}", (uintptr_t)RESOURCE.get()); }); } @@ -240,7 +240,7 @@ void CDataDeviceWLRProtocol::bindManager(wl_client* client, void* data, uint32_t return; } - LOGM(LOG, "New wlr_data_control_manager at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New wlr_data_control_manager at {:x}", (uintptr_t)RESOURCE.get()); } void CDataDeviceWLRProtocol::destroyResource(CWLRDataControlManagerResource* resource) { @@ -278,7 +278,7 @@ void CDataDeviceWLRProtocol::sendSelectionToDevice(SP<CWLRDataDevice> dev, SP<ID OFFER->m_primary = primary; - LOGM(LOG, "New {}offer {:x} for data source {:x}", primary ? "primary " : " ", (uintptr_t)OFFER.get(), (uintptr_t)sel.get()); + LOGM(Log::DEBUG, "New {}offer {:x} for data source {:x}", primary ? "primary " : " ", (uintptr_t)OFFER.get(), (uintptr_t)sel.get()); dev->sendDataOffer(OFFER); OFFER->sendData(); @@ -298,7 +298,7 @@ void CDataDeviceWLRProtocol::setSelection(SP<IDataSource> source, bool primary) } if (!source) { - LOGM(LOG, "resetting {}selection", primary ? "primary " : " "); + LOGM(Log::DEBUG, "resetting {}selection", primary ? "primary " : " "); for (auto const& d : m_devices) { sendSelectionToDevice(d, nullptr, primary); @@ -307,7 +307,7 @@ void CDataDeviceWLRProtocol::setSelection(SP<IDataSource> source, bool primary) return; } - LOGM(LOG, "New {}selection for data source {:x}", primary ? "primary" : "", (uintptr_t)source.get()); + LOGM(Log::DEBUG, "New {}selection for data source {:x}", primary ? "primary" : "", (uintptr_t)source.get()); for (auto const& d : m_devices) { sendSelectionToDevice(d, source, primary); diff --git a/src/protocols/ExtDataDevice.cpp b/src/protocols/ExtDataDevice.cpp index c2d4c497..6ab83ab4 100644 --- a/src/protocols/ExtDataDevice.cpp +++ b/src/protocols/ExtDataDevice.cpp @@ -14,16 +14,16 @@ CExtDataOffer::CExtDataOffer(SP<CExtDataControlOfferV1> resource_, SP<IDataSourc m_resource->setReceive([this](CExtDataControlOfferV1* r, const char* mime, int32_t fd) { CFileDescriptor sendFd{fd}; if (!m_source) { - LOGM(WARN, "Possible bug: Receive on an offer w/o a source"); + LOGM(Log::WARN, "Possible bug: Receive on an offer w/o a source"); return; } if (m_dead) { - LOGM(WARN, "Possible bug: Receive on an offer that's dead"); + LOGM(Log::WARN, "Possible bug: Receive on an offer that's dead"); return; } - LOGM(LOG, "Offer {:x} asks to send data from source {:x}", (uintptr_t)this, (uintptr_t)m_source.get()); + LOGM(Log::DEBUG, "Offer {:x} asks to send data from source {:x}", (uintptr_t)this, (uintptr_t)m_source.get()); m_source->send(mime, std::move(sendFd)); }); @@ -79,7 +79,7 @@ std::vector<std::string> CExtDataSource::mimes() { void CExtDataSource::send(const std::string& mime, CFileDescriptor fd) { if (std::ranges::find(m_mimeTypes, mime) == m_mimeTypes.end()) { - LOGM(ERR, "Compositor/App bug: CExtDataSource::sendAskSend with non-existent mime"); + LOGM(Log::ERR, "Compositor/App bug: CExtDataSource::sendAskSend with non-existent mime"); return; } @@ -88,7 +88,7 @@ void CExtDataSource::send(const std::string& mime, CFileDescriptor fd) { void CExtDataSource::accepted(const std::string& mime) { if (std::ranges::find(m_mimeTypes, mime) == m_mimeTypes.end()) - LOGM(ERR, "Compositor/App bug: CExtDataSource::sendAccepted with non-existent mime"); + LOGM(Log::ERR, "Compositor/App bug: CExtDataSource::sendAccepted with non-existent mime"); // ext has no accepted } @@ -113,34 +113,34 @@ CExtDataDevice::CExtDataDevice(SP<CExtDataControlDeviceV1> resource_) : m_resour m_resource->setSetSelection([](CExtDataControlDeviceV1* r, wl_resource* sourceR) { auto source = sourceR ? CExtDataSource::fromResource(sourceR) : CSharedPointer<CExtDataSource>{}; if (!source) { - LOGM(LOG, "ext reset selection received"); + LOGM(Log::DEBUG, "ext reset selection received"); g_pSeatManager->setCurrentSelection(nullptr); return; } if (source && source->used()) - LOGM(WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this."); + LOGM(Log::WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this."); source->markUsed(); - LOGM(LOG, "ext manager requests selection to {:x}", (uintptr_t)source.get()); + LOGM(Log::DEBUG, "ext manager requests selection to {:x}", (uintptr_t)source.get()); g_pSeatManager->setCurrentSelection(source); }); m_resource->setSetPrimarySelection([](CExtDataControlDeviceV1* r, wl_resource* sourceR) { auto source = sourceR ? CExtDataSource::fromResource(sourceR) : CSharedPointer<CExtDataSource>{}; if (!source) { - LOGM(LOG, "ext reset primary selection received"); + LOGM(Log::DEBUG, "ext reset primary selection received"); g_pSeatManager->setCurrentPrimarySelection(nullptr); return; } if (source && source->used()) - LOGM(WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this."); + LOGM(Log::WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this."); source->markUsed(); - LOGM(LOG, "ext manager requests primary selection to {:x}", (uintptr_t)source.get()); + LOGM(Log::DEBUG, "ext manager requests primary selection to {:x}", (uintptr_t)source.get()); g_pSeatManager->setCurrentPrimarySelection(source); }); } @@ -197,7 +197,7 @@ CExtDataControlManagerResource::CExtDataControlManagerResource(SP<CExtDataContro RESOURCE->sendInitialSelections(); - LOGM(LOG, "New ext data device bound at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New ext data device bound at {:x}", (uintptr_t)RESOURCE.get()); }); m_resource->setCreateDataSource([this](CExtDataControlManagerV1* r, uint32_t id) { @@ -213,13 +213,13 @@ CExtDataControlManagerResource::CExtDataControlManagerResource(SP<CExtDataContro } if (!m_device) - LOGM(WARN, "New data source before a device was created"); + LOGM(Log::WARN, "New data source before a device was created"); RESOURCE->m_self = RESOURCE; m_sources.emplace_back(RESOURCE); - LOGM(LOG, "New ext data source bound at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New ext data source bound at {:x}", (uintptr_t)RESOURCE.get()); }); } @@ -240,7 +240,7 @@ void CExtDataDeviceProtocol::bindManager(wl_client* client, void* data, uint32_t return; } - LOGM(LOG, "New ext_data_control_manager at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New ext_data_control_manager at {:x}", (uintptr_t)RESOURCE.get()); } void CExtDataDeviceProtocol::destroyResource(CExtDataControlManagerResource* resource) { @@ -278,7 +278,7 @@ void CExtDataDeviceProtocol::sendSelectionToDevice(SP<CExtDataDevice> dev, SP<ID OFFER->m_primary = primary; - LOGM(LOG, "New {}offer {:x} for data source {:x}", primary ? "primary " : " ", (uintptr_t)OFFER.get(), (uintptr_t)sel.get()); + LOGM(Log::DEBUG, "New {}offer {:x} for data source {:x}", primary ? "primary " : " ", (uintptr_t)OFFER.get(), (uintptr_t)sel.get()); dev->sendDataOffer(OFFER); OFFER->sendData(); @@ -298,7 +298,7 @@ void CExtDataDeviceProtocol::setSelection(SP<IDataSource> source, bool primary) } if (!source) { - LOGM(LOG, "resetting {}selection", primary ? "primary " : " "); + LOGM(Log::DEBUG, "resetting {}selection", primary ? "primary " : " "); for (auto const& d : m_devices) { sendSelectionToDevice(d, nullptr, primary); @@ -307,7 +307,7 @@ void CExtDataDeviceProtocol::setSelection(SP<IDataSource> source, bool primary) return; } - LOGM(LOG, "New {}selection for data source {:x}", primary ? "primary" : "", (uintptr_t)source.get()); + LOGM(Log::DEBUG, "New {}selection for data source {:x}", primary ? "primary" : "", (uintptr_t)source.get()); for (auto const& d : m_devices) { sendSelectionToDevice(d, source, primary); diff --git a/src/protocols/ExtWorkspace.cpp b/src/protocols/ExtWorkspace.cpp index bc4402f0..2af72a4d 100644 --- a/src/protocols/ExtWorkspace.cpp +++ b/src/protocols/ExtWorkspace.cpp @@ -273,7 +273,7 @@ void CExtWorkspaceManagerResource::onMonitorCreated(const PHLMONITOR& monitor) { group->sendToWorkspaces(); if UNLIKELY (!group->good()) { - LOGM(ERR, "Couldn't create a workspace group object"); + LOGM(Log::ERR, "Couldn't create a workspace group object"); wl_client_post_no_memory(m_resource->client()); return; } @@ -287,7 +287,7 @@ void CExtWorkspaceManagerResource::onWorkspaceCreated(const PHLWORKSPACE& worksp ws->m_self = ws; if UNLIKELY (!ws->good()) { - LOGM(ERR, "Couldn't create a workspace object"); + LOGM(Log::ERR, "Couldn't create a workspace object"); wl_client_post_no_memory(m_resource->client()); return; } @@ -316,7 +316,7 @@ void CExtWorkspaceProtocol::bindManager(wl_client* client, void* data, uint32_t manager->init(manager); if UNLIKELY (!manager->good()) { - LOGM(ERR, "Couldn't create a workspace manager"); + LOGM(Log::ERR, "Couldn't create a workspace manager"); wl_client_post_no_memory(client); return; } diff --git a/src/protocols/Fifo.cpp b/src/protocols/Fifo.cpp index 63ce8579..d9f873c9 100644 --- a/src/protocols/Fifo.cpp +++ b/src/protocols/Fifo.cpp @@ -119,7 +119,7 @@ CFifoManagerResource::CFifoManagerResource(UP<CWpFifoManagerV1>&& resource_) : m } surf->m_fifo = RESOURCE; - LOGM(LOG, "New fifo at {:x} for surface {:x}", (uintptr_t)RESOURCE, (uintptr_t)surf.get()); + LOGM(Log::DEBUG, "New fifo at {:x} for surface {:x}", (uintptr_t)RESOURCE, (uintptr_t)surf.get()); }); } diff --git a/src/protocols/FocusGrab.cpp b/src/protocols/FocusGrab.cpp index b761d264..62b65655 100644 --- a/src/protocols/FocusGrab.cpp +++ b/src/protocols/FocusGrab.cpp @@ -107,7 +107,7 @@ void CFocusGrab::refocusKeyboard() { if (surface) Desktop::focusState()->rawSurfaceFocus(surface); else - LOGM(ERR, "CFocusGrab::refocusKeyboard called with no committed surfaces. This should never happen."); + LOGM(Log::ERR, "CFocusGrab::refocusKeyboard called with no committed surfaces. This should never happen."); } void CFocusGrab::commit(bool removeOnly) { diff --git a/src/protocols/ForeignToplevel.cpp b/src/protocols/ForeignToplevel.cpp index 22bef314..5515d2fb 100644 --- a/src/protocols/ForeignToplevel.cpp +++ b/src/protocols/ForeignToplevel.cpp @@ -30,7 +30,7 @@ CForeignToplevelList::CForeignToplevelList(SP<CExtForeignToplevelListV1> resourc m_resource->setStop([this](CExtForeignToplevelListV1* h) { m_resource->sendFinished(); m_finished = true; - LOGM(LOG, "CForeignToplevelList: finished"); + LOGM(Log::DEBUG, "CForeignToplevelList: finished"); }); for (auto const& w : g_pCompositor->m_windows) { @@ -58,7 +58,7 @@ void CForeignToplevelList::onMap(PHLWINDOW pWindow) { makeShared<CForeignToplevelHandle>(makeShared<CExtForeignToplevelHandleV1>(m_resource->client(), m_resource->version(), 0), pWindow)); if (!NEWHANDLE->good()) { - LOGM(ERR, "Couldn't create a foreign handle"); + LOGM(Log::ERR, "Couldn't create a foreign handle"); m_resource->noMemory(); PROTO::foreignToplevel->m_handles.pop_back(); return; @@ -66,7 +66,7 @@ void CForeignToplevelList::onMap(PHLWINDOW pWindow) { const auto IDENTIFIER = std::format("{:08x}->{:016x}", sc<uint32_t>(rc<uintptr_t>(this) & 0xFFFFFFFF), rc<uintptr_t>(pWindow.get())); - LOGM(LOG, "Newly mapped window gets an identifier of {}", IDENTIFIER); + LOGM(Log::DEBUG, "Newly mapped window gets an identifier of {}", IDENTIFIER); m_resource->sendToplevel(NEWHANDLE->m_resource.get()); NEWHANDLE->m_resource->sendIdentifier(IDENTIFIER.c_str()); NEWHANDLE->m_resource->sendAppId(pWindow->m_initialClass.c_str()); @@ -161,7 +161,7 @@ void CForeignToplevelProtocol::bindManager(wl_client* client, void* data, uint32 const auto RESOURCE = m_managers.emplace_back(makeUnique<CForeignToplevelList>(makeShared<CExtForeignToplevelListV1>(client, ver, id))).get(); if UNLIKELY (!RESOURCE->good()) { - LOGM(ERR, "Couldn't create a foreign list"); + LOGM(Log::ERR, "Couldn't create a foreign list"); wl_client_post_no_memory(client); m_managers.pop_back(); return; diff --git a/src/protocols/ForeignToplevelWlr.cpp b/src/protocols/ForeignToplevelWlr.cpp index 46cd5f1b..5e18483d 100644 --- a/src/protocols/ForeignToplevelWlr.cpp +++ b/src/protocols/ForeignToplevelWlr.cpp @@ -206,7 +206,7 @@ CForeignToplevelWlrManager::CForeignToplevelWlrManager(SP<CZwlrForeignToplevelMa m_resource->setStop([this](CZwlrForeignToplevelManagerV1* h) { m_resource->sendFinished(); m_finished = true; - LOGM(LOG, "CForeignToplevelWlrManager: finished"); + LOGM(Log::DEBUG, "CForeignToplevelWlrManager: finished"); PROTO::foreignToplevelWlr->onManagerResourceDestroy(this); }); @@ -228,13 +228,13 @@ void CForeignToplevelWlrManager::onMap(PHLWINDOW pWindow) { makeShared<CForeignToplevelHandleWlr>(makeShared<CZwlrForeignToplevelHandleV1>(m_resource->client(), m_resource->version(), 0), pWindow)); if UNLIKELY (!NEWHANDLE->good()) { - LOGM(ERR, "Couldn't create a foreign handle"); + LOGM(Log::ERR, "Couldn't create a foreign handle"); m_resource->noMemory(); PROTO::foreignToplevelWlr->m_handles.pop_back(); return; } - LOGM(LOG, "Newly mapped window {:016x}", (uintptr_t)pWindow.get()); + LOGM(Log::DEBUG, "Newly mapped window {:016x}", (uintptr_t)pWindow.get()); m_resource->sendToplevel(NEWHANDLE->m_resource.get()); NEWHANDLE->m_resource->sendAppId(pWindow->m_class.c_str()); NEWHANDLE->m_resource->sendTitle(pWindow->m_title.c_str()); @@ -409,7 +409,7 @@ void CForeignToplevelWlrProtocol::bindManager(wl_client* client, void* data, uin const auto RESOURCE = m_managers.emplace_back(makeUnique<CForeignToplevelWlrManager>(makeShared<CZwlrForeignToplevelManagerV1>(client, ver, id))).get(); if UNLIKELY (!RESOURCE->good()) { - LOGM(ERR, "Couldn't create a foreign list"); + LOGM(Log::ERR, "Couldn't create a foreign list"); wl_client_post_no_memory(client); m_managers.pop_back(); return; diff --git a/src/protocols/FractionalScale.cpp b/src/protocols/FractionalScale.cpp index 899d1390..9bdf5910 100644 --- a/src/protocols/FractionalScale.cpp +++ b/src/protocols/FractionalScale.cpp @@ -26,7 +26,7 @@ void CFractionalScaleProtocol::onManagerResourceDestroy(wl_resource* res) { void CFractionalScaleProtocol::onGetFractionalScale(CWpFractionalScaleManagerV1* pMgr, uint32_t id, SP<CWLSurfaceResource> surface) { for (auto const& [k, v] : m_addons) { if (k == surface) { - LOGM(ERR, "Surface {:x} already has a fractionalScale addon", (uintptr_t)surface.get()); + LOGM(Log::ERR, "Surface {:x} already has a fractionalScale addon", (uintptr_t)surface.get()); pMgr->error(WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_FRACTIONAL_SCALE_EXISTS, "Fractional scale already exists"); return; } diff --git a/src/protocols/FrogColorManagement.cpp b/src/protocols/FrogColorManagement.cpp index 730a15b0..8506ce7b 100644 --- a/src/protocols/FrogColorManagement.cpp +++ b/src/protocols/FrogColorManagement.cpp @@ -26,15 +26,15 @@ CFrogColorManager::CFrogColorManager(SP<CFrogColorManagementFactoryV1> resource_ if UNLIKELY (!good()) return; - m_resource->setDestroy([](CFrogColorManagementFactoryV1* r) { LOGM(TRACE, "Destroy frog_color_management at {:x} (generated default)", (uintptr_t)r); }); + m_resource->setDestroy([](CFrogColorManagementFactoryV1* r) { LOGM(Log::TRACE, "Destroy frog_color_management at {:x} (generated default)", (uintptr_t)r); }); m_resource->setOnDestroy([this](CFrogColorManagementFactoryV1* r) { PROTO::frogColorManagement->destroyResource(this); }); m_resource->setGetColorManagedSurface([](CFrogColorManagementFactoryV1* r, wl_resource* surface, uint32_t id) { - LOGM(TRACE, "Get surface for id={}, surface={}", id, (uintptr_t)surface); + LOGM(Log::TRACE, "Get surface for id={}, surface={}", id, (uintptr_t)surface); auto SURF = CWLSurfaceResource::fromResource(surface); if (!SURF) { - LOGM(ERR, "No surface for resource {}", (uintptr_t)surface); + LOGM(Log::ERR, "No surface for resource {}", (uintptr_t)surface); r->error(-1, "Invalid surface (2)"); return; } @@ -74,24 +74,24 @@ CFrogColorManagementSurface::CFrogColorManagementSurface(SP<CFrogColorManagedSur m_surface->m_colorManagement = RESOURCE; m_resource->setOnDestroy([this](CFrogColorManagedSurface* r) { - LOGM(TRACE, "Destroy frog cm and xx cm for surface {}", (uintptr_t)m_surface); + LOGM(Log::TRACE, "Destroy frog cm and xx cm for surface {}", (uintptr_t)m_surface); if (m_surface.valid()) PROTO::colorManagement->destroyResource(m_surface->m_colorManagement.get()); PROTO::frogColorManagement->destroyResource(this); }); } else m_resource->setOnDestroy([this](CFrogColorManagedSurface* r) { - LOGM(TRACE, "Destroy frog cm surface {}", (uintptr_t)m_surface); + LOGM(Log::TRACE, "Destroy frog cm surface {}", (uintptr_t)m_surface); PROTO::frogColorManagement->destroyResource(this); }); m_resource->setDestroy([this](CFrogColorManagedSurface* r) { - LOGM(TRACE, "Destroy frog cm surface {}", (uintptr_t)m_surface); + LOGM(Log::TRACE, "Destroy frog cm surface {}", (uintptr_t)m_surface); PROTO::frogColorManagement->destroyResource(this); }); m_resource->setSetKnownTransferFunction([this](CFrogColorManagedSurface* r, frogColorManagedSurfaceTransferFunction tf) { - LOGM(TRACE, "Set frog cm transfer function {} for {}", (uint32_t)tf, m_surface->id()); + LOGM(Log::TRACE, "Set frog cm transfer function {} for {}", (uint32_t)tf, m_surface->id()); switch (tf) { case FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_ST2084_PQ: m_surface->m_colorManagement->m_imageDescription.transferFunction = @@ -100,7 +100,7 @@ CFrogColorManagementSurface::CFrogColorManagementSurface(SP<CFrogColorManagedSur ; case FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_GAMMA_22: if (m_pqIntentSent) { - LOGM(TRACE, + LOGM(Log::TRACE, "FIXME: assuming broken enum value 2 (FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_GAMMA_22) referring to eotf value 2 (TRANSFER_FUNCTION_ST2084_PQ)"); m_surface->m_colorManagement->m_imageDescription.transferFunction = convertTransferFunction(getWPTransferFunction(FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_ST2084_PQ)); @@ -108,7 +108,7 @@ CFrogColorManagementSurface::CFrogColorManagementSurface(SP<CFrogColorManagedSur }; [[fallthrough]]; case FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_UNDEFINED: - case FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_SCRGB_LINEAR: LOGM(TRACE, "FIXME: add tf support for {}", (uint32_t)tf); [[fallthrough]]; + case FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_SCRGB_LINEAR: LOGM(Log::TRACE, "FIXME: add tf support for {}", (uint32_t)tf); [[fallthrough]]; case FROG_COLOR_MANAGED_SURFACE_TRANSFER_FUNCTION_SRGB: m_surface->m_colorManagement->m_imageDescription.transferFunction = convertTransferFunction(getWPTransferFunction(tf)); @@ -116,7 +116,7 @@ CFrogColorManagementSurface::CFrogColorManagementSurface(SP<CFrogColorManagedSur } }); m_resource->setSetKnownContainerColorVolume([this](CFrogColorManagedSurface* r, frogColorManagedSurfacePrimaries primariesName) { - LOGM(TRACE, "Set frog cm primaries {}", (uint32_t)primariesName); + LOGM(Log::TRACE, "Set frog cm primaries {}", (uint32_t)primariesName); switch (primariesName) { case FROG_COLOR_MANAGED_SURFACE_PRIMARIES_UNDEFINED: case FROG_COLOR_MANAGED_SURFACE_PRIMARIES_REC709: m_surface->m_colorManagement->m_imageDescription.primaries = NColorPrimaries::BT709; break; @@ -127,13 +127,14 @@ CFrogColorManagementSurface::CFrogColorManagementSurface(SP<CFrogColorManagedSur m_surface->m_colorManagement->setHasImageDescription(true); }); m_resource->setSetRenderIntent([this](CFrogColorManagedSurface* r, frogColorManagedSurfaceRenderIntent intent) { - LOGM(TRACE, "Set frog cm intent {}", (uint32_t)intent); + LOGM(Log::TRACE, "Set frog cm intent {}", (uint32_t)intent); m_pqIntentSent = intent == FROG_COLOR_MANAGED_SURFACE_RENDER_INTENT_PERCEPTUAL; m_surface->m_colorManagement->setHasImageDescription(true); }); m_resource->setSetHdrMetadata([this](CFrogColorManagedSurface* r, uint32_t r_x, uint32_t r_y, uint32_t g_x, uint32_t g_y, uint32_t b_x, uint32_t b_y, uint32_t w_x, uint32_t w_y, uint32_t max_lum, uint32_t min_lum, uint32_t cll, uint32_t fall) { - LOGM(TRACE, "Set frog primaries r:{},{} g:{},{} b:{},{} w:{},{} luminances {} - {} cll {} fall {}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y, min_lum, max_lum, cll, fall); + LOGM(Log::TRACE, "Set frog primaries r:{},{} g:{},{} b:{},{} w:{},{} luminances {} - {} cll {} fall {}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y, min_lum, max_lum, cll, + fall); m_surface->m_colorManagement->m_imageDescription.masteringPrimaries = SPCPRimaries{.red = {.x = r_x / 50000.0f, .y = r_y / 50000.0f}, .green = {.x = g_x / 50000.0f, .y = g_y / 50000.0f}, .blue = {.x = b_x / 50000.0f, .y = b_y / 50000.0f}, @@ -168,7 +169,7 @@ void CFrogColorManagementProtocol::bindManager(wl_client* client, void* data, ui return; } - LOGM(TRACE, "New frog_color_management at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::TRACE, "New frog_color_management at {:x}", (uintptr_t)RESOURCE.get()); } void CFrogColorManagementProtocol::destroyResource(CFrogColorManager* resource) { diff --git a/src/protocols/GammaControl.cpp b/src/protocols/GammaControl.cpp index 58382de9..2517c754 100644 --- a/src/protocols/GammaControl.cpp +++ b/src/protocols/GammaControl.cpp @@ -13,7 +13,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out auto OUTPUTRES = CWLOutputResource::fromResource(output); if UNLIKELY (!OUTPUTRES) { - LOGM(ERR, "No output in CGammaControl"); + LOGM(Log::ERR, "No output in CGammaControl"); m_resource->sendFailed(); return; } @@ -21,7 +21,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out m_monitor = OUTPUTRES->m_monitor; if UNLIKELY (!m_monitor || !m_monitor->m_output) { - LOGM(ERR, "No CMonitor"); + LOGM(Log::ERR, "No CMonitor"); m_resource->sendFailed(); return; } @@ -36,7 +36,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out m_gammaSize = m_monitor->m_output->getGammaSize(); if UNLIKELY (m_gammaSize <= 0) { - LOGM(ERR, "Output {} doesn't support gamma", m_monitor->m_name); + LOGM(Log::ERR, "Output {} doesn't support gamma", m_monitor->m_name); m_resource->sendFailed(); return; } @@ -49,24 +49,24 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out m_resource->setSetGamma([this](CZwlrGammaControlV1* gamma, int32_t fd) { CFileDescriptor gammaFd{fd}; if UNLIKELY (!m_monitor) { - LOGM(ERR, "setGamma for a dead monitor"); + LOGM(Log::ERR, "setGamma for a dead monitor"); m_resource->sendFailed(); return; } - LOGM(LOG, "setGamma for {}", m_monitor->m_name); + LOGM(Log::DEBUG, "setGamma for {}", m_monitor->m_name); // TODO: make CFileDescriptor getflags use F_GETFL int fdFlags = fcntl(gammaFd.get(), F_GETFL, 0); if UNLIKELY (fdFlags < 0) { - LOGM(ERR, "Failed to get fd flags"); + LOGM(Log::ERR, "Failed to get fd flags"); m_resource->sendFailed(); return; } // TODO: make CFileDescriptor setflags use F_SETFL if UNLIKELY (fcntl(gammaFd.get(), F_SETFL, fdFlags | O_NONBLOCK) < 0) { - LOGM(ERR, "Failed to set fd flags"); + LOGM(Log::ERR, "Failed to set fd flags"); m_resource->sendFailed(); return; } @@ -81,7 +81,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out } if (readBytes < 0 || sc<size_t>(readBytes) != m_gammaTable.size() * sizeof(uint16_t) || moreBytes != 0) { - LOGM(ERR, "Failed to read bytes"); + LOGM(Log::ERR, "Failed to read bytes"); if (sc<size_t>(readBytes) != m_gammaTable.size() * sizeof(uint16_t) || moreBytes > 0) { gamma->error(ZWLR_GAMMA_CONTROL_V1_ERROR_INVALID_GAMMA, "Gamma ramps size mismatch"); @@ -136,7 +136,7 @@ void CGammaControl::applyToMonitor() { if UNLIKELY (!m_monitor || !m_monitor->m_output) return; // ?? - LOGM(LOG, "setting to monitor {}", m_monitor->m_name); + LOGM(Log::DEBUG, "setting to monitor {}", m_monitor->m_name); if (!m_gammaTableSet) { m_monitor->m_output->state->setGammaLut({}); @@ -146,7 +146,7 @@ void CGammaControl::applyToMonitor() { m_monitor->m_output->state->setGammaLut(m_gammaTable); if (!m_monitor->m_state.test()) { - LOGM(LOG, "setting to monitor {} failed", m_monitor->m_name); + LOGM(Log::DEBUG, "setting to monitor {} failed", m_monitor->m_name); m_monitor->m_output->state->setGammaLut({}); } @@ -158,7 +158,7 @@ PHLMONITOR CGammaControl::getMonitor() { } void CGammaControl::onMonitorDestroy() { - LOGM(LOG, "Destroying gamma control for {}", m_monitor->m_name); + LOGM(Log::DEBUG, "Destroying gamma control for {}", m_monitor->m_name); m_resource->sendFailed(); } diff --git a/src/protocols/HyprlandSurface.cpp b/src/protocols/HyprlandSurface.cpp index 38b9c9f8..5d882206 100644 --- a/src/protocols/HyprlandSurface.cpp +++ b/src/protocols/HyprlandSurface.cpp @@ -113,7 +113,7 @@ void CHyprlandSurfaceProtocol::getSurface(CHyprlandSurfaceManagerV1* manager, ui if (iter != m_surfaces.end()) { if (iter->second->m_resource) { - LOGM(ERR, "HyprlandSurface already present for surface {:x}", (uintptr_t)surface.get()); + LOGM(Log::ERR, "HyprlandSurface already present for surface {:x}", (uintptr_t)surface.get()); manager->error(HYPRLAND_SURFACE_MANAGER_V1_ERROR_ALREADY_CONSTRUCTED, "HyprlandSurface already present"); return; } else { diff --git a/src/protocols/IdleNotify.cpp b/src/protocols/IdleNotify.cpp index 4122bf24..b80bf5c6 100644 --- a/src/protocols/IdleNotify.cpp +++ b/src/protocols/IdleNotify.cpp @@ -23,7 +23,7 @@ CExtIdleNotification::CExtIdleNotification(SP<CExtIdleNotificationV1> resource_, update(); - LOGM(LOG, "Registered idle-notification for {}ms", timeoutMs_); + LOGM(Log::DEBUG, "Registered idle-notification for {}ms", timeoutMs_); } CExtIdleNotification::~CExtIdleNotification() { diff --git a/src/protocols/InputMethodV2.cpp b/src/protocols/InputMethodV2.cpp index eaf7f141..0917d100 100644 --- a/src/protocols/InputMethodV2.cpp +++ b/src/protocols/InputMethodV2.cpp @@ -15,7 +15,7 @@ CInputMethodKeyboardGrabV2::CInputMethodKeyboardGrabV2(SP<CZwpInputMethodKeyboar m_resource->setOnDestroy([this](CZwpInputMethodKeyboardGrabV2* r) { PROTO::ime->destroyResource(this); }); if (!g_pSeatManager->m_keyboard) { - LOGM(ERR, "IME called but no active keyboard???"); + LOGM(Log::ERR, "IME called but no active keyboard???"); return; } @@ -36,13 +36,13 @@ void CInputMethodKeyboardGrabV2::sendKeyboardData(SP<IKeyboard> keyboard) { auto keymapFD = allocateSHMFile(keyboard->m_xkbKeymapV1String.length() + 1); if UNLIKELY (!keymapFD.isValid()) { - LOGM(ERR, "Failed to create a keymap file for keyboard grab"); + LOGM(Log::ERR, "Failed to create a keymap file for keyboard grab"); return; } void* data = mmap(nullptr, keyboard->m_xkbKeymapV1String.length() + 1, PROT_READ | PROT_WRITE, MAP_SHARED, keymapFD.get(), 0); if UNLIKELY (data == MAP_FAILED) { - LOGM(ERR, "Failed to mmap a keymap file for keyboard grab"); + LOGM(Log::ERR, "Failed to mmap a keymap file for keyboard grab"); return; } @@ -194,7 +194,7 @@ CInputMethodV2::CInputMethodV2(SP<CZwpInputMethodV2> resource_) : m_resource(res return; } - LOGM(LOG, "New IME Popup with resource id {}", id); + LOGM(Log::DEBUG, "New IME Popup with resource id {}", id); m_popups.emplace_back(RESOURCE); @@ -211,7 +211,7 @@ CInputMethodV2::CInputMethodV2(SP<CZwpInputMethodV2> resource_) : m_resource(res return; } - LOGM(LOG, "New IME Grab with resource id {}", id); + LOGM(Log::DEBUG, "New IME Grab with resource id {}", id); m_grabs.emplace_back(RESOURCE); }); @@ -367,7 +367,7 @@ void CInputMethodV2Protocol::onGetIME(CZwpInputMethodManagerV2* mgr, wl_resource RESOURCE->m_self = RESOURCE; - LOGM(LOG, "New IME with resource id {}", id); + LOGM(Log::DEBUG, "New IME with resource id {}", id); m_events.newIME.emit(RESOURCE); } diff --git a/src/protocols/LayerShell.cpp b/src/protocols/LayerShell.cpp index 32e91598..80222627 100644 --- a/src/protocols/LayerShell.cpp +++ b/src/protocols/LayerShell.cpp @@ -249,7 +249,7 @@ void CLayerShellProtocol::onGetLayerSurface(CZwlrLayerShellV1* pMgr, uint32_t id SURF->m_role = makeShared<CLayerShellRole>(RESOURCE); g_pCompositor->m_layers.emplace_back(Desktop::View::CLayerSurface::create(RESOURCE)); - LOGM(LOG, "New wlr_layer_surface {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New wlr_layer_surface {:x}", (uintptr_t)RESOURCE.get()); } CLayerShellRole::CLayerShellRole(SP<CLayerShellResource> ls) : m_layerSurface(ls) { diff --git a/src/protocols/LinuxDMABUF.cpp b/src/protocols/LinuxDMABUF.cpp index a95a7a52..4f59e4b3 100644 --- a/src/protocols/LinuxDMABUF.cpp +++ b/src/protocols/LinuxDMABUF.cpp @@ -83,7 +83,7 @@ CDMABUFFormatTable::CDMABUFFormatTable(SDMABUFTranche _rendererTranche, std::vec auto arr = sc<SDMABUFFormatTableEntry*>(mmap(nullptr, m_tableSize, PROT_READ | PROT_WRITE, MAP_SHARED, fds[0].get(), 0)); if (arr == MAP_FAILED) { - LOGM(ERR, "mmap failed"); + LOGM(Log::ERR, "mmap failed"); return; } @@ -105,7 +105,7 @@ CLinuxDMABuffer::CLinuxDMABuffer(uint32_t id, wl_client* client, Aquamarine::SDM }); if (!m_buffer->m_success) - LOGM(ERR, "Possibly compositor bug: buffer failed to create"); + LOGM(Log::ERR, "Possibly compositor bug: buffer failed to create"); } CLinuxDMABuffer::~CLinuxDMABuffer() { @@ -161,7 +161,7 @@ CLinuxDMABUFParamsResource::CLinuxDMABUFParamsResource(UP<CZwpLinuxBufferParamsV if (flags > 0) { r->sendFailed(); - LOGM(ERR, "DMABUF flags are not supported"); + LOGM(Log::ERR, "DMABUF flags are not supported"); return; } @@ -180,7 +180,7 @@ CLinuxDMABUFParamsResource::CLinuxDMABUFParamsResource(UP<CZwpLinuxBufferParamsV if (flags > 0) { r->sendFailed(); - LOGM(ERR, "DMABUF flags are not supported"); + LOGM(Log::ERR, "DMABUF flags are not supported"); return; } @@ -200,19 +200,19 @@ void CLinuxDMABUFParamsResource::create(uint32_t id) { m_used = true; if UNLIKELY (!verify()) { - LOGM(ERR, "Failed creating a dmabuf: verify() said no"); + LOGM(Log::ERR, "Failed creating a dmabuf: verify() said no"); return; // if verify failed, we errored the resource. } if UNLIKELY (!commence()) { - LOGM(ERR, "Failed creating a dmabuf: commence() said no"); + LOGM(Log::ERR, "Failed creating a dmabuf: commence() said no"); m_resource->sendFailed(); return; } - LOGM(LOG, "Creating a dmabuf, with id {}: size {}, fmt {}, planes {}", id, m_attrs->size, NFormatUtils::drmFormatName(m_attrs->format), m_attrs->planes); + LOGM(Log::DEBUG, "Creating a dmabuf, with id {}: size {}, fmt {}, planes {}", id, m_attrs->size, NFormatUtils::drmFormatName(m_attrs->format), m_attrs->planes); for (int i = 0; i < m_attrs->planes; ++i) { - LOGM(LOG, " | plane {}: mod {} fd {} stride {} offset {}", i, m_attrs->modifier, m_attrs->fds[i], m_attrs->strides[i], m_attrs->offsets[i]); + LOGM(Log::DEBUG, " | plane {}: mod {} fd {} stride {} offset {}", i, m_attrs->modifier, m_attrs->fds[i], m_attrs->strides[i], m_attrs->offsets[i]); } auto& buf = PROTO::linuxDma->m_buffers.emplace_back(makeUnique<CLinuxDMABuffer>(id, m_resource->client(), *m_attrs)); @@ -237,12 +237,12 @@ bool CLinuxDMABUFParamsResource::commence() { uint32_t handle = 0; if (drmPrimeFDToHandle(PROTO::linuxDma->m_mainDeviceFD.get(), m_attrs->fds.at(i), &handle)) { - LOGM(ERR, "Failed to import dmabuf fd"); + LOGM(Log::ERR, "Failed to import dmabuf fd"); return false; } if (drmCloseBufferHandle(PROTO::linuxDma->m_mainDeviceFD.get(), handle)) { - LOGM(ERR, "Failed to close dmabuf handle"); + LOGM(Log::ERR, "Failed to close dmabuf handle"); return false; } } @@ -412,7 +412,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const auto dev = devIDFromFD(rendererFD); if (!dev.has_value()) { - LOGM(ERR, "failed to get drm dev, disabling linux dmabuf"); + LOGM(Log::ERR, "failed to get drm dev, disabling linux dmabuf"); removeGlobal(); return; } @@ -462,7 +462,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const drmDevice* device = nullptr; if (drmGetDeviceFromDevId(m_mainDevice, 0, &device) != 0) { - LOGM(ERR, "failed to get drm dev, disabling linux dmabuf"); + LOGM(Log::ERR, "failed to get drm dev, disabling linux dmabuf"); removeGlobal(); return; } @@ -472,7 +472,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const m_mainDeviceFD = CFileDescriptor{fcntl(g_pCompositor->m_drmRenderNode.fd, F_DUPFD_CLOEXEC, 0)}; drmFreeDevice(&device); if (!m_mainDeviceFD.isValid()) { - LOGM(ERR, "failed to open rendernode, disabling linux dmabuf"); + LOGM(Log::ERR, "failed to open rendernode, disabling linux dmabuf"); removeGlobal(); return; } @@ -485,12 +485,12 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const m_mainDeviceFD = CFileDescriptor{open(name, O_RDWR | O_CLOEXEC)}; drmFreeDevice(&device); if (!m_mainDeviceFD.isValid()) { - LOGM(ERR, "failed to open drm dev, disabling linux dmabuf"); + LOGM(Log::ERR, "failed to open drm dev, disabling linux dmabuf"); removeGlobal(); return; } } else { - LOGM(ERR, "DRM device {} has no render node, disabling linux dmabuf checks", device->nodes[DRM_NODE_PRIMARY] ? device->nodes[DRM_NODE_PRIMARY] : "null"); + LOGM(Log::ERR, "DRM device {} has no render node, disabling linux dmabuf checks", device->nodes[DRM_NODE_PRIMARY] ? device->nodes[DRM_NODE_PRIMARY] : "null"); drmFreeDevice(&device); } }); @@ -500,7 +500,7 @@ void CLinuxDMABufV1Protocol::resetFormatTable() { if (!m_formatTable) return; - LOGM(LOG, "Resetting format table"); + LOGM(Log::DEBUG, "Resetting format table"); // this might be a big copy auto newFormatTable = makeUnique<CDMABUFFormatTable>(m_formatTable->m_rendererTranche, m_formatTable->m_monitorTranches); @@ -570,12 +570,12 @@ void CLinuxDMABufV1Protocol::updateScanoutTranche(SP<CWLSurfaceResource> surface } if (!feedbackResource) { - LOGM(LOG, "updateScanoutTranche: surface has no dmabuf_feedback"); + LOGM(Log::DEBUG, "updateScanoutTranche: surface has no dmabuf_feedback"); return; } if (!pMonitor) { - LOGM(LOG, "updateScanoutTranche: resetting feedback"); + LOGM(Log::DEBUG, "updateScanoutTranche: resetting feedback"); feedbackResource->sendDefaultFeedback(); return; } @@ -584,13 +584,13 @@ void CLinuxDMABufV1Protocol::updateScanoutTranche(SP<CWLSurfaceResource> surface std::ranges::find_if(m_formatTable->m_monitorTranches, [pMonitor](std::pair<PHLMONITORREF, SDMABUFTranche> pair) { return pair.first == pMonitor; }); if (monitorTranchePair == m_formatTable->m_monitorTranches.end()) { - LOGM(LOG, "updateScanoutTranche: monitor has no tranche"); + LOGM(Log::DEBUG, "updateScanoutTranche: monitor has no tranche"); return; } auto& monitorTranche = (*monitorTranchePair).second; - LOGM(LOG, "updateScanoutTranche: sending a scanout tranche"); + LOGM(Log::DEBUG, "updateScanoutTranche: sending a scanout tranche"); struct wl_array deviceArr = { .size = sizeof(m_mainDevice), diff --git a/src/protocols/LockNotify.cpp b/src/protocols/LockNotify.cpp index 1855f891..46736ead 100644 --- a/src/protocols/LockNotify.cpp +++ b/src/protocols/LockNotify.cpp @@ -63,7 +63,7 @@ void CLockNotifyProtocol::onGetNotification(CHyprlandLockNotifierV1* pMgr, uint3 void CLockNotifyProtocol::onLocked() { if UNLIKELY (m_isLocked) { - LOGM(ERR, "Not sending lock notification. Already locked!"); + LOGM(Log::ERR, "Not sending lock notification. Already locked!"); return; } @@ -76,7 +76,7 @@ void CLockNotifyProtocol::onLocked() { void CLockNotifyProtocol::onUnlocked() { if UNLIKELY (!m_isLocked) { - LOGM(ERR, "Not sending unlock notification. Not locked!"); + LOGM(Log::ERR, "Not sending unlock notification. Not locked!"); return; } diff --git a/src/protocols/MesaDRM.cpp b/src/protocols/MesaDRM.cpp index 789f90b6..8a0b08b7 100644 --- a/src/protocols/MesaDRM.cpp +++ b/src/protocols/MesaDRM.cpp @@ -6,9 +6,9 @@ #include "../render/OpenGL.hpp" CMesaDRMBufferResource::CMesaDRMBufferResource(uint32_t id, wl_client* client, Aquamarine::SDMABUFAttrs attrs_) { - LOGM(LOG, "Creating a Mesa dmabuf, with id {}: size {}, fmt {}, planes {}", id, attrs_.size, attrs_.format, attrs_.planes); + LOGM(Log::DEBUG, "Creating a Mesa dmabuf, with id {}: size {}, fmt {}, planes {}", id, attrs_.size, attrs_.format, attrs_.planes); for (int i = 0; i < attrs_.planes; ++i) { - LOGM(LOG, " | plane {}: mod {} fd {} stride {} offset {}", i, attrs_.modifier, attrs_.fds[i], attrs_.strides[i], attrs_.offsets[i]); + LOGM(Log::DEBUG, " | plane {}: mod {} fd {} stride {} offset {}", i, attrs_.modifier, attrs_.fds[i], attrs_.strides[i], attrs_.offsets[i]); } m_buffer = makeShared<CDMABuffer>(id, client, attrs_); @@ -20,7 +20,7 @@ CMesaDRMBufferResource::CMesaDRMBufferResource(uint32_t id, wl_client* client, A }); if (!m_buffer->m_success) - LOGM(ERR, "Possibly compositor bug: buffer failed to create"); + LOGM(Log::ERR, "Possibly compositor bug: buffer failed to create"); } CMesaDRMBufferResource::~CMesaDRMBufferResource() { @@ -116,7 +116,7 @@ CMesaDRMProtocol::CMesaDRMProtocol(const wl_interface* iface, const int& ver, co int drmFD = g_pCompositor->m_drmRenderNode.fd >= 0 ? g_pCompositor->m_drmRenderNode.fd : g_pCompositor->m_drm.fd; if (drmGetDevice2(drmFD, 0, &dev) != 0) { - LOGM(ERR, "Failed to get device from fd {}, disabling MesaDRM", drmFD); + LOGM(Log::ERR, "Failed to get device from fd {}, disabling MesaDRM", drmFD); removeGlobal(); return; } @@ -124,10 +124,10 @@ CMesaDRMProtocol::CMesaDRMProtocol(const wl_interface* iface, const int& ver, co if (dev->available_nodes & (1 << DRM_NODE_RENDER) && dev->nodes[DRM_NODE_RENDER]) { m_nodeName = dev->nodes[DRM_NODE_RENDER]; } else if (dev->available_nodes & (1 << DRM_NODE_PRIMARY) && dev->nodes[DRM_NODE_PRIMARY]) { - LOGM(WARN, "No DRM render node, falling back to primary {}", dev->nodes[DRM_NODE_PRIMARY]); + LOGM(Log::WARN, "No DRM render node, falling back to primary {}", dev->nodes[DRM_NODE_PRIMARY]); m_nodeName = dev->nodes[DRM_NODE_PRIMARY]; } else { - LOGM(ERR, "No usable DRM node (render or primary) found, disabling MesaDRM"); + LOGM(Log::ERR, "No usable DRM node (render or primary) found, disabling MesaDRM"); drmFreeDevice(&dev); removeGlobal(); return; diff --git a/src/protocols/OutputManagement.cpp b/src/protocols/OutputManagement.cpp index 6ae7c820..57d39371 100644 --- a/src/protocols/OutputManagement.cpp +++ b/src/protocols/OutputManagement.cpp @@ -11,14 +11,14 @@ COutputManager::COutputManager(SP<CZwlrOutputManagerV1> resource_) : m_resource( if UNLIKELY (!good()) return; - LOGM(LOG, "New OutputManager registered"); + LOGM(Log::DEBUG, "New OutputManager registered"); m_resource->setOnDestroy([this](CZwlrOutputManagerV1* r) { PROTO::outputManagement->destroyResource(this); }); m_resource->setStop([this](CZwlrOutputManagerV1* r) { m_stopped = true; }); m_resource->setCreateConfiguration([this](CZwlrOutputManagerV1* r, uint32_t id, uint32_t serial) { - LOGM(LOG, "Creating new configuration"); + LOGM(Log::DEBUG, "Creating new configuration"); const auto RESOURCE = PROTO::outputManagement->m_configurations.emplace_back( makeShared<COutputConfiguration>(makeShared<CZwlrOutputConfigurationV1>(m_resource->client(), m_resource->version(), id), m_self.lock())); @@ -37,7 +37,7 @@ COutputManager::COutputManager(SP<CZwlrOutputManagerV1> resource_) : m_resource( if (m == g_pCompositor->m_unsafeOutput) continue; - LOGM(LOG, " | sending output head for {}", m->m_name); + LOGM(Log::DEBUG, " | sending output head for {}", m->m_name); makeAndSendNewHead(m); } @@ -171,9 +171,9 @@ void COutputHead::sendAllData() { if (m->m_mode == m_monitor->m_output->state->state().mode) { if (m->m_mode) - LOGM(LOG, " | sending current mode for {}: {}x{}@{}", m_monitor->m_name, m->m_mode->pixelSize.x, m->m_mode->pixelSize.y, m->m_mode->refreshRate); + LOGM(Log::DEBUG, " | sending current mode for {}: {}x{}@{}", m_monitor->m_name, m->m_mode->pixelSize.x, m->m_mode->pixelSize.y, m->m_mode->refreshRate); else - LOGM(LOG, " | sending current mode for {}: null (fake)", m_monitor->m_name); + LOGM(Log::DEBUG, " | sending current mode for {}: null (fake)", m_monitor->m_name); m_resource->sendCurrentMode(m->m_resource.get()); break; } @@ -202,9 +202,9 @@ void COutputHead::updateMode() { if (m->m_mode == m_monitor->m_currentMode) { if (m->m_mode) - LOGM(LOG, " | sending current mode for {}: {}x{}@{}", m_monitor->m_name, m->m_mode->pixelSize.x, m->m_mode->pixelSize.y, m->m_mode->refreshRate); + LOGM(Log::DEBUG, " | sending current mode for {}: {}x{}@{}", m_monitor->m_name, m->m_mode->pixelSize.x, m->m_mode->pixelSize.y, m->m_mode->refreshRate); else - LOGM(LOG, " | sending current mode for {}: null (fake)", m_monitor->m_name); + LOGM(Log::DEBUG, " | sending current mode for {}: null (fake)", m_monitor->m_name); m_resource->sendCurrentMode(m->m_resource.get()); break; } @@ -243,7 +243,7 @@ void COutputMode::sendAllData() { if (!m_mode) return; - LOGM(LOG, " | sending mode {}x{}@{}mHz, pref: {}", m_mode->pixelSize.x, m_mode->pixelSize.y, m_mode->refreshRate, m_mode->preferred); + LOGM(Log::DEBUG, " | sending mode {}x{}@{}mHz, pref: {}", m_mode->pixelSize.x, m_mode->pixelSize.y, m_mode->refreshRate, m_mode->preferred); m_resource->sendSize(m_mode->pixelSize.x, m_mode->pixelSize.y); if (m_mode->refreshRate > 0) @@ -271,14 +271,14 @@ COutputConfiguration::COutputConfiguration(SP<CZwlrOutputConfigurationV1> resour const auto HEAD = PROTO::outputManagement->headFromResource(outputHead); if (!HEAD) { - LOGM(ERR, "No head in setEnableHead??"); + LOGM(Log::ERR, "No head in setEnableHead??"); return; } const auto PMONITOR = HEAD->monitor(); if (!PMONITOR) { - LOGM(ERR, "No monitor in setEnableHead??"); + LOGM(Log::ERR, "No monitor in setEnableHead??"); return; } @@ -293,25 +293,25 @@ COutputConfiguration::COutputConfiguration(SP<CZwlrOutputConfigurationV1> resour m_heads.emplace_back(RESOURCE); - LOGM(LOG, "enableHead on {}. For now, doing nothing. Waiting for apply().", PMONITOR->m_name); + LOGM(Log::DEBUG, "enableHead on {}. For now, doing nothing. Waiting for apply().", PMONITOR->m_name); }); m_resource->setDisableHead([this](CZwlrOutputConfigurationV1* r, wl_resource* outputHead) { const auto HEAD = PROTO::outputManagement->headFromResource(outputHead); if (!HEAD) { - LOGM(ERR, "No head in setDisableHead??"); + LOGM(Log::ERR, "No head in setDisableHead??"); return; } const auto PMONITOR = HEAD->monitor(); if (!PMONITOR) { - LOGM(ERR, "No monitor in setDisableHead??"); + LOGM(Log::ERR, "No monitor in setDisableHead??"); return; } - LOGM(LOG, "disableHead on {}", PMONITOR->m_name); + LOGM(Log::DEBUG, "disableHead on {}", PMONITOR->m_name); SWlrManagerSavedOutputState newState; if (m_owner->m_monitorStates.contains(PMONITOR->m_name)) @@ -351,14 +351,14 @@ bool COutputConfiguration::good() { bool COutputConfiguration::applyTestConfiguration(bool test) { if (test) { - LOGM(WARN, "TODO: STUB: applyTestConfiguration for test not implemented, returning true."); + LOGM(Log::WARN, "TODO: STUB: applyTestConfiguration for test not implemented, returning true."); return true; } - LOGM(LOG, "Applying configuration"); + LOGM(Log::DEBUG, "Applying configuration"); if (!m_owner) { - LOGM(ERR, "applyTestConfiguration: no owner?!"); + LOGM(Log::ERR, "applyTestConfiguration: no owner?!"); return false; } @@ -373,7 +373,7 @@ bool COutputConfiguration::applyTestConfiguration(bool test) { if (!PMONITOR) continue; - LOGM(LOG, "Saving config for monitor {}", PMONITOR->m_name); + LOGM(Log::DEBUG, "Saving config for monitor {}", PMONITOR->m_name); SWlrManagerSavedOutputState newState; if (m_owner->m_monitorStates.contains(PMONITOR->m_name)) @@ -385,36 +385,36 @@ bool COutputConfiguration::applyTestConfiguration(bool test) { newState.resolution = head->m_state.mode->getMode()->pixelSize; newState.refresh = head->m_state.mode->getMode()->refreshRate; newState.committedProperties |= eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_MODE; - LOGM(LOG, " > Mode: {:.0f}x{:.0f}@{}mHz", newState.resolution.x, newState.resolution.y, newState.refresh); + LOGM(Log::DEBUG, " > Mode: {:.0f}x{:.0f}@{}mHz", newState.resolution.x, newState.resolution.y, newState.refresh); } else if (head->m_state.committedProperties & eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_CUSTOM_MODE) { newState.resolution = head->m_state.customMode.size; newState.refresh = head->m_state.customMode.refresh; newState.committedProperties |= eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_CUSTOM_MODE; - LOGM(LOG, " > Custom mode: {:.0f}x{:.0f}@{}mHz", newState.resolution.x, newState.resolution.y, newState.refresh); + LOGM(Log::DEBUG, " > Custom mode: {:.0f}x{:.0f}@{}mHz", newState.resolution.x, newState.resolution.y, newState.refresh); } if (head->m_state.committedProperties & eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_POSITION) { newState.position = head->m_state.position; newState.committedProperties |= eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_POSITION; - LOGM(LOG, " > Position: {:.0f}, {:.0f}", head->m_state.position.x, head->m_state.position.y); + LOGM(Log::DEBUG, " > Position: {:.0f}, {:.0f}", head->m_state.position.x, head->m_state.position.y); } if (head->m_state.committedProperties & eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_ADAPTIVE_SYNC) { newState.adaptiveSync = head->m_state.adaptiveSync; newState.committedProperties |= eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_ADAPTIVE_SYNC; - LOGM(LOG, " > vrr: {}", newState.adaptiveSync); + LOGM(Log::DEBUG, " > vrr: {}", newState.adaptiveSync); } if (head->m_state.committedProperties & eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_SCALE) { newState.scale = head->m_state.scale; newState.committedProperties |= eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_SCALE; - LOGM(LOG, " > scale: {:.2f}", newState.scale); + LOGM(Log::DEBUG, " > scale: {:.2f}", newState.scale); } if (head->m_state.committedProperties & eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_TRANSFORM) { newState.transform = head->m_state.transform; newState.committedProperties |= eWlrOutputCommittedProperties::OUTPUT_HEAD_COMMITTED_TRANSFORM; - LOGM(LOG, " > transform: {}", (uint8_t)newState.transform); + LOGM(Log::DEBUG, " > transform: {}", (uint8_t)newState.transform); } // reset properties for next set. @@ -425,7 +425,7 @@ bool COutputConfiguration::applyTestConfiguration(bool test) { m_owner->m_monitorStates[PMONITOR->m_name] = newState; } - LOGM(LOG, "Saved configuration"); + LOGM(Log::DEBUG, "Saved configuration"); return true; } @@ -440,12 +440,12 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe const auto MODE = PROTO::outputManagement->modeFromResource(outputMode); if (!MODE || !MODE->getMode()) { - LOGM(ERR, "No mode in setMode??"); + LOGM(Log::ERR, "No mode in setMode??"); return; } if (!m_monitor) { - LOGM(ERR, "setMode on inert resource"); + LOGM(Log::ERR, "setMode on inert resource"); return; } @@ -457,12 +457,12 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe m_state.committedProperties |= OUTPUT_HEAD_COMMITTED_MODE; m_state.mode = MODE; - LOGM(LOG, " | configHead for {}: set mode to {}x{}@{}", m_monitor->m_name, MODE->getMode()->pixelSize.x, MODE->getMode()->pixelSize.y, MODE->getMode()->refreshRate); + LOGM(Log::DEBUG, " | configHead for {}: set mode to {}x{}@{}", m_monitor->m_name, MODE->getMode()->pixelSize.x, MODE->getMode()->pixelSize.y, MODE->getMode()->refreshRate); }); m_resource->setSetCustomMode([this](CZwlrOutputConfigurationHeadV1* r, int32_t w, int32_t h, int32_t refresh) { if (!m_monitor) { - LOGM(ERR, "setCustomMode on inert resource"); + LOGM(Log::ERR, "setCustomMode on inert resource"); return; } @@ -477,19 +477,19 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe } if (refresh == 0) { - LOGM(LOG, " | configHead for {}: refreshRate 0, using old refresh rate of {:.2f}Hz", m_monitor->m_name, m_monitor->m_refreshRate); + LOGM(Log::DEBUG, " | configHead for {}: refreshRate 0, using old refresh rate of {:.2f}Hz", m_monitor->m_name, m_monitor->m_refreshRate); refresh = std::round(m_monitor->m_refreshRate * 1000.F); } m_state.committedProperties |= OUTPUT_HEAD_COMMITTED_CUSTOM_MODE; m_state.customMode = {{w, h}, sc<uint32_t>(refresh)}; - LOGM(LOG, " | configHead for {}: set custom mode to {}x{}@{}", m_monitor->m_name, w, h, refresh); + LOGM(Log::DEBUG, " | configHead for {}: set custom mode to {}x{}@{}", m_monitor->m_name, w, h, refresh); }); m_resource->setSetPosition([this](CZwlrOutputConfigurationHeadV1* r, int32_t x, int32_t y) { if (!m_monitor) { - LOGM(ERR, "setMode on inert resource"); + LOGM(Log::ERR, "setMode on inert resource"); return; } @@ -501,12 +501,12 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe m_state.committedProperties |= OUTPUT_HEAD_COMMITTED_POSITION; m_state.position = {x, y}; - LOGM(LOG, " | configHead for {}: set pos to {}, {}", m_monitor->m_name, x, y); + LOGM(Log::DEBUG, " | configHead for {}: set pos to {}, {}", m_monitor->m_name, x, y); }); m_resource->setSetTransform([this](CZwlrOutputConfigurationHeadV1* r, int32_t transform) { if (!m_monitor) { - LOGM(ERR, "setMode on inert resource"); + LOGM(Log::ERR, "setMode on inert resource"); return; } @@ -523,12 +523,12 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe m_state.committedProperties |= OUTPUT_HEAD_COMMITTED_TRANSFORM; m_state.transform = sc<wl_output_transform>(transform); - LOGM(LOG, " | configHead for {}: set transform to {}", m_monitor->m_name, transform); + LOGM(Log::DEBUG, " | configHead for {}: set transform to {}", m_monitor->m_name, transform); }); m_resource->setSetScale([this](CZwlrOutputConfigurationHeadV1* r, wl_fixed_t scale_) { if (!m_monitor) { - LOGM(ERR, "setMode on inert resource"); + LOGM(Log::ERR, "setMode on inert resource"); return; } @@ -547,12 +547,12 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe m_state.committedProperties |= OUTPUT_HEAD_COMMITTED_SCALE; m_state.scale = scale; - LOGM(LOG, " | configHead for {}: set scale to {:.2f}", m_monitor->m_name, scale); + LOGM(Log::DEBUG, " | configHead for {}: set scale to {:.2f}", m_monitor->m_name, scale); }); m_resource->setSetAdaptiveSync([this](CZwlrOutputConfigurationHeadV1* r, uint32_t as) { if (!m_monitor) { - LOGM(ERR, "setMode on inert resource"); + LOGM(Log::ERR, "setMode on inert resource"); return; } @@ -569,7 +569,7 @@ COutputConfigurationHead::COutputConfigurationHead(SP<CZwlrOutputConfigurationHe m_state.committedProperties |= OUTPUT_HEAD_COMMITTED_ADAPTIVE_SYNC; m_state.adaptiveSync = as; - LOGM(LOG, " | configHead for {}: set adaptiveSync to {}", m_monitor->m_name, as); + LOGM(Log::DEBUG, " | configHead for {}: set adaptiveSync to {}", m_monitor->m_name, as); }); } @@ -657,7 +657,7 @@ void COutputManagementProtocol::sendPendingSuccessEvents() { if (m_pendingConfigurationSuccessEvents.empty()) return; - LOGM(LOG, "Sending {} pending configuration success events", m_pendingConfigurationSuccessEvents.size()); + LOGM(Log::DEBUG, "Sending {} pending configuration success events", m_pendingConfigurationSuccessEvents.size()); for (auto const& config : m_pendingConfigurationSuccessEvents) { if (!config) diff --git a/src/protocols/PointerConstraints.cpp b/src/protocols/PointerConstraints.cpp index 1277ba12..a78f3548 100644 --- a/src/protocols/PointerConstraints.cpp +++ b/src/protocols/PointerConstraints.cpp @@ -217,14 +217,14 @@ void CPointerConstraintsProtocol::destroyPointerConstraint(CPointerConstraint* h void CPointerConstraintsProtocol::onNewConstraint(SP<CPointerConstraint> constraint, CZwpPointerConstraintsV1* pMgr) { if UNLIKELY (!constraint->good()) { - LOGM(ERR, "Couldn't create constraint??"); + LOGM(Log::ERR, "Couldn't create constraint??"); pMgr->noMemory(); m_constraints.pop_back(); return; } if UNLIKELY (!constraint->owner()) { - LOGM(ERR, "New constraint has no CWLSurface owner??"); + LOGM(Log::ERR, "New constraint has no CWLSurface owner??"); return; } @@ -233,7 +233,7 @@ void CPointerConstraintsProtocol::onNewConstraint(SP<CPointerConstraint> constra const auto DUPES = std::ranges::count_if(m_constraints, [OWNER](const auto& c) { return c->owner() == OWNER; }); if UNLIKELY (DUPES > 1) { - LOGM(ERR, "Constraint for surface duped"); + LOGM(Log::ERR, "Constraint for surface duped"); pMgr->error(ZWP_POINTER_CONSTRAINTS_V1_ERROR_ALREADY_CONSTRAINED, "Surface already confined"); m_constraints.pop_back(); return; diff --git a/src/protocols/PointerGestures.cpp b/src/protocols/PointerGestures.cpp index 00576778..eb14bbf8 100644 --- a/src/protocols/PointerGestures.cpp +++ b/src/protocols/PointerGestures.cpp @@ -75,7 +75,7 @@ void CPointerGesturesProtocol::onGetPinchGesture(CZwpPointerGesturesV1* pMgr, ui if UNLIKELY (!RESOURCE->good()) { pMgr->noMemory(); - LOGM(ERR, "Couldn't create gesture"); + LOGM(Log::ERR, "Couldn't create gesture"); return; } } @@ -86,7 +86,7 @@ void CPointerGesturesProtocol::onGetSwipeGesture(CZwpPointerGesturesV1* pMgr, ui if UNLIKELY (!RESOURCE->good()) { pMgr->noMemory(); - LOGM(ERR, "Couldn't create gesture"); + LOGM(Log::ERR, "Couldn't create gesture"); return; } } @@ -97,7 +97,7 @@ void CPointerGesturesProtocol::onGetHoldGesture(CZwpPointerGesturesV1* pMgr, uin if UNLIKELY (!RESOURCE->good()) { pMgr->noMemory(); - LOGM(ERR, "Couldn't create gesture"); + LOGM(Log::ERR, "Couldn't create gesture"); return; } } diff --git a/src/protocols/PointerWarp.cpp b/src/protocols/PointerWarp.cpp index 83be492e..a297a04d 100644 --- a/src/protocols/PointerWarp.cpp +++ b/src/protocols/PointerWarp.cpp @@ -41,7 +41,7 @@ void CPointerWarpProtocol::bindManager(wl_client* client, void* data, uint32_t v if (!g_pSeatManager->serialValid(PSEAT, serial, false)) return; - LOGM(LOG, "warped pointer to {}", GLOBALPOS); + LOGM(Log::DEBUG, "warped pointer to {}", GLOBALPOS); g_pPointerManager->warpTo(GLOBALPOS); g_pSeatManager->sendPointerMotion(Time::millis(Time::steadyNow()), LOCALPOS); diff --git a/src/protocols/PresentationTime.cpp b/src/protocols/PresentationTime.cpp index 9849eb35..82c4b1eb 100644 --- a/src/protocols/PresentationTime.cpp +++ b/src/protocols/PresentationTime.cpp @@ -126,7 +126,7 @@ void CPresentationProtocol::onPresented(PHLMONITOR pMonitor, const Time::steady_ } if (m_feedbacks.size() > 10000) { - LOGM(ERR, "FIXME: presentation has a feedback leak, and has grown to {} pending entries!!! Dropping!!!!!", m_feedbacks.size()); + LOGM(Log::ERR, "FIXME: presentation has a feedback leak, and has grown to {} pending entries!!! Dropping!!!!!", m_feedbacks.size()); // Move the elements from the 9000th position to the end of the vector. std::vector<UP<CPresentationFeedback>> newFeedbacks; diff --git a/src/protocols/PrimarySelection.cpp b/src/protocols/PrimarySelection.cpp index dd0eefad..7da1fa0a 100644 --- a/src/protocols/PrimarySelection.cpp +++ b/src/protocols/PrimarySelection.cpp @@ -15,16 +15,16 @@ CPrimarySelectionOffer::CPrimarySelectionOffer(SP<CZwpPrimarySelectionOfferV1> r m_resource->setReceive([this](CZwpPrimarySelectionOfferV1* r, const char* mime, int32_t fd) { CFileDescriptor sendFd{fd}; if (!m_source) { - LOGM(WARN, "Possible bug: Receive on an offer w/o a source"); + LOGM(Log::WARN, "Possible bug: Receive on an offer w/o a source"); return; } if (m_dead) { - LOGM(WARN, "Possible bug: Receive on an offer that's dead"); + LOGM(Log::WARN, "Possible bug: Receive on an offer that's dead"); return; } - LOGM(LOG, "Offer {:x} asks to send data from source {:x}", (uintptr_t)this, (uintptr_t)m_source.get()); + LOGM(Log::DEBUG, "Offer {:x} asks to send data from source {:x}", (uintptr_t)this, (uintptr_t)m_source.get()); m_source->send(mime, std::move(sendFd)); }); @@ -80,7 +80,7 @@ std::vector<std::string> CPrimarySelectionSource::mimes() { void CPrimarySelectionSource::send(const std::string& mime, CFileDescriptor fd) { if (std::ranges::find(m_mimeTypes, mime) == m_mimeTypes.end()) { - LOGM(ERR, "Compositor/App bug: CPrimarySelectionSource::sendAskSend with non-existent mime"); + LOGM(Log::ERR, "Compositor/App bug: CPrimarySelectionSource::sendAskSend with non-existent mime"); return; } @@ -89,7 +89,7 @@ void CPrimarySelectionSource::send(const std::string& mime, CFileDescriptor fd) void CPrimarySelectionSource::accepted(const std::string& mime) { if (std::ranges::find(m_mimeTypes, mime) == m_mimeTypes.end()) - LOGM(ERR, "Compositor/App bug: CPrimarySelectionSource::sendAccepted with non-existent mime"); + LOGM(Log::ERR, "Compositor/App bug: CPrimarySelectionSource::sendAccepted with non-existent mime"); // primary sel has no accepted } @@ -115,24 +115,24 @@ CPrimarySelectionDevice::CPrimarySelectionDevice(SP<CZwpPrimarySelectionDeviceV1 static auto PPRIMARYSEL = CConfigValue<Hyprlang::INT>("misc:middle_click_paste"); if (!*PPRIMARYSEL) { - LOGM(LOG, "Ignoring primary selection: disabled in config"); + LOGM(Log::DEBUG, "Ignoring primary selection: disabled in config"); g_pSeatManager->setCurrentPrimarySelection(nullptr); return; } auto source = sourceR ? CPrimarySelectionSource::fromResource(sourceR) : CSharedPointer<CPrimarySelectionSource>{}; if (!source) { - LOGM(LOG, "wlr reset selection received"); + LOGM(Log::DEBUG, "wlr reset selection received"); g_pSeatManager->setCurrentPrimarySelection(nullptr); return; } if (source && source->used()) - LOGM(WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this."); + LOGM(Log::WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this."); source->markUsed(); - LOGM(LOG, "wlr manager requests selection to {:x}", (uintptr_t)source.get()); + LOGM(Log::DEBUG, "wlr manager requests selection to {:x}", (uintptr_t)source.get()); g_pSeatManager->setCurrentPrimarySelection(source); }); } @@ -181,7 +181,7 @@ CPrimarySelectionManager::CPrimarySelectionManager(SP<CZwpPrimarySelectionDevice s->m_device = RESOURCE; } - LOGM(LOG, "New primary selection data device bound at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New primary selection data device bound at {:x}", (uintptr_t)RESOURCE.get()); }); m_resource->setCreateSource([this](CZwpPrimarySelectionDeviceManagerV1* r, uint32_t id) { @@ -197,13 +197,13 @@ CPrimarySelectionManager::CPrimarySelectionManager(SP<CZwpPrimarySelectionDevice } if (!m_device) - LOGM(WARN, "New data source before a device was created"); + LOGM(Log::WARN, "New data source before a device was created"); RESOURCE->m_self = RESOURCE; m_sources.emplace_back(RESOURCE); - LOGM(LOG, "New primary selection data source bound at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New primary selection data source bound at {:x}", (uintptr_t)RESOURCE.get()); }); } @@ -224,7 +224,7 @@ void CPrimarySelectionProtocol::bindManager(wl_client* client, void* data, uint3 return; } - LOGM(LOG, "New primary_seletion_manager at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New primary_seletion_manager at {:x}", (uintptr_t)RESOURCE.get()); // we need to do it here because protocols come before seatMgr if (!m_listeners.onPointerFocusChange) @@ -262,7 +262,7 @@ void CPrimarySelectionProtocol::sendSelectionToDevice(SP<CPrimarySelectionDevice return; } - LOGM(LOG, "New offer {:x} for data source {:x}", (uintptr_t)OFFER.get(), (uintptr_t)sel.get()); + LOGM(Log::DEBUG, "New offer {:x} for data source {:x}", (uintptr_t)OFFER.get(), (uintptr_t)sel.get()); dev->sendDataOffer(OFFER); OFFER->sendData(); @@ -277,7 +277,7 @@ void CPrimarySelectionProtocol::setSelection(SP<IDataSource> source) { } if (!source) { - LOGM(LOG, "resetting selection"); + LOGM(Log::DEBUG, "resetting selection"); if (!g_pSeatManager->m_state.pointerFocusResource) return; @@ -289,7 +289,7 @@ void CPrimarySelectionProtocol::setSelection(SP<IDataSource> source) { return; } - LOGM(LOG, "New selection for data source {:x}", (uintptr_t)source.get()); + LOGM(Log::DEBUG, "New selection for data source {:x}", (uintptr_t)source.get()); if (!g_pSeatManager->m_state.pointerFocusResource) return; @@ -297,7 +297,7 @@ void CPrimarySelectionProtocol::setSelection(SP<IDataSource> source) { auto DESTDEVICE = dataDeviceForClient(g_pSeatManager->m_state.pointerFocusResource->client()); if (!DESTDEVICE) { - LOGM(LOG, "CWLDataDeviceProtocol::setSelection: cannot send selection to a client without a data_device"); + LOGM(Log::DEBUG, "CWLDataDeviceProtocol::setSelection: cannot send selection to a client without a data_device"); g_pSeatManager->m_selection.currentPrimarySelection.reset(); return; } @@ -313,7 +313,7 @@ void CPrimarySelectionProtocol::updateSelection() { auto DESTDEVICE = dataDeviceForClient(g_pSeatManager->m_state.pointerFocusResource->client()); if (!selection || !DESTDEVICE) { - LOGM(LOG, "CPrimarySelectionProtocol::updateSelection: cannot send selection to a client without a data_device"); + LOGM(Log::DEBUG, "CPrimarySelectionProtocol::updateSelection: cannot send selection to a client without a data_device"); return; } diff --git a/src/protocols/Screencopy.cpp b/src/protocols/Screencopy.cpp index 36b11298..5507b5b3 100644 --- a/src/protocols/Screencopy.cpp +++ b/src/protocols/Screencopy.cpp @@ -27,7 +27,7 @@ CScreencopyFrame::CScreencopyFrame(SP<CZwlrScreencopyFrameV1> resource_, int32_t m_monitor = CWLOutputResource::fromResource(output)->m_monitor; if (!m_monitor) { - LOGM(ERR, "Client requested sharing of a monitor that doesn't exist"); + LOGM(Log::ERR, "Client requested sharing of a monitor that doesn't exist"); m_resource->sendFailed(); return; } @@ -44,7 +44,7 @@ CScreencopyFrame::CScreencopyFrame(SP<CZwlrScreencopyFrameV1> resource_, int32_t m_shmFormat = g_pHyprOpenGL->getPreferredReadFormat(m_monitor.lock()); if (m_shmFormat == DRM_FORMAT_INVALID) { - LOGM(ERR, "No format supported by renderer in capture output"); + LOGM(Log::ERR, "No format supported by renderer in capture output"); m_resource->sendFailed(); return; } @@ -55,7 +55,7 @@ CScreencopyFrame::CScreencopyFrame(SP<CZwlrScreencopyFrameV1> resource_, int32_t const auto PSHMINFO = NFormatUtils::getPixelFormatFromDRM(m_shmFormat); if (!PSHMINFO) { - LOGM(ERR, "No pixel format supported by renderer in capture output"); + LOGM(Log::ERR, "No pixel format supported by renderer in capture output"); m_resource->sendFailed(); return; } @@ -86,33 +86,33 @@ CScreencopyFrame::CScreencopyFrame(SP<CZwlrScreencopyFrameV1> resource_, int32_t void CScreencopyFrame::copy(CZwlrScreencopyFrameV1* pFrame, wl_resource* buffer_) { if UNLIKELY (!good()) { - LOGM(ERR, "No frame in copyFrame??"); + LOGM(Log::ERR, "No frame in copyFrame??"); return; } if UNLIKELY (!g_pCompositor->monitorExists(m_monitor.lock())) { - LOGM(ERR, "Client requested sharing of a monitor that is gone"); + LOGM(Log::ERR, "Client requested sharing of a monitor that is gone"); m_resource->sendFailed(); return; } const auto PBUFFER = CWLBufferResource::fromResource(buffer_); if UNLIKELY (!PBUFFER) { - LOGM(ERR, "Invalid buffer in {:x}", (uintptr_t)this); + LOGM(Log::ERR, "Invalid buffer in {:x}", (uintptr_t)this); m_resource->error(ZWLR_SCREENCOPY_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer"); PROTO::screencopy->destroyResource(this); return; } if UNLIKELY (PBUFFER->m_buffer->size != m_box.size()) { - LOGM(ERR, "Invalid dimensions in {:x}", (uintptr_t)this); + LOGM(Log::ERR, "Invalid dimensions in {:x}", (uintptr_t)this); m_resource->error(ZWLR_SCREENCOPY_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer dimensions"); PROTO::screencopy->destroyResource(this); return; } if UNLIKELY (m_buffer) { - LOGM(ERR, "Buffer used in {:x}", (uintptr_t)this); + LOGM(Log::ERR, "Buffer used in {:x}", (uintptr_t)this); m_resource->error(ZWLR_SCREENCOPY_FRAME_V1_ERROR_ALREADY_USED, "frame already used"); PROTO::screencopy->destroyResource(this); return; @@ -122,25 +122,25 @@ void CScreencopyFrame::copy(CZwlrScreencopyFrameV1* pFrame, wl_resource* buffer_ m_bufferDMA = true; if (attrs.format != m_dmabufFormat) { - LOGM(ERR, "Invalid buffer dma format in {:x}", (uintptr_t)pFrame); + LOGM(Log::ERR, "Invalid buffer dma format in {:x}", (uintptr_t)pFrame); m_resource->error(ZWLR_SCREENCOPY_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer format"); PROTO::screencopy->destroyResource(this); return; } } else if (auto attrs = PBUFFER->m_buffer->shm(); attrs.success) { if (attrs.format != m_shmFormat) { - LOGM(ERR, "Invalid buffer shm format in {:x}", (uintptr_t)pFrame); + LOGM(Log::ERR, "Invalid buffer shm format in {:x}", (uintptr_t)pFrame); m_resource->error(ZWLR_SCREENCOPY_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer format"); PROTO::screencopy->destroyResource(this); return; } else if (attrs.stride != m_shmStride) { - LOGM(ERR, "Invalid buffer shm stride in {:x}", (uintptr_t)pFrame); + LOGM(Log::ERR, "Invalid buffer shm stride in {:x}", (uintptr_t)pFrame); m_resource->error(ZWLR_SCREENCOPY_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer stride"); PROTO::screencopy->destroyResource(this); return; } } else { - LOGM(ERR, "Invalid buffer type in {:x}", (uintptr_t)pFrame); + LOGM(Log::ERR, "Invalid buffer type in {:x}", (uintptr_t)pFrame); m_resource->error(ZWLR_SCREENCOPY_FRAME_V1_ERROR_INVALID_BUFFER, "invalid buffer type"); PROTO::screencopy->destroyResource(this); return; @@ -167,7 +167,7 @@ void CScreencopyFrame::share() { return; if (!success) { - LOGM(ERR, "{} copy failed in {:x}", m_bufferDMA ? "Dmabuf" : "Shm", (uintptr_t)this); + LOGM(Log::ERR, "{} copy failed in {:x}", m_bufferDMA ? "Dmabuf" : "Shm", (uintptr_t)this); m_resource->sendFailed(); return; } @@ -300,7 +300,7 @@ void CScreencopyFrame::storeTempFB() { CRegion fakeDamage = {0, 0, INT16_MAX, INT16_MAX}; if (!g_pHyprRenderer->beginRender(m_monitor.lock(), fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, &m_tempFb, true)) { - LOGM(ERR, "Can't copy: failed to begin rendering to temp fb"); + LOGM(Log::ERR, "Can't copy: failed to begin rendering to temp fb"); return; } @@ -315,7 +315,7 @@ void CScreencopyFrame::copyDmabuf(std::function<void(bool)> callback) { CRegion fakeDamage = {0, 0, INT16_MAX, INT16_MAX}; if (!g_pHyprRenderer->beginRender(m_monitor.lock(), fakeDamage, RENDER_MODE_TO_BUFFER, m_buffer.m_buffer, nullptr, true)) { - LOGM(ERR, "Can't copy: failed to begin rendering to dma frame"); + LOGM(Log::ERR, "Can't copy: failed to begin rendering to dma frame"); callback(false); return; } @@ -338,7 +338,7 @@ void CScreencopyFrame::copyDmabuf(std::function<void(bool)> callback) { g_pHyprOpenGL->m_renderData.blockScreenShader = true; g_pHyprRenderer->endRender([callback]() { - LOGM(TRACE, "Copied frame via dma"); + LOGM(Log::TRACE, "Copied frame via dma"); callback(true); }); } @@ -357,7 +357,7 @@ bool CScreencopyFrame::copyShm() { fb.alloc(m_box.w, m_box.h, m_monitor->m_output->state->state().drmFormat); if (!g_pHyprRenderer->beginRender(m_monitor.lock(), fakeDamage, RENDER_MODE_FULL_FAKE, nullptr, &fb, true)) { - LOGM(ERR, "Can't copy: failed to begin rendering"); + LOGM(Log::ERR, "Can't copy: failed to begin rendering"); return false; } @@ -380,7 +380,7 @@ bool CScreencopyFrame::copyShm() { const auto PFORMAT = NFormatUtils::getPixelFormatFromDRM(shm.format); if (!PFORMAT) { - LOGM(ERR, "Can't copy: failed to find a pixel format"); + LOGM(Log::ERR, "Can't copy: failed to find a pixel format"); g_pHyprRenderer->endRender(); return false; } @@ -414,7 +414,7 @@ bool CScreencopyFrame::copyShm() { glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); - LOGM(TRACE, "Copied frame via shm"); + LOGM(Log::TRACE, "Copied frame via shm"); return true; } @@ -448,7 +448,7 @@ void CScreencopyClient::captureOutput(uint32_t frame, int32_t overlayCursor_, wl makeShared<CScreencopyFrame>(makeShared<CZwlrScreencopyFrameV1>(m_resource->client(), m_resource->version(), frame), overlayCursor_, output, box)); if (!FRAME->good()) { - LOGM(ERR, "Couldn't alloc frame for sharing! (no memory)"); + LOGM(Log::ERR, "Couldn't alloc frame for sharing! (no memory)"); m_resource->noMemory(); PROTO::screencopy->destroyResource(FRAME.get()); return; @@ -496,7 +496,7 @@ void CScreencopyProtocol::bindManager(wl_client* client, void* data, uint32_t ve const auto CLIENT = m_clients.emplace_back(makeShared<CScreencopyClient>(makeShared<CZwlrScreencopyManagerV1>(client, ver, id))); if (!CLIENT->good()) { - LOGM(LOG, "Failed to bind client! (out of memory)"); + LOGM(Log::DEBUG, "Failed to bind client! (out of memory)"); CLIENT->m_resource->noMemory(); m_clients.pop_back(); return; @@ -504,7 +504,7 @@ void CScreencopyProtocol::bindManager(wl_client* client, void* data, uint32_t ve CLIENT->m_self = CLIENT; - LOGM(LOG, "Bound client successfully!"); + LOGM(Log::DEBUG, "Bound client successfully!"); } void CScreencopyProtocol::destroyResource(CScreencopyClient* client) { diff --git a/src/protocols/SecurityContext.cpp b/src/protocols/SecurityContext.cpp index 00f7b4d8..6c7f8226 100644 --- a/src/protocols/SecurityContext.cpp +++ b/src/protocols/SecurityContext.cpp @@ -53,15 +53,15 @@ CSecurityContext::CSecurityContext(SP<CWpSecurityContextV1> resource_, int liste return; m_resource->setDestroy([this](CWpSecurityContextV1* r) { - LOGM(LOG, "security_context at 0x{:x}: resource destroyed, keeping context until fd hangup", (uintptr_t)this); + LOGM(Log::DEBUG, "security_context at 0x{:x}: resource destroyed, keeping context until fd hangup", (uintptr_t)this); m_resource = nullptr; }); m_resource->setOnDestroy([this](CWpSecurityContextV1* r) { - LOGM(LOG, "security_context at 0x{:x}: resource destroyed, keeping context until fd hangup", (uintptr_t)this); + LOGM(Log::DEBUG, "security_context at 0x{:x}: resource destroyed, keeping context until fd hangup", (uintptr_t)this); m_resource = nullptr; }); - LOGM(LOG, "New security_context at 0x{:x}", (uintptr_t)this); + LOGM(Log::DEBUG, "New security_context at 0x{:x}", (uintptr_t)this); m_resource->setSetSandboxEngine([this](CWpSecurityContextV1* r, const char* engine) { if UNLIKELY (!m_sandboxEngine.empty()) { @@ -75,7 +75,7 @@ CSecurityContext::CSecurityContext(SP<CWpSecurityContextV1> resource_, int liste } m_sandboxEngine = engine ? engine : "(null)"; - LOGM(LOG, "security_context at 0x{:x} sets engine to {}", (uintptr_t)this, m_sandboxEngine); + LOGM(Log::DEBUG, "security_context at 0x{:x} sets engine to {}", (uintptr_t)this, m_sandboxEngine); }); m_resource->setSetAppId([this](CWpSecurityContextV1* r, const char* appid) { @@ -90,7 +90,7 @@ CSecurityContext::CSecurityContext(SP<CWpSecurityContextV1> resource_, int liste } m_appID = appid ? appid : "(null)"; - LOGM(LOG, "security_context at 0x{:x} sets appid to {}", (uintptr_t)this, m_appID); + LOGM(Log::DEBUG, "security_context at 0x{:x} sets appid to {}", (uintptr_t)this, m_appID); }); m_resource->setSetInstanceId([this](CWpSecurityContextV1* r, const char* instance) { @@ -105,13 +105,13 @@ CSecurityContext::CSecurityContext(SP<CWpSecurityContextV1> resource_, int liste } m_instanceID = instance ? instance : "(null)"; - LOGM(LOG, "security_context at 0x{:x} sets instance to {}", (uintptr_t)this, m_instanceID); + LOGM(Log::DEBUG, "security_context at 0x{:x} sets instance to {}", (uintptr_t)this, m_instanceID); }); m_resource->setCommit([this](CWpSecurityContextV1* r) { m_committed = true; - LOGM(LOG, "security_context at 0x{:x} commits", (uintptr_t)this); + LOGM(Log::DEBUG, "security_context at 0x{:x} commits", (uintptr_t)this); m_listenSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, m_listenFD.get(), WL_EVENT_READABLE, ::onListenFdEvent, this); m_closeSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, m_closeFD.get(), 0, ::onCloseFdEvent, this); @@ -136,7 +136,7 @@ bool CSecurityContext::good() { void CSecurityContext::onListen(uint32_t mask) { if UNLIKELY (mask & (WL_EVENT_HANGUP | WL_EVENT_ERROR)) { - LOGM(ERR, "security_context at 0x{:x} got an error in listen", (uintptr_t)this); + LOGM(Log::ERR, "security_context at 0x{:x} got an error in listen", (uintptr_t)this); PROTO::securityContext->destroyContext(this); return; } @@ -146,19 +146,19 @@ void CSecurityContext::onListen(uint32_t mask) { CFileDescriptor clientFD{accept(m_listenFD.get(), nullptr, nullptr)}; if UNLIKELY (!clientFD.isValid()) { - LOGM(ERR, "security_context at 0x{:x} couldn't accept", (uintptr_t)this); + LOGM(Log::ERR, "security_context at 0x{:x} couldn't accept", (uintptr_t)this); return; } auto newClient = CSecurityContextSandboxedClient::create(std::move(clientFD)); if UNLIKELY (!newClient) { - LOGM(ERR, "security_context at 0x{:x} couldn't create a client", (uintptr_t)this); + LOGM(Log::ERR, "security_context at 0x{:x} couldn't create a client", (uintptr_t)this); return; } PROTO::securityContext->m_sandboxedClients.emplace_back(newClient); - LOGM(LOG, "security_context at 0x{:x} got a new wl_client 0x{:x}", (uintptr_t)this, (uintptr_t)newClient->m_client); + LOGM(Log::DEBUG, "security_context at 0x{:x} got a new wl_client 0x{:x}", (uintptr_t)this, (uintptr_t)newClient->m_client); } void CSecurityContext::onClose(uint32_t mask) { diff --git a/src/protocols/SessionLock.cpp b/src/protocols/SessionLock.cpp index 3dab394b..88231f38 100644 --- a/src/protocols/SessionLock.cpp +++ b/src/protocols/SessionLock.cpp @@ -26,13 +26,13 @@ CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_, m_listeners.surfaceCommit = m_surface->m_events.commit.listen([this] { if (!m_surface->m_current.texture) { - LOGM(ERR, "SessionLock attached a null buffer"); + LOGM(Log::ERR, "SessionLock attached a null buffer"); m_resource->error(EXT_SESSION_LOCK_SURFACE_V1_ERROR_NULL_BUFFER, "Null buffer attached"); return; } if (!m_ackdConfigure) { - LOGM(ERR, "SessionLock committed without an ack"); + LOGM(Log::ERR, "SessionLock committed without an ack"); m_resource->error(EXT_SESSION_LOCK_SURFACE_V1_ERROR_COMMIT_BEFORE_FIRST_ACK, "Committed surface before first ack"); return; } @@ -47,7 +47,7 @@ CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_, }); m_listeners.surfaceDestroy = m_surface->m_events.destroy.listen([this] { - LOGM(WARN, "SessionLockSurface object remains but surface is being destroyed???"); + LOGM(Log::WARN, "SessionLockSurface object remains but surface is being destroyed???"); m_surface->unmap(); m_listeners.surfaceCommit.reset(); m_listeners.surfaceDestroy.reset(); @@ -79,7 +79,7 @@ CSessionLockSurface::~CSessionLockSurface() { void CSessionLockSurface::sendConfigure() { if (!m_monitor) { - LOGM(ERR, "sendConfigure: monitor is gone"); + LOGM(Log::ERR, "sendConfigure: monitor is gone"); return; } @@ -112,7 +112,7 @@ CSessionLock::CSessionLock(SP<CExtSessionLockV1> resource_) : m_resource(resourc m_resource->setGetLockSurface([this](CExtSessionLockV1* r, uint32_t id, wl_resource* surf, wl_resource* output) { if (m_inert) { - LOGM(ERR, "Lock is trying to send getLockSurface after it's inert"); + LOGM(Log::ERR, "Lock is trying to send getLockSurface after it's inert"); return; } @@ -184,7 +184,7 @@ void CSessionLockProtocol::destroyResource(CSessionLockSurface* surf) { void CSessionLockProtocol::onLock(CExtSessionLockManagerV1* pMgr, uint32_t id) { - LOGM(LOG, "New sessionLock with id {}", id); + LOGM(Log::DEBUG, "New sessionLock with id {}", id); const auto CLIENT = pMgr->client(); const auto RESOURCE = m_locks.emplace_back(makeShared<CSessionLock>(makeShared<CExtSessionLockV1>(CLIENT, pMgr->version(), id))); @@ -201,7 +201,7 @@ void CSessionLockProtocol::onLock(CExtSessionLockManagerV1* pMgr, uint32_t id) { } void CSessionLockProtocol::onGetLockSurface(CExtSessionLockV1* lock, uint32_t id, wl_resource* surface, wl_resource* output) { - LOGM(LOG, "New sessionLockSurface with id {}", id); + LOGM(Log::DEBUG, "New sessionLockSurface with id {}", id); auto PSURFACE = CWLSurfaceResource::fromResource(surface); auto PMONITOR = CWLOutputResource::fromResource(output)->m_monitor.lock(); diff --git a/src/protocols/ShortcutsInhibit.cpp b/src/protocols/ShortcutsInhibit.cpp index e42bf172..6e6bf002 100644 --- a/src/protocols/ShortcutsInhibit.cpp +++ b/src/protocols/ShortcutsInhibit.cpp @@ -62,7 +62,7 @@ void CKeyboardShortcutsInhibitProtocol::onInhibit(CZwpKeyboardShortcutsInhibitMa if UNLIKELY (!RESOURCE->good()) { pMgr->noMemory(); m_inhibitors.pop_back(); - LOGM(ERR, "Failed to create an inhibitor resource"); + LOGM(Log::ERR, "Failed to create an inhibitor resource"); return; } } diff --git a/src/protocols/SinglePixel.cpp b/src/protocols/SinglePixel.cpp index e291711d..51c3551c 100644 --- a/src/protocols/SinglePixel.cpp +++ b/src/protocols/SinglePixel.cpp @@ -4,7 +4,7 @@ #include "render/Renderer.hpp" CSinglePixelBuffer::CSinglePixelBuffer(uint32_t id, wl_client* client, CHyprColor col_) { - LOGM(LOG, "New single-pixel buffer with color 0x{:x}", col_.getAsHex()); + LOGM(Log::DEBUG, "New single-pixel buffer with color 0x{:x}", col_.getAsHex()); m_color = col_.getAsHex(); @@ -21,7 +21,7 @@ CSinglePixelBuffer::CSinglePixelBuffer(uint32_t id, wl_client* client, CHyprColo size = {1, 1}; if (!m_success) - Debug::log(ERR, "Failed creating a single pixel texture: null texture id"); + Log::logger->log(Log::ERR, "Failed creating a single pixel texture: null texture id"); } CSinglePixelBuffer::~CSinglePixelBuffer() { diff --git a/src/protocols/Tablet.cpp b/src/protocols/Tablet.cpp index b4f3b3eb..00f811a4 100644 --- a/src/protocols/Tablet.cpp +++ b/src/protocols/Tablet.cpp @@ -549,7 +549,7 @@ void CTabletV2Protocol::proximityIn(SP<CTabletTool> tool, SP<CTablet> tablet, SP continue; if (t->m_seat.expired()) { - LOGM(ERR, "proximityIn on a tool without a seat parent"); + LOGM(Log::ERR, "proximityIn on a tool without a seat parent"); return; } @@ -571,7 +571,7 @@ void CTabletV2Protocol::proximityIn(SP<CTabletTool> tool, SP<CTablet> tablet, SP } if (!tabletResource || !toolResource) { - LOGM(ERR, "proximityIn on a tool and tablet without valid resource(s)??"); + LOGM(Log::ERR, "proximityIn on a tool and tablet without valid resource(s)??"); return; } @@ -582,7 +582,7 @@ void CTabletV2Protocol::proximityIn(SP<CTabletTool> tool, SP<CTablet> tablet, SP toolResource->m_resource->sendProximityIn(serial, tabletResource->m_resource.get(), surf->getResource()->resource()); toolResource->queueFrame(); - LOGM(ERR, "proximityIn: found no resource to send enter"); + LOGM(Log::ERR, "proximityIn: found no resource to send enter"); } void CTabletV2Protocol::proximityOut(SP<CTabletTool> tool) { @@ -623,7 +623,7 @@ void CTabletV2Protocol::mode(SP<CTabletPad> pad, uint32_t group, uint32_t mode, if (t->m_pad != pad) continue; if (t->m_groups.size() <= group) { - LOGM(ERR, "BUG THIS: group >= t->groups.size()"); + LOGM(Log::ERR, "BUG THIS: group >= t->groups.size()"); return; } auto serial = g_pSeatManager->nextSerial(g_pSeatManager->seatResourceForClient(t->m_resource->client())); @@ -640,9 +640,9 @@ void CTabletV2Protocol::buttonPad(SP<CTabletPad> pad, uint32_t button, uint32_t } void CTabletV2Protocol::strip(SP<CTabletPad> pad, uint32_t strip, double position, bool finger, uint32_t timeMs) { - LOGM(ERR, "FIXME: STUB: CTabletV2Protocol::strip not implemented"); + LOGM(Log::ERR, "FIXME: STUB: CTabletV2Protocol::strip not implemented"); } void CTabletV2Protocol::ring(SP<CTabletPad> pad, uint32_t ring, double position, bool finger, uint32_t timeMs) { - LOGM(ERR, "FIXME: STUB: CTabletV2Protocol::ring not implemented"); + LOGM(Log::ERR, "FIXME: STUB: CTabletV2Protocol::ring not implemented"); } diff --git a/src/protocols/TextInputV1.cpp b/src/protocols/TextInputV1.cpp index 7143b081..d77bb736 100644 --- a/src/protocols/TextInputV1.cpp +++ b/src/protocols/TextInputV1.cpp @@ -14,7 +14,7 @@ CTextInputV1::CTextInputV1(SP<CZwpTextInputV1> resource_) : m_resource(resource_ m_resource->setActivate([this](CZwpTextInputV1* pMgr, wl_resource* seat, wl_resource* surface) { if UNLIKELY (!surface) { - LOGM(WARN, "Text-input-v1 PTI{:x}: No surface to activate text input on!", (uintptr_t)this); + LOGM(Log::WARN, "Text-input-v1 PTI{:x}: No surface to activate text input on!", (uintptr_t)this); return; } @@ -103,10 +103,10 @@ void CTextInputV1Protocol::bindManager(wl_client* client, void* data, uint32_t v RESOURCE->setOnDestroy([](CZwpTextInputManagerV1* pMgr) { PROTO::textInputV1->destroyResource(pMgr); }); RESOURCE->setCreateTextInput([this](CZwpTextInputManagerV1* pMgr, uint32_t id) { const auto PTI = m_clients.emplace_back(makeShared<CTextInputV1>(makeShared<CZwpTextInputV1>(pMgr->client(), pMgr->version(), id))); - LOGM(LOG, "New TI V1 at {:x}", (uintptr_t)PTI.get()); + LOGM(Log::DEBUG, "New TI V1 at {:x}", (uintptr_t)PTI.get()); if UNLIKELY (!PTI->good()) { - LOGM(ERR, "Could not alloc wl_resource for TIV1"); + LOGM(Log::ERR, "Could not alloc wl_resource for TIV1"); pMgr->noMemory(); PROTO::textInputV1->destroyResource(PTI.get()); return; diff --git a/src/protocols/TextInputV3.cpp b/src/protocols/TextInputV3.cpp index 8a5ee478..595467c4 100644 --- a/src/protocols/TextInputV3.cpp +++ b/src/protocols/TextInputV3.cpp @@ -13,7 +13,7 @@ CTextInputV3::CTextInputV3(SP<CZwpTextInputV3> resource_) : m_resource(resource_ if UNLIKELY (!m_resource->resource()) return; - LOGM(LOG, "New tiv3 at {:016x}", (uintptr_t)this); + LOGM(Log::DEBUG, "New tiv3 at {:016x}", (uintptr_t)this); m_resource->setDestroy([this](CZwpTextInputV3* r) { PROTO::textInputV3->destroyTextInput(this); }); m_resource->setOnDestroy([this](CZwpTextInputV3* r) { PROTO::textInputV3->destroyTextInput(this); }); @@ -132,7 +132,7 @@ void CTextInputV3Protocol::onGetTextInput(CZwpTextInputManagerV3* pMgr, uint32_t if UNLIKELY (!RESOURCE->good()) { pMgr->noMemory(); m_textInputs.pop_back(); - LOGM(ERR, "Failed to create a tiv3 resource"); + LOGM(Log::ERR, "Failed to create a tiv3 resource"); return; } diff --git a/src/protocols/ToplevelExport.cpp b/src/protocols/ToplevelExport.cpp index 9d9d16be..9c9c1e1e 100644 --- a/src/protocols/ToplevelExport.cpp +++ b/src/protocols/ToplevelExport.cpp @@ -38,7 +38,7 @@ void CToplevelExportClient::captureToplevel(CHyprlandToplevelExportManagerV1* pM makeShared<CToplevelExportFrame>(makeShared<CHyprlandToplevelExportFrameV1>(m_resource->client(), m_resource->version(), frame), overlayCursor_, handle)); if UNLIKELY (!FRAME->good()) { - LOGM(ERR, "Couldn't alloc frame for sharing! (no memory)"); + LOGM(Log::ERR, "Couldn't alloc frame for sharing! (no memory)"); m_resource->noMemory(); PROTO::toplevelExport->destroyResource(FRAME.get()); return; @@ -81,13 +81,13 @@ CToplevelExportFrame::CToplevelExportFrame(SP<CHyprlandToplevelExportFrameV1> re m_cursorOverlayRequested = !!overlayCursor_; if UNLIKELY (!m_window) { - LOGM(ERR, "Client requested sharing of window handle {:x} which does not exist!", m_window); + LOGM(Log::ERR, "Client requested sharing of window handle {:x} which does not exist!", m_window); m_resource->sendFailed(); return; } if UNLIKELY (!m_window->m_isMapped) { - LOGM(ERR, "Client requested sharing of window handle {:x} which is not shareable!", m_window); + LOGM(Log::ERR, "Client requested sharing of window handle {:x} which is not shareable!", m_window); m_resource->sendFailed(); return; } @@ -102,14 +102,14 @@ CToplevelExportFrame::CToplevelExportFrame(SP<CHyprlandToplevelExportFrameV1> re m_shmFormat = g_pHyprOpenGL->getPreferredReadFormat(PMONITOR); if UNLIKELY (m_shmFormat == DRM_FORMAT_INVALID) { - LOGM(ERR, "No format supported by renderer in capture toplevel"); + LOGM(Log::ERR, "No format supported by renderer in capture toplevel"); m_resource->sendFailed(); return; } const auto PSHMINFO = NFormatUtils::getPixelFormatFromDRM(m_shmFormat); if UNLIKELY (!PSHMINFO) { - LOGM(ERR, "No pixel format supported by renderer in capture toplevel"); + LOGM(Log::ERR, "No pixel format supported by renderer in capture toplevel"); m_resource->sendFailed(); return; } @@ -132,18 +132,18 @@ CToplevelExportFrame::CToplevelExportFrame(SP<CHyprlandToplevelExportFrameV1> re void CToplevelExportFrame::copy(CHyprlandToplevelExportFrameV1* pFrame, wl_resource* buffer_, int32_t ignoreDamage) { if UNLIKELY (!good()) { - LOGM(ERR, "No frame in copyFrame??"); + LOGM(Log::ERR, "No frame in copyFrame??"); return; } if UNLIKELY (!validMapped(m_window)) { - LOGM(ERR, "Client requested sharing of window handle {:x} which is gone!", m_window); + LOGM(Log::ERR, "Client requested sharing of window handle {:x} which is gone!", m_window); m_resource->sendFailed(); return; } if UNLIKELY (!m_window->m_isMapped) { - LOGM(ERR, "Client requested sharing of window handle {:x} which is not shareable (2)!", m_window); + LOGM(Log::ERR, "Client requested sharing of window handle {:x} which is not shareable (2)!", m_window); m_resource->sendFailed(); return; } @@ -393,7 +393,7 @@ void CToplevelExportProtocol::bindManager(wl_client* client, void* data, uint32_ const auto CLIENT = m_clients.emplace_back(makeShared<CToplevelExportClient>(makeShared<CHyprlandToplevelExportManagerV1>(client, ver, id))); if (!CLIENT->good()) { - LOGM(LOG, "Failed to bind client! (out of memory)"); + LOGM(Log::DEBUG, "Failed to bind client! (out of memory)"); wl_client_post_no_memory(client); m_clients.pop_back(); return; @@ -401,7 +401,7 @@ void CToplevelExportProtocol::bindManager(wl_client* client, void* data, uint32_ CLIENT->m_self = CLIENT; - LOGM(LOG, "Bound client successfully!"); + LOGM(Log::DEBUG, "Bound client successfully!"); } void CToplevelExportProtocol::destroyResource(CToplevelExportClient* client) { diff --git a/src/protocols/ToplevelMapping.cpp b/src/protocols/ToplevelMapping.cpp index 4cc822f0..823956df 100644 --- a/src/protocols/ToplevelMapping.cpp +++ b/src/protocols/ToplevelMapping.cpp @@ -17,7 +17,7 @@ CToplevelMappingManager::CToplevelMappingManager(SP<CHyprlandToplevelMappingMana makeShared<CToplevelWindowMappingHandle>(makeShared<CHyprlandToplevelWindowMappingHandleV1>(m_resource->client(), m_resource->version(), handle))); if UNLIKELY (!NEWHANDLE->m_resource->resource()) { - LOGM(ERR, "Couldn't alloc mapping handle! (no memory)"); + LOGM(Log::ERR, "Couldn't alloc mapping handle! (no memory)"); m_resource->noMemory(); return; } @@ -36,7 +36,7 @@ CToplevelMappingManager::CToplevelMappingManager(SP<CHyprlandToplevelMappingMana makeShared<CToplevelWindowMappingHandle>(makeShared<CHyprlandToplevelWindowMappingHandleV1>(m_resource->client(), m_resource->version(), handle))); if UNLIKELY (!NEWHANDLE->m_resource->resource()) { - LOGM(ERR, "Couldn't alloc mapping handle! (no memory)"); + LOGM(Log::ERR, "Couldn't alloc mapping handle! (no memory)"); m_resource->noMemory(); return; } @@ -62,7 +62,7 @@ void CToplevelMappingProtocol::bindManager(wl_client* client, void* data, uint32 const auto RESOURCE = m_managers.emplace_back(makeUnique<CToplevelMappingManager>(makeShared<CHyprlandToplevelMappingManagerV1>(client, ver, id))).get(); if UNLIKELY (!RESOURCE->good()) { - LOGM(ERR, "Couldn't create a toplevel mapping manager"); + LOGM(Log::ERR, "Couldn't create a toplevel mapping manager"); wl_client_post_no_memory(client); m_managers.pop_back(); return; diff --git a/src/protocols/VirtualKeyboard.cpp b/src/protocols/VirtualKeyboard.cpp index 2acc2298..2f7e0bd1 100644 --- a/src/protocols/VirtualKeyboard.cpp +++ b/src/protocols/VirtualKeyboard.cpp @@ -75,14 +75,14 @@ CVirtualKeyboardV1Resource::CVirtualKeyboardV1Resource(SP<CZwpVirtualKeyboardV1> auto xkbContext = xkb_context_new(XKB_CONTEXT_NO_FLAGS); CFileDescriptor keymapFd{fd}; if UNLIKELY (!xkbContext) { - LOGM(ERR, "xkbContext creation failed"); + LOGM(Log::ERR, "xkbContext creation failed"); r->noMemory(); return; } auto keymapData = mmap(nullptr, len, PROT_READ, MAP_PRIVATE, keymapFd.get(), 0); if UNLIKELY (keymapData == MAP_FAILED) { - LOGM(ERR, "keymapData alloc failed"); + LOGM(Log::ERR, "keymapData alloc failed"); xkb_context_unref(xkbContext); r->noMemory(); return; @@ -92,7 +92,7 @@ CVirtualKeyboardV1Resource::CVirtualKeyboardV1Resource(SP<CZwpVirtualKeyboardV1> munmap(keymapData, len); if UNLIKELY (!xkbKeymap) { - LOGM(ERR, "xkbKeymap creation failed"); + LOGM(Log::ERR, "xkbKeymap creation failed"); xkb_context_unref(xkbContext); r->noMemory(); return; @@ -171,7 +171,7 @@ void CVirtualKeyboardProtocol::onCreateKeeb(CZwpVirtualKeyboardManagerV1* pMgr, return; } - LOGM(LOG, "New VKeyboard at id {}", id); + LOGM(Log::DEBUG, "New VKeyboard at id {}", id); m_events.newKeyboard.emit(RESOURCE); } diff --git a/src/protocols/VirtualPointer.cpp b/src/protocols/VirtualPointer.cpp index 9e258b7a..075f7cb9 100644 --- a/src/protocols/VirtualPointer.cpp +++ b/src/protocols/VirtualPointer.cpp @@ -145,7 +145,7 @@ void CVirtualPointerProtocol::onCreatePointer(CZwlrVirtualPointerManagerV1* pMgr return; } - LOGM(LOG, "New VPointer at id {}", id); + LOGM(Log::DEBUG, "New VPointer at id {}", id); m_events.newPointer.emit(RESOURCE); } diff --git a/src/protocols/WaylandProtocol.cpp b/src/protocols/WaylandProtocol.cpp index 65099248..4cb4f991 100644 --- a/src/protocols/WaylandProtocol.cpp +++ b/src/protocols/WaylandProtocol.cpp @@ -24,7 +24,7 @@ IWaylandProtocol::IWaylandProtocol(const wl_interface* iface, const int& ver, co m_name(name), m_global(wl_global_create(g_pCompositor->m_wlDisplay, iface, ver, this, &bindManagerInternal)) { if UNLIKELY (!m_global) { - LOGM(ERR, "could not create a global [{}]", m_name); + LOGM(Log::ERR, "could not create a global [{}]", m_name); return; } @@ -33,7 +33,7 @@ IWaylandProtocol::IWaylandProtocol(const wl_interface* iface, const int& ver, co m_liDisplayDestroy.parent = this; wl_display_add_destroy_listener(g_pCompositor->m_wlDisplay, &m_liDisplayDestroy.listener); - LOGM(LOG, "Registered global [{}]", m_name); + LOGM(Log::DEBUG, "Registered global [{}]", m_name); } IWaylandProtocol::~IWaylandProtocol() { diff --git a/src/protocols/WaylandProtocol.hpp b/src/protocols/WaylandProtocol.hpp index d46d6aaf..5f1c9798 100644 --- a/src/protocols/WaylandProtocol.hpp +++ b/src/protocols/WaylandProtocol.hpp @@ -4,6 +4,7 @@ #include "../helpers/memory/Memory.hpp" #include <functional> +#include <sstream> #define RESOURCE_OR_BAIL(resname) \ const auto resname = (CWaylandResource*)wl_resource_get_user_data(resource); \ @@ -28,16 +29,16 @@ #define LOGM(level, ...) \ do { \ std::ostringstream oss; \ - if (level == WARN || level == ERR || level == CRIT) { \ + if (level == Log::WARN || level == Log::ERR || level == Log::CRIT) { \ oss << "[" << __FILE__ << ":" << __LINE__ << "] "; \ - } else if (level == LOG || level == INFO || level == TRACE) { \ + } else if (level == Log::DEBUG || level == Log::INFO || level == Log::TRACE) { \ oss << "[" << EXTRACT_CLASS_NAME() << "] "; \ } \ if constexpr (std::tuple_size<decltype(std::make_tuple(__VA_ARGS__))>::value == 1 && std::is_same_v<decltype(__VA_ARGS__), std::string>) { \ oss << __VA_ARGS__; \ - Debug::log(level, oss.str()); \ + Log::logger->log(level, oss.str()); \ } else { \ - Debug::log(level, std::format("{}{}", oss.str(), std::format(__VA_ARGS__))); \ + Log::logger->log(level, std::format("{}{}", oss.str(), std::format(__VA_ARGS__))); \ } \ } while (0) diff --git a/src/protocols/XDGActivation.cpp b/src/protocols/XDGActivation.cpp index f25ffca8..3d094fca 100644 --- a/src/protocols/XDGActivation.cpp +++ b/src/protocols/XDGActivation.cpp @@ -19,7 +19,7 @@ CXDGActivationToken::CXDGActivationToken(SP<CXdgActivationTokenV1> resource_) : // TODO: should we send a protocol error of already_used here // if it was used? the protocol spec doesn't say _when_ it should be sent... if UNLIKELY (m_committed) { - LOGM(WARN, "possible protocol error, two commits from one token. Ignoring."); + LOGM(Log::WARN, "possible protocol error, two commits from one token. Ignoring."); return; } @@ -27,7 +27,7 @@ CXDGActivationToken::CXDGActivationToken(SP<CXdgActivationTokenV1> resource_) : // send done with a new token m_token = g_pTokenManager->registerNewToken({}, std::chrono::months{12}); - LOGM(LOG, "assigned new xdg-activation token {}", m_token); + LOGM(Log::DEBUG, "assigned new xdg-activation token {}", m_token); m_resource->sendDone(m_token.c_str()); @@ -70,7 +70,7 @@ void CXDGActivationProtocol::bindManager(wl_client* client, void* data, uint32_t auto TOKEN = std::ranges::find_if(m_sentTokens, [token](const auto& t) { return t.token == token; }); if UNLIKELY (TOKEN == m_sentTokens.end()) { - LOGM(WARN, "activate event for non-existent token {}??", token); + LOGM(Log::WARN, "activate event for non-existent token {}??", token); return; } @@ -81,7 +81,7 @@ void CXDGActivationProtocol::bindManager(wl_client* client, void* data, uint32_t const auto PWINDOW = g_pCompositor->getWindowFromSurface(surf); if UNLIKELY (!PWINDOW) { - LOGM(WARN, "activate event for non-window or gone surface with token {}, ignoring", token); + LOGM(Log::WARN, "activate event for non-window or gone surface with token {}, ignoring", token); return; } diff --git a/src/protocols/XDGDecoration.cpp b/src/protocols/XDGDecoration.cpp index 0339db6b..e711ab3b 100644 --- a/src/protocols/XDGDecoration.cpp +++ b/src/protocols/XDGDecoration.cpp @@ -16,7 +16,7 @@ CXDGDecoration::CXDGDecoration(SP<CZxdgToplevelDecorationV1> resource_, wl_resou default: modeString = "INVALID"; break; } - LOGM(LOG, "setMode: {}. {} MODE_SERVER_SIDE as reply.", modeString, (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE ? "Sending" : "Ignoring and sending")); + LOGM(Log::DEBUG, "setMode: {}. {} MODE_SERVER_SIDE as reply.", modeString, (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE ? "Sending" : "Ignoring and sending")); auto sendMode = xdgModeOnRequestCSD(mode); m_resource->sendConfigure(sendMode); mostRecentlySent = sendMode; @@ -24,7 +24,7 @@ CXDGDecoration::CXDGDecoration(SP<CZxdgToplevelDecorationV1> resource_, wl_resou }); m_resource->setUnsetMode([this](CZxdgToplevelDecorationV1*) { - LOGM(LOG, "unsetMode. Sending MODE_SERVER_SIDE."); + LOGM(Log::DEBUG, "unsetMode. Sending MODE_SERVER_SIDE."); auto sendMode = xdgModeOnReleaseCSD(); m_resource->sendConfigure(sendMode); mostRecentlySent = sendMode; diff --git a/src/protocols/XDGOutput.cpp b/src/protocols/XDGOutput.cpp index ccb78e98..8835d4b5 100644 --- a/src/protocols/XDGOutput.cpp +++ b/src/protocols/XDGOutput.cpp @@ -25,7 +25,7 @@ void CXDGOutputProtocol::bindManager(wl_client* client, void* data, uint32_t ver const auto RESOURCE = m_managerResources.emplace_back(makeUnique<CZxdgOutputManagerV1>(client, ver, id)).get(); if UNLIKELY (!RESOURCE->resource()) { - LOGM(LOG, "Couldn't bind XDGOutputMgr"); + LOGM(Log::DEBUG, "Couldn't bind XDGOutputMgr"); wl_client_post_no_memory(client); return; } @@ -61,11 +61,11 @@ void CXDGOutputProtocol::onManagerGetXDGOutput(CZxdgOutputManagerV1* mgr, uint32 } if UNLIKELY (!PMONITOR) { - LOGM(ERR, "New xdg_output from client {:x} ({}) has no CMonitor?!", (uintptr_t)CLIENT, pXDGOutput->m_isXWayland ? "xwayland" : "not xwayland"); + LOGM(Log::ERR, "New xdg_output from client {:x} ({}) has no CMonitor?!", (uintptr_t)CLIENT, pXDGOutput->m_isXWayland ? "xwayland" : "not xwayland"); return; } - LOGM(LOG, "New xdg_output for {}: client {:x} ({})", PMONITOR->m_name, (uintptr_t)CLIENT, pXDGOutput->m_isXWayland ? "xwayland" : "not xwayland"); + LOGM(Log::DEBUG, "New xdg_output for {}: client {:x} ({})", PMONITOR->m_name, (uintptr_t)CLIENT, pXDGOutput->m_isXWayland ? "xwayland" : "not xwayland"); const auto XDGVER = pXDGOutput->m_resource->version(); @@ -82,7 +82,7 @@ void CXDGOutputProtocol::onManagerGetXDGOutput(CZxdgOutputManagerV1* mgr, uint32 } void CXDGOutputProtocol::updateAllOutputs() { - LOGM(LOG, "updating all xdg_output heads"); + LOGM(Log::DEBUG, "updating all xdg_output heads"); for (auto const& o : m_xdgOutputs) { if (!o->m_monitor) diff --git a/src/protocols/XDGShell.cpp b/src/protocols/XDGShell.cpp index cbac46b5..4271dc53 100644 --- a/src/protocols/XDGShell.cpp +++ b/src/protocols/XDGShell.cpp @@ -48,7 +48,7 @@ CXDGPopupResource::CXDGPopupResource(SP<CXdgPopup> resource_, SP<CXDGSurfaceReso }); m_resource->setReposition([this](CXdgPopup* r, wl_resource* positionerRes, uint32_t token) { - LOGM(LOG, "Popup {:x} asks for reposition", (uintptr_t)this); + LOGM(Log::DEBUG, "Popup {:x} asks for reposition", (uintptr_t)this); m_lastRepositionToken = token; auto pos = CXDGPositionerResource::fromResource(positionerRes); if (!pos) @@ -58,7 +58,7 @@ CXDGPopupResource::CXDGPopupResource(SP<CXdgPopup> resource_, SP<CXDGSurfaceReso }); m_resource->setGrab([this](CXdgPopup* r, wl_resource* seat, uint32_t serial) { - LOGM(LOG, "xdg_popup {:x} requests grab", (uintptr_t)this); + LOGM(Log::DEBUG, "xdg_popup {:x} requests grab", (uintptr_t)this); PROTO::xdgShell->addOrStartGrab(m_self.lock()); }); @@ -76,7 +76,7 @@ void CXDGPopupResource::applyPositioning(const CBox& box, const Vector2D& t1coor m_geometry = m_positionerRules.getPosition(constraint, accumulateParentOffset() + t1coord); - LOGM(LOG, "Popup {:x} gets unconstrained to {} {}", (uintptr_t)this, m_geometry.pos(), m_geometry.size()); + LOGM(Log::DEBUG, "Popup {:x} gets unconstrained to {} {}", (uintptr_t)this, m_geometry.pos(), m_geometry.size()); configure(m_geometry); @@ -122,7 +122,7 @@ void CXDGPopupResource::repositioned() { if LIKELY (!m_lastRepositionToken) return; - LOGM(LOG, "repositioned: sending reposition token {}", m_lastRepositionToken); + LOGM(Log::DEBUG, "repositioned: sending reposition token {}", m_lastRepositionToken); m_resource->sendRepositioned(m_lastRepositionToken); m_lastRepositionToken = 0; @@ -257,7 +257,7 @@ CXDGToplevelResource::CXDGToplevelResource(SP<CXdgToplevel> resource_, SP<CXDGSu if (m_parent) m_parent->m_children.emplace_back(m_self); - LOGM(LOG, "Toplevel {:x} sets parent to {:x}{}", (uintptr_t)this, (uintptr_t)newp.get(), (oldParent ? std::format(" (was {:x})", (uintptr_t)oldParent.get()) : "")); + LOGM(Log::DEBUG, "Toplevel {:x} sets parent to {:x}{}", (uintptr_t)this, (uintptr_t)newp.get(), (oldParent ? std::format(" (was {:x})", (uintptr_t)oldParent.get()) : "")); }); } @@ -402,7 +402,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas }); m_listeners.surfaceDestroy = m_surface->m_events.destroy.listen([this] { - LOGM(WARN, "wl_surface destroyed before its xdg_surface role object"); + LOGM(Log::WARN, "wl_surface destroyed before its xdg_surface role object"); m_listeners.surfaceDestroy.reset(); m_listeners.surfaceCommit.reset(); @@ -458,7 +458,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas m_toplevel = RESOURCE; m_toplevel->m_self = RESOURCE; - LOGM(LOG, "xdg_surface {:x} gets a toplevel {:x}", (uintptr_t)m_owner.get(), (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "xdg_surface {:x} gets a toplevel {:x}", (uintptr_t)m_owner.get(), (uintptr_t)RESOURCE.get()); g_pCompositor->m_windows.emplace_back(Desktop::View::CWindow::create(m_self.lock())); @@ -484,7 +484,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas m_popup = RESOURCE; RESOURCE->m_self = RESOURCE; - LOGM(LOG, "xdg_surface {:x} gets a popup {:x} owner {:x}", (uintptr_t)m_self.get(), (uintptr_t)RESOURCE.get(), (uintptr_t)parent.get()); + LOGM(Log::DEBUG, "xdg_surface {:x} gets a popup {:x} owner {:x}", (uintptr_t)m_self.get(), (uintptr_t)RESOURCE.get(), (uintptr_t)parent.get()); if (!parent) return; @@ -502,7 +502,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas }); m_resource->setSetWindowGeometry([this](CXdgSurface* r, int32_t x, int32_t y, int32_t w, int32_t h) { - LOGM(LOG, "xdg_surface {:x} requests geometry {}x{} {}x{}", (uintptr_t)this, x, y, w, h); + LOGM(Log::DEBUG, "xdg_surface {:x} requests geometry {}x{} {}x{}", (uintptr_t)this, x, y, w, h); m_pending.geometry = {x, y, w, h}; }); } @@ -596,7 +596,7 @@ CXDGPositionerRules::CXDGPositionerRules(SP<CXDGPositionerResource> positioner) } CBox CXDGPositionerRules::getPosition(CBox constraint, const Vector2D& parentCoord) { - Debug::log(LOG, "GetPosition with constraint {} {} and parent {}", constraint.pos(), constraint.size(), parentCoord); + Log::logger->log(Log::DEBUG, "GetPosition with constraint {} {} and parent {}", constraint.pos(), constraint.size(), parentCoord); // padding constraint.expand(-4); @@ -742,7 +742,7 @@ CXDGWMBase::CXDGWMBase(SP<CXdgWmBase> resource_) : m_resource(resource_) { m_positioners.emplace_back(RESOURCE); - LOGM(LOG, "New xdg_positioner at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New xdg_positioner at {:x}", (uintptr_t)RESOURCE.get()); }); m_resource->setGetXdgSurface([this](CXdgWmBase* r, uint32_t id, wl_resource* surf) { @@ -773,7 +773,7 @@ CXDGWMBase::CXDGWMBase(SP<CXdgWmBase> resource_) : m_resource(resource_) { m_surfaces.emplace_back(RESOURCE); - LOGM(LOG, "New xdg_surface at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New xdg_surface at {:x}", (uintptr_t)RESOURCE.get()); }); m_resource->setPong([this](CXdgWmBase* r, uint32_t serial) { @@ -817,7 +817,7 @@ void CXDGShellProtocol::bindManager(wl_client* client, void* data, uint32_t ver, RESOURCE->m_self = RESOURCE; - LOGM(LOG, "New xdg_wm_base at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New xdg_wm_base at {:x}", (uintptr_t)RESOURCE.get()); } void CXDGShellProtocol::destroyResource(CXDGWMBase* resource) { diff --git a/src/protocols/XXColorManagement.cpp b/src/protocols/XXColorManagement.cpp index 8ec780b4..92b30f7a 100644 --- a/src/protocols/XXColorManagement.cpp +++ b/src/protocols/XXColorManagement.cpp @@ -72,9 +72,9 @@ CXXColorManager::CXXColorManager(SP<CXxColorManagerV4> resource_) : m_resource(r // resource->sendSupportedIntent(XX_COLOR_MANAGER_V4_RENDER_INTENT_ABSOLUTE); // resource->sendSupportedIntent(XX_COLOR_MANAGER_V4_RENDER_INTENT_RELATIVE_BPC); - m_resource->setDestroy([](CXxColorManagerV4* r) { LOGM(TRACE, "Destroy xx_color_manager at {:x} (generated default)", (uintptr_t)r); }); + m_resource->setDestroy([](CXxColorManagerV4* r) { LOGM(Log::TRACE, "Destroy xx_color_manager at {:x} (generated default)", (uintptr_t)r); }); m_resource->setGetOutput([](CXxColorManagerV4* r, uint32_t id, wl_resource* output) { - LOGM(TRACE, "Get output for id={}, output={}", id, (uintptr_t)output); + LOGM(Log::TRACE, "Get output for id={}, output={}", id, (uintptr_t)output); const auto RESOURCE = PROTO::xxColorManagement->m_outputs.emplace_back(makeShared<CXXColorManagementOutput>(makeShared<CXxColorManagementOutputV4>(r->client(), r->version(), id))); @@ -87,11 +87,11 @@ CXXColorManager::CXXColorManager(SP<CXxColorManagerV4> resource_) : m_resource(r RESOURCE->m_self = RESOURCE; }); m_resource->setGetSurface([](CXxColorManagerV4* r, uint32_t id, wl_resource* surface) { - LOGM(TRACE, "Get surface for id={}, surface={}", id, (uintptr_t)surface); + LOGM(Log::TRACE, "Get surface for id={}, surface={}", id, (uintptr_t)surface); auto SURF = CWLSurfaceResource::fromResource(surface); if (!SURF) { - LOGM(ERR, "No surface for resource {}", (uintptr_t)surface); + LOGM(Log::ERR, "No surface for resource {}", (uintptr_t)surface); r->error(-1, "Invalid surface (2)"); return; } @@ -112,11 +112,11 @@ CXXColorManager::CXXColorManager(SP<CXxColorManagerV4> resource_) : m_resource(r RESOURCE->m_self = RESOURCE; }); m_resource->setGetFeedbackSurface([](CXxColorManagerV4* r, uint32_t id, wl_resource* surface) { - LOGM(TRACE, "Get feedback surface for id={}, surface={}", id, (uintptr_t)surface); + LOGM(Log::TRACE, "Get feedback surface for id={}, surface={}", id, (uintptr_t)surface); auto SURF = CWLSurfaceResource::fromResource(surface); if (!SURF) { - LOGM(ERR, "No surface for resource {}", (uintptr_t)surface); + LOGM(Log::ERR, "No surface for resource {}", (uintptr_t)surface); r->error(-1, "Invalid surface (2)"); return; } @@ -133,11 +133,11 @@ CXXColorManager::CXXColorManager(SP<CXxColorManagerV4> resource_) : m_resource(r RESOURCE->m_self = RESOURCE; }); m_resource->setNewIccCreator([](CXxColorManagerV4* r, uint32_t id) { - LOGM(WARN, "New ICC creator for id={} (unsupported)", id); + LOGM(Log::WARN, "New ICC creator for id={} (unsupported)", id); r->error(XX_COLOR_MANAGER_V4_ERROR_UNSUPPORTED_FEATURE, "ICC profiles are not supported"); }); m_resource->setNewParametricCreator([](CXxColorManagerV4* r, uint32_t id) { - LOGM(TRACE, "New parametric creator for id={}", id); + LOGM(Log::TRACE, "New parametric creator for id={}", id); const auto RESOURCE = PROTO::xxColorManagement->m_parametricCreators.emplace_back( makeShared<CXXColorManagementParametricCreator>(makeShared<CXxImageDescriptionCreatorParamsV4>(r->client(), r->version(), id))); @@ -168,7 +168,7 @@ CXXColorManagementOutput::CXXColorManagementOutput(SP<CXxColorManagementOutputV4 m_resource->setOnDestroy([this](CXxColorManagementOutputV4* r) { PROTO::xxColorManagement->destroyResource(this); }); m_resource->setGetImageDescription([this](CXxColorManagementOutputV4* r, uint32_t id) { - LOGM(TRACE, "Get image description for output={}, id={}", (uintptr_t)r, id); + LOGM(Log::TRACE, "Get image description for output={}, id={}", (uintptr_t)r, id); if (m_imageDescription.valid()) PROTO::xxColorManagement->destroyResource(m_imageDescription.get()); @@ -216,24 +216,24 @@ CXXColorManagementSurface::CXXColorManagementSurface(SP<CXxColorManagementSurfac m_surface->m_colorManagement = RESOURCE; m_resource->setOnDestroy([this](CXxColorManagementSurfaceV4* r) { - LOGM(TRACE, "Destroy wp cm and xx cm for surface {}", (uintptr_t)m_surface); + LOGM(Log::TRACE, "Destroy wp cm and xx cm for surface {}", (uintptr_t)m_surface); if (m_surface.valid()) PROTO::colorManagement->destroyResource(m_surface->m_colorManagement.get()); PROTO::xxColorManagement->destroyResource(this); }); } else m_resource->setOnDestroy([this](CXxColorManagementSurfaceV4* r) { - LOGM(TRACE, "Destroy xx cm surface {}", (uintptr_t)m_surface); + LOGM(Log::TRACE, "Destroy xx cm surface {}", (uintptr_t)m_surface); PROTO::xxColorManagement->destroyResource(this); }); m_resource->setDestroy([this](CXxColorManagementSurfaceV4* r) { - LOGM(TRACE, "Destroy xx cm surface {}", (uintptr_t)m_surface); + LOGM(Log::TRACE, "Destroy xx cm surface {}", (uintptr_t)m_surface); PROTO::xxColorManagement->destroyResource(this); }); m_resource->setSetImageDescription([this](CXxColorManagementSurfaceV4* r, wl_resource* image_description, uint32_t render_intent) { - LOGM(TRACE, "Set image description for surface={}, desc={}, intent={}", (uintptr_t)r, (uintptr_t)image_description, render_intent); + LOGM(Log::TRACE, "Set image description for surface={}, desc={}, intent={}", (uintptr_t)r, (uintptr_t)image_description, render_intent); const auto PO = sc<CXxImageDescriptionV4*>(wl_resource_get_user_data(image_description)); if (!PO) { // FIXME check validity @@ -256,15 +256,15 @@ CXXColorManagementSurface::CXXColorManagementSurface(SP<CXxColorManagementSurfac m_surface->m_colorManagement->m_imageDescription = imageDescription->get()->m_settings; m_surface->m_colorManagement->setHasImageDescription(true); } else - LOGM(ERR, "Set image description for invalid surface"); + LOGM(Log::ERR, "Set image description for invalid surface"); }); m_resource->setUnsetImageDescription([this](CXxColorManagementSurfaceV4* r) { - LOGM(TRACE, "Unset image description for surface={}", (uintptr_t)r); + LOGM(Log::TRACE, "Unset image description for surface={}", (uintptr_t)r); if (m_surface.valid()) { m_surface->m_colorManagement->m_imageDescription = SImageDescription{}; m_surface->m_colorManagement->setHasImageDescription(false); } else - LOGM(ERR, "Unset image description for invalid surface"); + LOGM(Log::ERR, "Unset image description for invalid surface"); }); } @@ -278,7 +278,7 @@ wl_client* CXXColorManagementSurface::client() { const SImageDescription& CXXColorManagementSurface::imageDescription() { if (!hasImageDescription()) - LOGM(WARN, "Reading imageDescription while none set. Returns default or empty values"); + LOGM(Log::WARN, "Reading imageDescription while none set. Returns default or empty values"); return m_imageDescription; } @@ -312,20 +312,20 @@ CXXColorManagementFeedbackSurface::CXXColorManagementFeedbackSurface(SP<CXxColor m_client = m_resource->client(); m_resource->setDestroy([this](CXxColorManagementFeedbackSurfaceV4* r) { - LOGM(TRACE, "Destroy xx cm feedback surface {}", (uintptr_t)m_surface); + LOGM(Log::TRACE, "Destroy xx cm feedback surface {}", (uintptr_t)m_surface); if (m_currentPreferred.valid()) PROTO::xxColorManagement->destroyResource(m_currentPreferred.get()); PROTO::xxColorManagement->destroyResource(this); }); m_resource->setOnDestroy([this](CXxColorManagementFeedbackSurfaceV4* r) { - LOGM(TRACE, "Destroy xx cm feedback surface {}", (uintptr_t)m_surface); + LOGM(Log::TRACE, "Destroy xx cm feedback surface {}", (uintptr_t)m_surface); if (m_currentPreferred.valid()) PROTO::xxColorManagement->destroyResource(m_currentPreferred.get()); PROTO::xxColorManagement->destroyResource(this); }); m_resource->setGetPreferred([this](CXxColorManagementFeedbackSurfaceV4* r, uint32_t id) { - LOGM(TRACE, "Get preferred for id {}", id); + LOGM(Log::TRACE, "Get preferred for id {}", id); if (m_currentPreferred.valid()) PROTO::xxColorManagement->destroyResource(m_currentPreferred.get()); @@ -365,7 +365,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI m_resource->setOnDestroy([this](CXxImageDescriptionCreatorParamsV4* r) { PROTO::xxColorManagement->destroyResource(this); }); m_resource->setCreate([this](CXxImageDescriptionCreatorParamsV4* r, uint32_t id) { - LOGM(TRACE, "Create image description from params for id {}", id); + LOGM(Log::TRACE, "Create image description from params for id {}", id); // FIXME actually check completeness if (!m_valuesSet) { @@ -401,7 +401,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI PROTO::xxColorManagement->destroyResource(this); }); m_resource->setSetTfNamed([this](CXxImageDescriptionCreatorParamsV4* r, uint32_t tf) { - LOGM(TRACE, "Set image description transfer function to {}", tf); + LOGM(Log::TRACE, "Set image description transfer function to {}", tf); if (m_valuesSet & PC_TF) { r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Transfer function already set"); return; @@ -429,7 +429,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI m_valuesSet |= PC_TF; }); m_resource->setSetTfPower([this](CXxImageDescriptionCreatorParamsV4* r, uint32_t eexp) { - LOGM(TRACE, "Set image description tf power to {}", eexp); + LOGM(Log::TRACE, "Set image description tf power to {}", eexp); if (m_valuesSet & PC_TF_POWER) { r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Transfer function power already set"); return; @@ -438,7 +438,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI m_valuesSet |= PC_TF_POWER; }); m_resource->setSetPrimariesNamed([this](CXxImageDescriptionCreatorParamsV4* r, uint32_t primaries) { - LOGM(TRACE, "Set image description primaries by name {}", primaries); + LOGM(Log::TRACE, "Set image description primaries by name {}", primaries); if (m_valuesSet & PC_PRIMARIES) { r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Primaries already set"); return; @@ -464,7 +464,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI }); m_resource->setSetPrimaries( [this](CXxImageDescriptionCreatorParamsV4* r, int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) { - LOGM(TRACE, "Set image description primaries by values r:{},{} g:{},{} b:{},{} w:{},{}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y); + LOGM(Log::TRACE, "Set image description primaries by values r:{},{} g:{},{} b:{},{} w:{},{}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y); if (m_valuesSet & PC_PRIMARIES) { r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Primaries already set"); return; @@ -475,7 +475,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI }); m_resource->setSetLuminances([this](CXxImageDescriptionCreatorParamsV4* r, uint32_t min_lum, uint32_t max_lum, uint32_t reference_lum) { auto min = min_lum / 10000.0f; - LOGM(TRACE, "Set image description luminances to {} - {} ({})", min, max_lum, reference_lum); + LOGM(Log::TRACE, "Set image description luminances to {} - {} ({})", min, max_lum, reference_lum); if (m_valuesSet & PC_LUMINANCES) { r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Luminances already set"); return; @@ -489,7 +489,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI }); m_resource->setSetMasteringDisplayPrimaries( [this](CXxImageDescriptionCreatorParamsV4* r, int32_t r_x, int32_t r_y, int32_t g_x, int32_t g_y, int32_t b_x, int32_t b_y, int32_t w_x, int32_t w_y) { - LOGM(TRACE, "Set image description mastering primaries by values r:{},{} g:{},{} b:{},{} w:{},{}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y); + LOGM(Log::TRACE, "Set image description mastering primaries by values r:{},{} g:{},{} b:{},{} w:{},{}", r_x, r_y, g_x, g_y, b_x, b_y, w_x, w_y); // if (valuesSet & PC_MASTERING_PRIMARIES) { // r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Mastering primaries already set"); // return; @@ -499,7 +499,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI }); m_resource->setSetMasteringLuminance([this](CXxImageDescriptionCreatorParamsV4* r, uint32_t min_lum, uint32_t max_lum) { auto min = min_lum / 10000.0f; - LOGM(TRACE, "Set image description mastering luminances to {} - {}", min, max_lum); + LOGM(Log::TRACE, "Set image description mastering luminances to {} - {}", min, max_lum); // if (valuesSet & PC_MASTERING_LUMINANCES) { // r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Mastering luminances already set"); // return; @@ -512,7 +512,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI m_valuesSet |= PC_MASTERING_LUMINANCES; }); m_resource->setSetMaxCll([this](CXxImageDescriptionCreatorParamsV4* r, uint32_t max_cll) { - LOGM(TRACE, "Set image description max content light level to {}", max_cll); + LOGM(Log::TRACE, "Set image description max content light level to {}", max_cll); // if (valuesSet & PC_CLL) { // r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Max CLL already set"); // return; @@ -521,7 +521,7 @@ CXXColorManagementParametricCreator::CXXColorManagementParametricCreator(SP<CXxI m_valuesSet |= PC_CLL; }); m_resource->setSetMaxFall([this](CXxImageDescriptionCreatorParamsV4* r, uint32_t max_fall) { - LOGM(TRACE, "Set image description max frame-average light level to {}", max_fall); + LOGM(Log::TRACE, "Set image description max frame-average light level to {}", max_fall); // if (valuesSet & PC_FALL) { // r->error(XX_IMAGE_DESCRIPTION_CREATOR_PARAMS_V4_ERROR_ALREADY_SET, "Max FALL already set"); // return; @@ -550,7 +550,7 @@ CXXColorManagementImageDescription::CXXColorManagementImageDescription(SP<CXxIma m_resource->setOnDestroy([this](CXxImageDescriptionV4* r) { PROTO::xxColorManagement->destroyResource(this); }); m_resource->setGetInformation([this](CXxImageDescriptionV4* r, uint32_t id) { - LOGM(TRACE, "Get image information for image={}, id={}", (uintptr_t)r, id); + LOGM(Log::TRACE, "Get image information for image={}, id={}", (uintptr_t)r, id); if (!m_allowGetInformation) { r->error(XX_IMAGE_DESCRIPTION_V4_ERROR_NO_INFORMATION, "Image descriptions doesn't allow get_information request"); return; @@ -632,7 +632,7 @@ void CXXColorManagementProtocol::bindManager(wl_client* client, void* data, uint return; } - LOGM(TRACE, "New xx_color_manager at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::TRACE, "New xx_color_manager at {:x}", (uintptr_t)RESOURCE.get()); } void CXXColorManagementProtocol::onImagePreferredChanged() { diff --git a/src/protocols/core/Compositor.cpp b/src/protocols/core/Compositor.cpp index 2177c68f..dc4931a8 100644 --- a/src/protocols/core/Compositor.cpp +++ b/src/protocols/core/Compositor.cpp @@ -277,19 +277,19 @@ void CWLSurfaceResource::enter(PHLMONITOR monitor) { if UNLIKELY (!PROTO::outputs.contains(monitor->m_name)) { // can happen on unplug/replug - LOGM(ERR, "enter() called on a non-existent output global"); + LOGM(Log::ERR, "enter() called on a non-existent output global"); return; } if UNLIKELY (PROTO::outputs.at(monitor->m_name)->isDefunct()) { - LOGM(ERR, "enter() called on a defunct output global"); + LOGM(Log::ERR, "enter() called on a defunct output global"); return; } auto output = PROTO::outputs.at(monitor->m_name)->outputResourceFrom(m_client); 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->m_name); + LOGM(Log::ERR, "Cannot enter surface {:x} to {}, client hasn't bound the output", (uintptr_t)this, monitor->m_name); return; } @@ -306,7 +306,7 @@ void CWLSurfaceResource::leave(PHLMONITOR monitor) { auto output = PROTO::outputs.at(monitor->m_name)->outputResourceFrom(m_client); if UNLIKELY (!output) { - LOGM(ERR, "Cannot leave surface {:x} from {}, client hasn't bound the output", (uintptr_t)this, monitor->m_name); + LOGM(Log::ERR, "Cannot leave surface {:x} from {}, client hasn't bound the output", (uintptr_t)this, monitor->m_name); return; } @@ -627,7 +627,7 @@ void CWLSurfaceResource::updateCursorShm(CRegion damage) { auto shmAttrs = buf->shm(); if (!shmAttrs.success) { - LOGM(TRACE, "updateCursorShm: ignoring, not a shm buffer"); + LOGM(Log::TRACE, "updateCursorShm: ignoring, not a shm buffer"); return; } @@ -681,7 +681,7 @@ CWLCompositorResource::CWLCompositorResource(SP<CWlCompositor> resource_) : m_re RESOURCE->m_self = RESOURCE; RESOURCE->m_stateQueue = CSurfaceStateQueue(RESOURCE); - LOGM(LOG, "New wl_surface with id {} at {:x}", id, (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New wl_surface with id {} at {:x}", id, (uintptr_t)RESOURCE.get()); PROTO::compositor->m_events.newSurface.emit(RESOURCE); }); @@ -697,7 +697,7 @@ CWLCompositorResource::CWLCompositorResource(SP<CWlCompositor> resource_) : m_re RESOURCE->m_self = RESOURCE; - LOGM(LOG, "New wl_region with id {} at {:x}", id, (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New wl_region with id {} at {:x}", id, (uintptr_t)RESOURCE.get()); }); } diff --git a/src/protocols/core/DataDevice.cpp b/src/protocols/core/DataDevice.cpp index 4a24e861..41f07273 100644 --- a/src/protocols/core/DataDevice.cpp +++ b/src/protocols/core/DataDevice.cpp @@ -26,16 +26,16 @@ CWLDataOfferResource::CWLDataOfferResource(SP<CWlDataOffer> resource_, SP<IDataS m_resource->setAccept([this](CWlDataOffer* r, uint32_t serial, const char* mime) { if (!m_source) { - LOGM(WARN, "Possible bug: Accept on an offer w/o a source"); + LOGM(Log::WARN, "Possible bug: Accept on an offer w/o a source"); return; } if (m_dead) { - LOGM(WARN, "Possible bug: Accept on an offer that's dead"); + LOGM(Log::WARN, "Possible bug: Accept on an offer that's dead"); return; } - LOGM(LOG, "Offer {:x} accepts data from source {:x} with mime {}", (uintptr_t)this, (uintptr_t)m_source.get(), mime ? mime : "null"); + LOGM(Log::DEBUG, "Offer {:x} accepts data from source {:x} with mime {}", (uintptr_t)this, (uintptr_t)m_source.get(), mime ? mime : "null"); m_source->accepted(mime ? mime : ""); m_accepted = mime; @@ -44,19 +44,19 @@ CWLDataOfferResource::CWLDataOfferResource(SP<CWlDataOffer> resource_, SP<IDataS m_resource->setReceive([this](CWlDataOffer* r, const char* mime, int fd) { CFileDescriptor sendFd{fd}; if (!m_source) { - LOGM(WARN, "Possible bug: Receive on an offer w/o a source"); + LOGM(Log::WARN, "Possible bug: Receive on an offer w/o a source"); return; } if (m_dead) { - LOGM(WARN, "Possible bug: Receive on an offer that's dead"); + LOGM(Log::WARN, "Possible bug: Receive on an offer that's dead"); return; } - LOGM(LOG, "Offer {:x} asks to send data from source {:x}", (uintptr_t)this, (uintptr_t)m_source.get()); + LOGM(Log::DEBUG, "Offer {:x} asks to send data from source {:x}", (uintptr_t)this, (uintptr_t)m_source.get()); if (!m_accepted) { - LOGM(WARN, "Offer was never accepted, sending accept first"); + LOGM(Log::WARN, "Offer was never accepted, sending accept first"); m_source->accepted(mime ? mime : ""); } @@ -101,13 +101,13 @@ void CWLDataOfferResource::sendData() { else if (SOURCEACTIONS & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY) m_resource->sendAction(WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY); else { - LOGM(ERR, "Client bug? dnd source has no action move or copy. Sending move, f this."); + LOGM(Log::ERR, "Client bug? dnd source has no action move or copy. Sending move, f this."); m_resource->sendAction(WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE); } } for (auto const& m : m_source->mimes()) { - LOGM(LOG, " | offer {:x} supports mime {}", (uintptr_t)this, m); + LOGM(Log::DEBUG, " | offer {:x} supports mime {}", (uintptr_t)this, m); m_resource->sendOffer(m.c_str()); } } @@ -147,7 +147,7 @@ CWLDataSourceResource::CWLDataSourceResource(SP<CWlDataSource> resource_, SP<CWL m_resource->setOffer([this](CWlDataSource* r, const char* mime) { m_mimeTypes.emplace_back(mime); }); m_resource->setSetActions([this](CWlDataSource* r, uint32_t a) { - LOGM(LOG, "DataSource {:x} actions {}", (uintptr_t)this, a); + LOGM(Log::DEBUG, "DataSource {:x} actions {}", (uintptr_t)this, a); m_supportedActions = a; }); } @@ -173,7 +173,7 @@ void CWLDataSourceResource::accepted(const std::string& mime) { } if (std::ranges::find(m_mimeTypes, mime) == m_mimeTypes.end()) { - LOGM(ERR, "Compositor/App bug: CWLDataSourceResource::sendAccepted with non-existent mime"); + LOGM(Log::ERR, "Compositor/App bug: CWLDataSourceResource::sendAccepted with non-existent mime"); return; } @@ -186,7 +186,7 @@ std::vector<std::string> CWLDataSourceResource::mimes() { void CWLDataSourceResource::send(const std::string& mime, CFileDescriptor fd) { if (std::ranges::find(m_mimeTypes, mime) == m_mimeTypes.end()) { - LOGM(ERR, "Compositor/App bug: CWLDataSourceResource::sendAskSend with non-existent mime"); + LOGM(Log::ERR, "Compositor/App bug: CWLDataSourceResource::sendAskSend with non-existent mime"); return; } @@ -248,13 +248,13 @@ CWLDataDeviceResource::CWLDataDeviceResource(SP<CWlDataDevice> resource_) : m_re m_resource->setSetSelection([](CWlDataDevice* r, wl_resource* sourceR, uint32_t serial) { auto source = sourceR ? CWLDataSourceResource::fromResource(sourceR) : CSharedPointer<CWLDataSourceResource>{}; if (!source) { - LOGM(LOG, "Reset selection received"); + LOGM(Log::DEBUG, "Reset selection received"); g_pSeatManager->setCurrentSelection(nullptr); return; } if (source && source->m_used) - LOGM(WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this."); + LOGM(Log::WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this."); source->markUsed(); @@ -264,12 +264,12 @@ CWLDataDeviceResource::CWLDataDeviceResource(SP<CWlDataDevice> resource_) : m_re m_resource->setStartDrag([](CWlDataDevice* r, wl_resource* sourceR, wl_resource* origin, wl_resource* icon, uint32_t serial) { auto source = CWLDataSourceResource::fromResource(sourceR); if (!source) { - LOGM(ERR, "No source in drag"); + LOGM(Log::ERR, "No source in drag"); return; } if (source && source->m_used) - LOGM(WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this."); + LOGM(Log::WARN, "setSelection on a used resource. By protocol, this is a violation, but firefox et al insist on doing this."); source->markUsed(); @@ -357,13 +357,13 @@ CWLDataDeviceManagerResource::CWLDataDeviceManagerResource(SP<CWlDataDeviceManag } if (!m_device) - LOGM(WARN, "New data source before a device was created"); + LOGM(Log::WARN, "New data source before a device was created"); RESOURCE->m_self = RESOURCE; m_sources.emplace_back(RESOURCE); - LOGM(LOG, "New data source bound at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New data source bound at {:x}", (uintptr_t)RESOURCE.get()); }); m_resource->setGetDataDevice([this](CWlDataDeviceManager* r, uint32_t id, wl_resource* seat) { @@ -383,7 +383,7 @@ CWLDataDeviceManagerResource::CWLDataDeviceManagerResource(SP<CWlDataDeviceManag s->m_device = RESOURCE; } - LOGM(LOG, "New data device bound at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New data device bound at {:x}", (uintptr_t)RESOURCE.get()); }); } @@ -407,7 +407,7 @@ void CWLDataDeviceProtocol::bindManager(wl_client* client, void* data, uint32_t return; } - LOGM(LOG, "New datamgr resource bound at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New datamgr resource bound at {:x}", (uintptr_t)RESOURCE.get()); } void CWLDataDeviceProtocol::destroyResource(CWLDataDeviceManagerResource* seat) { @@ -463,11 +463,11 @@ void CWLDataDeviceProtocol::sendSelectionToDevice(SP<IDataDevice> dev, SP<IDataS #endif if UNLIKELY (!offer) { - LOGM(ERR, "No offer could be created in sendSelectionToDevice"); + LOGM(Log::ERR, "No offer could be created in sendSelectionToDevice"); return; } - LOGM(LOG, "New {} offer {:x} for data source {:x}", offer->type() == DATA_SOURCE_TYPE_WAYLAND ? "wayland" : "X11", (uintptr_t)offer.get(), (uintptr_t)sel.get()); + LOGM(Log::DEBUG, "New {} offer {:x} for data source {:x}", offer->type() == DATA_SOURCE_TYPE_WAYLAND ? "wayland" : "X11", (uintptr_t)offer.get(), (uintptr_t)sel.get()); dev->sendDataOffer(offer); if (const auto WL = offer->getWayland(); WL) @@ -488,7 +488,7 @@ void CWLDataDeviceProtocol::setSelection(SP<IDataSource> source) { } if (!source) { - LOGM(LOG, "resetting selection"); + LOGM(Log::DEBUG, "resetting selection"); if (!g_pSeatManager->m_state.keyboardFocusResource) return; @@ -500,7 +500,7 @@ void CWLDataDeviceProtocol::setSelection(SP<IDataSource> source) { return; } - LOGM(LOG, "New selection for data source {:x}", (uintptr_t)source.get()); + LOGM(Log::DEBUG, "New selection for data source {:x}", (uintptr_t)source.get()); if (!g_pSeatManager->m_state.keyboardFocusResource) return; @@ -508,12 +508,12 @@ void CWLDataDeviceProtocol::setSelection(SP<IDataSource> source) { auto DESTDEVICE = dataDeviceForClient(g_pSeatManager->m_state.keyboardFocusResource->client()); if (!DESTDEVICE) { - LOGM(LOG, "CWLDataDeviceProtocol::setSelection: cannot send selection to a client without a data_device"); + LOGM(Log::DEBUG, "CWLDataDeviceProtocol::setSelection: cannot send selection to a client without a data_device"); return; } if (DESTDEVICE->type() != DATA_SOURCE_TYPE_WAYLAND) { - LOGM(LOG, "CWLDataDeviceProtocol::setSelection: ignoring X11 data device"); + LOGM(Log::DEBUG, "CWLDataDeviceProtocol::setSelection: ignoring X11 data device"); return; } @@ -527,7 +527,7 @@ void CWLDataDeviceProtocol::updateSelection() { auto DESTDEVICE = dataDeviceForClient(g_pSeatManager->m_state.keyboardFocusResource->client()); if (!DESTDEVICE) { - LOGM(LOG, "CWLDataDeviceProtocol::onKeyboardFocus: cannot send selection to a client without a data_device"); + LOGM(Log::DEBUG, "CWLDataDeviceProtocol::onKeyboardFocus: cannot send selection to a client without a data_device"); return; } @@ -557,14 +557,14 @@ void CWLDataDeviceProtocol::onDndPointerFocus() { void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource, SP<CWLSurfaceResource> dragSurface, SP<CWLSurfaceResource> origin) { if (m_dnd.currentSource) { - LOGM(WARN, "New drag started while old drag still active??"); + LOGM(Log::WARN, "New drag started while old drag still active??"); abortDrag(); } Cursor::overrideController->setOverride("grabbing", Cursor::CURSOR_OVERRIDE_DND); m_dnd.overriddenCursor = true; - LOGM(LOG, "initiateDrag: source {:x}, surface: {:x}, origin: {:x}", (uintptr_t)currentSource.get(), (uintptr_t)dragSurface, (uintptr_t)origin); + LOGM(Log::DEBUG, "initiateDrag: source {:x}, surface: {:x}, origin: {:x}", (uintptr_t)currentSource.get(), (uintptr_t)dragSurface, (uintptr_t)origin); currentSource->m_used = true; @@ -589,20 +589,20 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource m_dnd.mouseButton = g_pHookSystem->hookDynamic("mouseButton", [this](void* self, SCallbackInfo& info, std::any e) { auto E = std::any_cast<IPointer::SButtonEvent>(e); if (E.state == WL_POINTER_BUTTON_STATE_RELEASED) { - LOGM(LOG, "Dropping drag on mouseUp"); + LOGM(Log::DEBUG, "Dropping drag on mouseUp"); dropDrag(); } }); m_dnd.touchUp = g_pHookSystem->hookDynamic("touchUp", [this](void* self, SCallbackInfo& info, std::any e) { - LOGM(LOG, "Dropping drag on touchUp"); + LOGM(Log::DEBUG, "Dropping drag on touchUp"); dropDrag(); }); m_dnd.tabletTip = g_pHookSystem->hookDynamic("tabletTip", [this](void* self, SCallbackInfo& info, std::any e) { auto E = std::any_cast<CTablet::STipEvent>(e); if (!E.in) { - LOGM(LOG, "Dropping drag on tablet tipUp"); + LOGM(Log::DEBUG, "Dropping drag on tablet tipUp"); dropDrag(); } }); @@ -621,7 +621,7 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource return; m_dnd.focusedDevice->sendMotion(Time::millis(Time::steadyNow()), V - box->pos()); - LOGM(LOG, "Drag motion {}", V - box->pos()); + LOGM(Log::DEBUG, "Drag motion {}", V - box->pos()); } }); @@ -639,7 +639,7 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource return; m_dnd.focusedDevice->sendMotion(E.timeMs, E.pos); - LOGM(LOG, "Drag motion {}", E.pos); + LOGM(Log::DEBUG, "Drag motion {}", E.pos); } }); @@ -689,11 +689,11 @@ void CWLDataDeviceProtocol::updateDrag() { #endif if (!offer) { - LOGM(ERR, "No offer could be created in updateDrag"); + LOGM(Log::ERR, "No offer could be created in updateDrag"); return; } - LOGM(LOG, "New {} dnd offer {:x} for data source {:x}", offer->type() == DATA_SOURCE_TYPE_WAYLAND ? "wayland" : "X11", (uintptr_t)offer.get(), + LOGM(Log::DEBUG, "New {} dnd offer {:x} for data source {:x}", offer->type() == DATA_SOURCE_TYPE_WAYLAND ? "wayland" : "X11", (uintptr_t)offer.get(), (uintptr_t)m_dnd.currentSource.get()); m_dnd.focusedDevice->sendDataOffer(offer); diff --git a/src/protocols/core/Output.cpp b/src/protocols/core/Output.cpp index 61c4acf8..755470e4 100644 --- a/src/protocols/core/Output.cpp +++ b/src/protocols/core/Output.cpp @@ -95,7 +95,7 @@ CWLOutputProtocol::CWLOutputProtocol(const wl_interface* iface, const int& ver, void CWLOutputProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) { if UNLIKELY (m_defunct) - Debug::log(WARN, "[wl_output] Binding a wl_output that's inert?? Possible client bug."); + Log::logger->log(Log::WARN, "[wl_output] Binding a wl_output that's inert?? Possible client bug."); const auto RESOURCE = m_outputs.emplace_back(makeShared<CWLOutputResource>(makeShared<CWlOutput>(client, ver, id), m_monitor.lock())); diff --git a/src/protocols/core/Seat.cpp b/src/protocols/core/Seat.cpp index 74e5615e..bfe70a75 100644 --- a/src/protocols/core/Seat.cpp +++ b/src/protocols/core/Seat.cpp @@ -118,7 +118,7 @@ CWLPointerResource::CWLPointerResource(SP<CWlPointer> resource_, SP<CWLSeatResou m_resource->setSetCursor([this](CWlPointer* r, uint32_t serial, wl_resource* surf, int32_t hotX, int32_t hotY) { if (!m_owner) { - LOGM(ERR, "Client bug: setCursor when seatClient is already dead"); + LOGM(Log::ERR, "Client bug: setCursor when seatClient is already dead"); return; } @@ -162,7 +162,7 @@ void CWLPointerResource::sendEnter(SP<CWLSurfaceResource> surface, const Vector2 return; if (m_currentSurface) { - LOGM(WARN, "requested CWLPointerResource::sendEnter without sendLeave first."); + LOGM(Log::WARN, "requested CWLPointerResource::sendEnter without sendLeave first."); sendLeave(); } @@ -218,10 +218,10 @@ void CWLPointerResource::sendButton(uint32_t timeMs, uint32_t button, wl_pointer return; if (state == WL_POINTER_BUTTON_STATE_RELEASED && std::ranges::find(m_pressedButtons, button) == m_pressedButtons.end()) { - LOGM(ERR, "sendButton release on a non-pressed button"); + LOGM(Log::ERR, "sendButton release on a non-pressed button"); return; } else if (state == WL_POINTER_BUTTON_STATE_PRESSED && std::ranges::find(m_pressedButtons, button) != m_pressedButtons.end()) { - LOGM(ERR, "sendButton press on a non-pressed button"); + LOGM(Log::ERR, "sendButton press on a non-pressed button"); return; } @@ -328,7 +328,7 @@ CWLKeyboardResource::CWLKeyboardResource(SP<CWlKeyboard> resource_, SP<CWLSeatRe m_resource->setOnDestroy([this](CWlKeyboard* r) { PROTO::seat->destroyResource(this); }); if (!g_pSeatManager->m_keyboard) { - LOGM(ERR, "No keyboard on bound wl_keyboard??"); + LOGM(Log::ERR, "No keyboard on bound wl_keyboard??"); return; } @@ -380,7 +380,7 @@ void CWLKeyboardResource::sendEnter(SP<CWLSurfaceResource> surface, wl_array* ke return; if (m_currentSurface) { - LOGM(WARN, "requested CWLKeyboardResource::sendEnter without sendLeave first."); + LOGM(Log::WARN, "requested CWLKeyboardResource::sendEnter without sendLeave first."); sendLeave(); } @@ -531,7 +531,7 @@ void CWLSeatProtocol::bindManager(wl_client* client, void* data, uint32_t ver, u RESOURCE->m_self = RESOURCE; - LOGM(LOG, "New seat resource bound at {:x}", (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New seat resource bound at {:x}", (uintptr_t)RESOURCE.get()); m_events.newSeatResource.emit(RESOURCE); } diff --git a/src/protocols/core/Shm.cpp b/src/protocols/core/Shm.cpp index 43c087bc..476b58e3 100644 --- a/src/protocols/core/Shm.cpp +++ b/src/protocols/core/Shm.cpp @@ -87,7 +87,7 @@ CSHMPool::~CSHMPool() { } void CSHMPool::resize(size_t size_) { - LOGM(LOG, "Resizing a SHM pool from {} to {}", m_size, size_); + LOGM(Log::DEBUG, "Resizing a SHM pool from {} to {}", m_size, size_); if (m_data != MAP_FAILED) munmap(m_data, m_size); @@ -96,13 +96,13 @@ void CSHMPool::resize(size_t size_) { m_data = mmap(nullptr, m_size, PROT_READ | PROT_WRITE, MAP_SHARED, m_fd.get(), 0); if UNLIKELY (m_data == MAP_FAILED) - LOGM(ERR, "Couldn't mmap {} bytes from fd {} of shm client", m_size, m_fd.get()); + LOGM(Log::ERR, "Couldn't mmap {} bytes from fd {} of shm client", m_size, m_fd.get()); } static int shmIsSizeValid(CFileDescriptor& fd, size_t size) { struct stat st; if UNLIKELY (fstat(fd.get(), &st) == -1) { - LOGM(ERR, "Couldn't get stat for fd {} of shm client", fd.get()); + LOGM(Log::ERR, "Couldn't get stat for fd {} of shm client", fd.get()); return 0; } diff --git a/src/protocols/core/Subcompositor.cpp b/src/protocols/core/Subcompositor.cpp index c198052c..14dc4666 100644 --- a/src/protocols/core/Subcompositor.cpp +++ b/src/protocols/core/Subcompositor.cpp @@ -186,7 +186,7 @@ CWLSubcompositorResource::CWLSubcompositorResource(SP<CWlSubcompositor> resource SURF->m_role = makeShared<CSubsurfaceRole>(RESOURCE); PARENT->m_subsurfaces.emplace_back(RESOURCE); - LOGM(LOG, "New wl_subsurface with id {} at {:x}", id, (uintptr_t)RESOURCE.get()); + LOGM(Log::DEBUG, "New wl_subsurface with id {} at {:x}", id, (uintptr_t)RESOURCE.get()); PARENT->m_events.newSubsurface.emit(RESOURCE); }); diff --git a/src/protocols/types/Buffer.cpp b/src/protocols/types/Buffer.cpp index 86b37be0..ad19cb32 100644 --- a/src/protocols/types/Buffer.cpp +++ b/src/protocols/types/Buffer.cpp @@ -31,7 +31,7 @@ void IHLBuffer::onBackendRelease(const std::function<void()>& fn) { if (m_hlEvents.backendRelease) { if (m_backendReleaseQueuedFn) m_backendReleaseQueuedFn(); - Debug::log(LOG, "backendRelease emitted early"); + Log::logger->log(Log::DEBUG, "backendRelease emitted early"); } m_backendReleaseQueuedFn = fn; diff --git a/src/protocols/types/DMABuffer.cpp b/src/protocols/types/DMABuffer.cpp index 7116aa40..f3c3e067 100644 --- a/src/protocols/types/DMABuffer.cpp +++ b/src/protocols/types/DMABuffer.cpp @@ -25,12 +25,12 @@ CDMABuffer::CDMABuffer(uint32_t id, wl_client* client, Aquamarine::SDMABUFAttrs auto eglImage = g_pHyprOpenGL->createEGLImage(m_attrs); if UNLIKELY (!eglImage) { - Debug::log(ERR, "CDMABuffer: failed to import EGLImage, retrying as implicit"); + Log::logger->log(Log::ERR, "CDMABuffer: failed to import EGLImage, retrying as implicit"); m_attrs.modifier = DRM_FORMAT_MOD_INVALID; eglImage = g_pHyprOpenGL->createEGLImage(m_attrs); if UNLIKELY (!eglImage) { - Debug::log(ERR, "CDMABuffer: failed to import EGLImage"); + Log::logger->log(Log::ERR, "CDMABuffer: failed to import EGLImage"); return; } } @@ -40,7 +40,7 @@ CDMABuffer::CDMABuffer(uint32_t id, wl_client* client, Aquamarine::SDMABUFAttrs m_success = m_texture->m_texID; if UNLIKELY (!m_success) - Debug::log(ERR, "Failed to create a dmabuf: texture is null"); + Log::logger->log(Log::ERR, "Failed to create a dmabuf: texture is null"); } CDMABuffer::~CDMABuffer() { |
