mirror of
https://github.com/hyprwm/hyprpaper.git
synced 2025-12-20 04:30:02 +01:00
ensure transforms are unique and relevant before swapping resolution
This commit is contained in:
parent
ecab9e7291
commit
561cb583da
2 changed files with 16 additions and 5 deletions
|
|
@ -2,7 +2,10 @@
|
|||
#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); });
|
||||
output->setMode([this](CCWlOutput* r, uint32_t flags, int32_t width, int32_t height, int32_t refresh) {
|
||||
size = Vector2D(width, height);
|
||||
newModeForGeometry = true;
|
||||
});
|
||||
|
||||
output->setDone([this](CCWlOutput* r) {
|
||||
readyForLS = true;
|
||||
|
|
@ -25,7 +28,14 @@ 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 (transform == WL_OUTPUT_TRANSFORM_90 || transform == WL_OUTPUT_TRANSFORM_270)
|
||||
|
||||
//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)
|
||||
std::swap(size.x, size.y);
|
||||
});
|
||||
}
|
||||
|
|
@ -22,9 +22,10 @@ struct SMonitor {
|
|||
uint32_t configureSerial = 0;
|
||||
SPoolBuffer buffer;
|
||||
|
||||
bool wantsReload = false;
|
||||
bool wantsACK = false;
|
||||
bool initialized = false;
|
||||
bool wantsReload = false;
|
||||
bool wantsACK = false;
|
||||
bool initialized = false;
|
||||
bool newModeForGeometry = false; //used to ensure mode has been set/changed before handling new geometry events
|
||||
|
||||
std::vector<std::unique_ptr<CLayerSurface>> layerSurfaces;
|
||||
CLayerSurface* pCurrentLayerSurface = nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue