2024-02-18 23:08:03 +00:00
|
|
|
#include "Output.hpp"
|
|
|
|
|
#include "../helpers/Log.hpp"
|
2024-02-26 17:58:50 +00:00
|
|
|
#include "hyprlock.hpp"
|
|
|
|
|
#include "../renderer/Renderer.hpp"
|
2024-02-18 23:08:03 +00:00
|
|
|
|
2024-12-29 18:36:08 +00:00
|
|
|
COutput::COutput(SP<CCWlOutput> output_, uint32_t name_) : name(name_), output(output_) {
|
|
|
|
|
output->setDescription([this](CCWlOutput* r, const char* description) {
|
|
|
|
|
stringDesc = description ? std::string{description} : "";
|
|
|
|
|
Debug::log(LOG, "output {} description {}", name, stringDesc);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
output->setName([this](CCWlOutput* r, const char* name) {
|
|
|
|
|
stringName = std::string{name} + stringName;
|
|
|
|
|
stringPort = std::string{name};
|
|
|
|
|
Debug::log(LOG, "output {} name {}", name, name);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
output->setScale([this](CCWlOutput* r, int32_t sc) { scale = sc; });
|
|
|
|
|
|
|
|
|
|
output->setDone([this](CCWlOutput* r) {
|
|
|
|
|
Debug::log(LOG, "output {} done", name);
|
|
|
|
|
if (g_pHyprlock->m_bLocked && !sessionLockSurface) {
|
|
|
|
|
// if we are already locked, create a surface dynamically
|
|
|
|
|
Debug::log(LOG, "Creating a surface dynamically for output as we are already locked");
|
|
|
|
|
sessionLockSurface = std::make_unique<CSessionLockSurface>(this);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
output->setMode([this](CCWlOutput* r, uint32_t flags, int32_t width, int32_t height, int32_t refresh) {
|
|
|
|
|
// handle portrait mode and flipped cases
|
|
|
|
|
if (transform % 2 == 1)
|
|
|
|
|
size = {height, width};
|
|
|
|
|
else
|
|
|
|
|
size = {width, height};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
output->setGeometry(
|
|
|
|
|
[this](CCWlOutput* r, int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const char* make, const char* model, int32_t transform) {
|
|
|
|
|
transform = (wl_output_transform)transform;
|
|
|
|
|
|
|
|
|
|
Debug::log(LOG, "output {} make {} model {}", name, make ? make : "", model ? model : "");
|
|
|
|
|
});
|
2024-03-24 00:06:54 +03:00
|
|
|
}
|