Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c03d4659 authored by Leon Scroggins III's avatar Leon Scroggins III
Browse files

Name the ScreenCaptureOutput

Set a name for ScreenCaptureOutput based on whether it's used for region
sampling or not and include the display's id if present.

In Output's mNamePlusId, drop " (NA)" for those without a display id.
This would be extraneous on the ScreenCaptureOutput, which will mark the
display for which it's being used.

Bug: 262706813
Test: look at traces

Change-Id: If447795f3580601434cbcb6493f5fb7c3fa734c9
parent 7d089caa
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -118,8 +118,9 @@ const std::string& Output::getName() const {
void Output::setName(const std::string& name) {
    mName = name;
    auto displayIdOpt = getDisplayId();
    mNamePlusId = base::StringPrintf("%s (%s)", mName.c_str(),
                                     displayIdOpt ? to_string(*displayIdOpt).c_str() : "NA");
    mNamePlusId = displayIdOpt ? base::StringPrintf("%s (%s)", mName.c_str(),
                                     to_string(*displayIdOpt).c_str())
                               : mName;
}

void Output::setCompositionEnabled(bool enabled) {
+7 −0
Original line number Diff line number Diff line
@@ -53,6 +53,13 @@ std::shared_ptr<ScreenCaptureOutput> createScreenCaptureOutput(ScreenCaptureOutp
    Rect sourceCrop = args.renderArea.getSourceCrop();
    output->setDisplaySize({sourceCrop.getWidth(), sourceCrop.getHeight()});

    {
        std::string name = args.regionSampling ? "RegionSampling" : "ScreenCaptureOutput";
        if (auto displayDevice = args.renderArea.getDisplayDevice()) {
            base::StringAppendF(&name, " for %" PRIu64, displayDevice->getId().value);
        }
        output->setName(name);
    }
    return output;
}