mirror of
https://github.com/hyprwm/hyprpaper.git
synced 2024-12-21 12:09:47 +01:00
core: conform to output transforms (#224)
This commit is contained in:
parent
eb9db3b815
commit
f15e678507
2 changed files with 22 additions and 2 deletions
|
@ -1,8 +1,15 @@
|
|||
#include "Monitor.hpp"
|
||||
#include "../Hyprpaper.hpp"
|
||||
#include "MiscFunctions.hpp"
|
||||
|
||||
void SMonitor::registerListeners() {
|
||||
output->setMode([this](CCWlOutput* r, uint32_t flags, int32_t width, int32_t height, int32_t refresh) { size = Vector2D(width, height); });
|
||||
output->setMode([this](CCWlOutput* r, uint32_t flags, int32_t width, int32_t height, int32_t refresh) {
|
||||
size = Vector2D(width, height);
|
||||
|
||||
//ensures any transforms are also taken care of when setting the mode
|
||||
if (transform & 1)
|
||||
std::swap(size.x, size.y);
|
||||
});
|
||||
|
||||
output->setDone([this](CCWlOutput* r) {
|
||||
readyForLS = true;
|
||||
|
@ -21,4 +28,16 @@ void SMonitor::registerListeners() {
|
|||
|
||||
description = desc;
|
||||
});
|
||||
}
|
||||
|
||||
output->setGeometry([this](CCWlOutput* r, int32_t x, int32_t y, int32_t width_mm, int32_t height_mm, int32_t subpixel, const char* make, const char* model,
|
||||
int32_t transform_) { //
|
||||
/*
|
||||
see https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output-enum-transform
|
||||
If there is a difference in parity of the old vs new transforms, the size needs to be swapped.
|
||||
*/
|
||||
if ((transform ^ transform_) & 1)
|
||||
std::swap(size.x, size.y);
|
||||
|
||||
transform = (wl_output_transform)transform_;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ struct SMonitor {
|
|||
uint32_t wayland_name = 0;
|
||||
Vector2D size;
|
||||
int scale;
|
||||
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||
|
||||
bool readyForLS = false;
|
||||
bool hasATarget = true;
|
||||
|
|
Loading…
Reference in a new issue