1
1
#include " Monitor.hpp"
2
2
#include " ../Hyprpaper.hpp"
3
+ #include " MiscFunctions.hpp"
3
4
4
5
void SMonitor::registerListeners () {
5
- output->setMode ([this ](CCWlOutput* r, uint32_t flags, int32_t width, int32_t height, int32_t refresh) { size = Vector2D (width, height); });
6
+ output->setMode ([this ](CCWlOutput* r, uint32_t flags, int32_t width, int32_t height, int32_t refresh) {
7
+ size = Vector2D (width, height);
8
+
9
+ // ensures any transforms are also taken care of when setting the mode
10
+ if (transform & 1 )
11
+ std::swap (size.x , size.y );
12
+ });
6
13
7
14
output->setDone ([this ](CCWlOutput* r) {
8
15
readyForLS = true ;
@@ -25,12 +32,12 @@ void SMonitor::registerListeners() {
25
32
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,
26
33
int32_t transform_) { //
27
34
/*
28
- see https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output-enum-transform
29
- IF { (new transform event IS by 90n degrees) AND (old transform event was NOT by 90n degrees) }
30
- THEN { swap the size vector accordingly. }
35
+ see https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output-enum-transform
36
+ If there is a difference in parity of the old vs new transforms, the size needs to be swapped.
31
37
*/
32
- if (((transform_ % 4 ) == 1 || ( transform_ % 4 ) == 3 ) && ((transform % 4 ) != 1 || (transform % 4 ) != 3 ) )
38
+ if ((transform ^ transform_) & 1 )
33
39
std::swap (size.x , size.y );
40
+
34
41
transform = (wl_output_transform)transform_;
35
42
});
36
- }
43
+ }
0 commit comments