mirror of
https://github.com/hyprwm/hyprlock.git
synced 2025-12-22 01:40:02 +01:00
49 lines
1.8 KiB
C++
49 lines
1.8 KiB
C++
|
|
#include "Output.hpp"
|
||
|
|
#include "../helpers/Log.hpp"
|
||
|
|
|
||
|
|
static void handleGeometry(void* data, wl_output* output, 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) {
|
||
|
|
const auto POUTPUT = (COutput*)data;
|
||
|
|
POUTPUT->transform = (wl_output_transform)transform;
|
||
|
|
|
||
|
|
Debug::log(LOG, "output {} make {} model {}", POUTPUT->name, make ? make : "", model ? model : "");
|
||
|
|
}
|
||
|
|
|
||
|
|
static void handleMode(void* data, wl_output* output, uint32_t flags, int32_t width, int32_t height, int32_t refresh) {
|
||
|
|
const auto POUTPUT = (COutput*)data;
|
||
|
|
POUTPUT->size = {width, height};
|
||
|
|
}
|
||
|
|
|
||
|
|
static void handleDone(void* data, wl_output* output) {
|
||
|
|
;
|
||
|
|
}
|
||
|
|
|
||
|
|
static void handleScale(void* data, wl_output* output, int32_t factor) {
|
||
|
|
const auto POUTPUT = (COutput*)data;
|
||
|
|
POUTPUT->scale = factor;
|
||
|
|
}
|
||
|
|
|
||
|
|
static void handleName(void* data, wl_output* output, const char* name) {
|
||
|
|
const auto POUTPUT = (COutput*)data;
|
||
|
|
POUTPUT->stringName = std::string{name} + POUTPUT->stringName;
|
||
|
|
POUTPUT->stringPort = std::string{name};
|
||
|
|
Debug::log(LOG, "output {} name {}", POUTPUT->name, name);
|
||
|
|
}
|
||
|
|
|
||
|
|
static void handleDescription(void* data, wl_output* output, const char* description) {
|
||
|
|
const auto POUTPUT = (COutput*)data;
|
||
|
|
Debug::log(LOG, "output {} description {}", POUTPUT->name, description ? description : "");
|
||
|
|
}
|
||
|
|
|
||
|
|
static const wl_output_listener outputListener = {
|
||
|
|
.geometry = handleGeometry,
|
||
|
|
.mode = handleMode,
|
||
|
|
.done = handleDone,
|
||
|
|
.scale = handleScale,
|
||
|
|
.name = handleName,
|
||
|
|
.description = handleDescription,
|
||
|
|
};
|
||
|
|
|
||
|
|
COutput::COutput(wl_output* output, uint32_t name) : name(name), output(output) {
|
||
|
|
wl_output_add_listener(output, &outputListener, this);
|
||
|
|
}
|