mirror of
https://github.com/hyprwm/aquamarine.git
synced 2024-11-17 02:35:59 +01:00
core: allow specifying names for outputs
This commit is contained in:
parent
51cd6f4374
commit
13f94112aa
7 changed files with 19 additions and 24 deletions
|
@ -66,16 +66,16 @@ namespace Aquamarine {
|
||||||
AQ_BACKEND_CAPABILITY_POINTER = (1 << 0),
|
AQ_BACKEND_CAPABILITY_POINTER = (1 << 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual eBackendType type() = 0;
|
virtual eBackendType type() = 0;
|
||||||
virtual bool start() = 0;
|
virtual bool start() = 0;
|
||||||
virtual std::vector<Hyprutils::Memory::CSharedPointer<SPollFD>> pollFDs() = 0;
|
virtual std::vector<Hyprutils::Memory::CSharedPointer<SPollFD>> pollFDs() = 0;
|
||||||
virtual int drmFD() = 0;
|
virtual int drmFD() = 0;
|
||||||
virtual bool dispatchEvents() = 0;
|
virtual bool dispatchEvents() = 0;
|
||||||
virtual uint32_t capabilities() = 0;
|
virtual uint32_t capabilities() = 0;
|
||||||
virtual void onReady() = 0;
|
virtual void onReady() = 0;
|
||||||
virtual std::vector<SDRMFormat> getRenderFormats() = 0;
|
virtual std::vector<SDRMFormat> getRenderFormats() = 0;
|
||||||
virtual std::vector<SDRMFormat> getCursorFormats() = 0;
|
virtual std::vector<SDRMFormat> getCursorFormats() = 0;
|
||||||
virtual bool createOutput() = 0;
|
virtual bool createOutput(const std::string& name = "") = 0; // "" means auto
|
||||||
};
|
};
|
||||||
|
|
||||||
class CBackend {
|
class CBackend {
|
||||||
|
|
|
@ -289,7 +289,7 @@ namespace Aquamarine {
|
||||||
virtual void onReady();
|
virtual void onReady();
|
||||||
virtual std::vector<SDRMFormat> getRenderFormats();
|
virtual std::vector<SDRMFormat> getRenderFormats();
|
||||||
virtual std::vector<SDRMFormat> getCursorFormats();
|
virtual std::vector<SDRMFormat> getCursorFormats();
|
||||||
virtual bool createOutput();
|
virtual bool createOutput(const std::string& name = "");
|
||||||
|
|
||||||
Hyprutils::Memory::CWeakPointer<CDRMBackend> self;
|
Hyprutils::Memory::CWeakPointer<CDRMBackend> self;
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace Aquamarine {
|
||||||
virtual void onReady();
|
virtual void onReady();
|
||||||
virtual std::vector<SDRMFormat> getRenderFormats();
|
virtual std::vector<SDRMFormat> getRenderFormats();
|
||||||
virtual std::vector<SDRMFormat> getCursorFormats();
|
virtual std::vector<SDRMFormat> getCursorFormats();
|
||||||
virtual bool createOutput();
|
virtual bool createOutput(const std::string& name = "");
|
||||||
|
|
||||||
Hyprutils::Memory::CWeakPointer<CHeadlessBackend> self;
|
Hyprutils::Memory::CWeakPointer<CHeadlessBackend> self;
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ namespace Aquamarine {
|
||||||
virtual void onReady();
|
virtual void onReady();
|
||||||
virtual std::vector<SDRMFormat> getRenderFormats();
|
virtual std::vector<SDRMFormat> getRenderFormats();
|
||||||
virtual std::vector<SDRMFormat> getCursorFormats();
|
virtual std::vector<SDRMFormat> getCursorFormats();
|
||||||
virtual bool createOutput();
|
virtual bool createOutput(const std::string& name = "");
|
||||||
|
|
||||||
Hyprutils::Memory::CWeakPointer<CWaylandBackend> self;
|
Hyprutils::Memory::CWeakPointer<CWaylandBackend> self;
|
||||||
|
|
||||||
|
@ -142,7 +142,6 @@ namespace Aquamarine {
|
||||||
void initSeat();
|
void initSeat();
|
||||||
void initShell();
|
void initShell();
|
||||||
bool initDmabuf();
|
bool initDmabuf();
|
||||||
void createOutput(const std::string& szName);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
Hyprutils::Memory::CWeakPointer<CBackend> backend;
|
Hyprutils::Memory::CWeakPointer<CBackend> backend;
|
||||||
|
|
|
@ -117,8 +117,8 @@ std::vector<SDRMFormat> Aquamarine::CHeadlessBackend::getCursorFormats() {
|
||||||
return {}; // No cursor support
|
return {}; // No cursor support
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Aquamarine::CHeadlessBackend::createOutput() {
|
bool Aquamarine::CHeadlessBackend::createOutput(const std::string& name) {
|
||||||
auto output = SP<CHeadlessOutput>(new CHeadlessOutput(std::format("HEADLESS-{}", ++outputIDCounter), self.lock()));
|
auto output = SP<CHeadlessOutput>(new CHeadlessOutput(name.empty() ? std::format("HEADLESS-{}", ++outputIDCounter) : name, self.lock()));
|
||||||
outputs.emplace_back(output);
|
outputs.emplace_back(output);
|
||||||
output->swapchain = CSwapchain::create(backend->allocator, self.lock());
|
output->swapchain = CSwapchain::create(backend->allocator, self.lock());
|
||||||
output->self = output;
|
output->self = output;
|
||||||
|
|
|
@ -134,10 +134,11 @@ int Aquamarine::CWaylandBackend::drmFD() {
|
||||||
return drmState.fd;
|
return drmState.fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aquamarine::CWaylandBackend::createOutput(const std::string& szName) {
|
bool Aquamarine::CWaylandBackend::createOutput(const std::string& szName) {
|
||||||
auto o = outputs.emplace_back(SP<CWaylandOutput>(new CWaylandOutput(szName, self)));
|
auto o = outputs.emplace_back(SP<CWaylandOutput>(new CWaylandOutput(szName.empty() ? std::format("WAYLAND-{}", ++lastOutputID) : szName, self)));
|
||||||
o->self = o;
|
o->self = o;
|
||||||
idleCallbacks.emplace_back([this, o]() { backend->events.newOutput.emit(SP<IOutput>(o)); });
|
idleCallbacks.emplace_back([this, o]() { backend->events.newOutput.emit(SP<IOutput>(o)); });
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Hyprutils::Memory::CSharedPointer<SPollFD>> Aquamarine::CWaylandBackend::pollFDs() {
|
std::vector<Hyprutils::Memory::CSharedPointer<SPollFD>> Aquamarine::CWaylandBackend::pollFDs() {
|
||||||
|
@ -431,11 +432,6 @@ std::vector<SDRMFormat> Aquamarine::CWaylandBackend::getCursorFormats() {
|
||||||
return dmabufFormats;
|
return dmabufFormats;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Aquamarine::CWaylandBackend::createOutput() {
|
|
||||||
createOutput(std::format("WAYLAND-{}", ++lastOutputID));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Aquamarine::CWaylandOutput::CWaylandOutput(const std::string& name_, Hyprutils::Memory::CWeakPointer<CWaylandBackend> backend_) : backend(backend_) {
|
Aquamarine::CWaylandOutput::CWaylandOutput(const std::string& name_, Hyprutils::Memory::CWeakPointer<CWaylandBackend> backend_) : backend(backend_) {
|
||||||
name = name_;
|
name = name_;
|
||||||
|
|
||||||
|
|
|
@ -651,7 +651,7 @@ std::vector<SDRMFormat> Aquamarine::CDRMBackend::getCursorFormats() {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Aquamarine::CDRMBackend::createOutput() {
|
bool Aquamarine::CDRMBackend::createOutput(const std::string&) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue