Skip to content

Commit

Permalink
fixd
Browse files Browse the repository at this point in the history
  • Loading branch information
caffeine01 committed Dec 19, 2024
1 parent 561cb58 commit bedf9b6
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/helpers/Monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
#include "../Hyprpaper.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);
newModeForGeometry = true;
});
output->setMode([this](CCWlOutput* r, uint32_t flags, int32_t width, int32_t height, int32_t refresh) { size = Vector2D(width, height); });

output->setDone([this](CCWlOutput* r) {
readyForLS = true;
Expand All @@ -27,15 +24,13 @@ void SMonitor::registerListeners() {

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_) { //
transform = (wl_output_transform)transform_;

//if no new mode has been sent before a geometry request, ignore it.
if (!newModeForGeometry)
return;
newModeForGeometry = false;

//see https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output-enum-transform
if ((transform % 4) == 1 || (transform % 4) == 3)
/*
see https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output-enum-transform
IF { (new transform event IS by 90n degrees) AND (old transform event was NOT by 90n degrees) }
THEN { swap the size vector accordingly. }
*/
if (((transform_ % 4) == 1 || (transform_ % 4) == 3) && ((transform % 4) != 1 || (transform % 4) != 3))
std::swap(size.x, size.y);
transform = (wl_output_transform)transform_;
});
}

0 comments on commit bedf9b6

Please sign in to comment.