Jappie3 / wayfreeze

Tool to freeze the screen of a Wayland compositor
GNU Affero General Public License v3.0
19 stars 1 forks source link

Sway transform not respected #10

Open nrabulinski opened 1 week ago

nrabulinski commented 1 week ago

One of my monitors has 90 degree transform applied to it and wayfreeze doesn't respect it. Not sure how it's implemented in sway exactly but my guess is wayfreeze simply doesn't query rotation of the output. I tried wayfreeze compiled from latest master.

Jappie3 commented 1 week ago

thanks for reporting this issue, wayfreeze indeed doesn't take any rotation whatsoever into account - I'll have a look at how this can be implemented

Jappie3 commented 1 week ago

try master @nrabulinski, should be fixed

nrabulinski commented 1 week ago

Thanks for the quick response, it's crashing now :/

[2024-09-20T08:00:34Z INFO  wayfreeze] > Screen frozen
Protocol error 2 on object wp_viewport@29: source rectangle out of buffer bounds
thread 'main' panicked at src/main.rs:1005:65:
called `Result::unwrap()` on an `Err` value: Backend(Protocol(ProtocolError { code: 2, object_id: 29, object_interface: "wp_viewport", message: "source rectangle out of buffer bounds" }))
stack backtrace:
   0:     0x55965cd1cfeb - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h85e32f8f7b08f729
   1:     0x55965cd53900 - core::fmt::write::hae1cf5cde4ee2188
   2:     0x55965cd12405 - std::io::Write::write_fmt::h4ae54bff47727b29
   3:     0x55965cd1cdc4 - std::sys_common::backtrace::print::hea248a594c5888cf
   4:     0x55965cd1d927 - std::panicking::default_hook::{{closure}}::h545cae1ad29f25d2
   5:     0x55965cd1d674 - std::panicking::default_hook::hc1d7fee5faf0cc8a
   6:     0x55965cd1de88 - std::panicking::rust_panic_with_hook::h0e7975574d129b7c
   7:     0x55965cd1dd6e - std::panicking::begin_panic_handler::{{closure}}::h420dcc10a77211ab
   8:     0x55965cd1d206 - std::sys_common::backtrace::__rust_end_short_backtrace::he6597460302ecd4a
   9:     0x55965cd1dad2 - rust_begin_unwind
  10:     0x55965cb8e9b5 - core::panicking::panic_fmt::h3cf3338e18ada46e
  11:     0x55965cb8e973 - core::result::unwrap_failed::h22597ad5fa95281f
  12:     0x55965cb9bf99 - wayfreeze::ScreenFreezer::freeze::h7e12ff9ffd21e18a
  13:     0x55965cb9cb2c - wayfreeze::main::hb0a26ff2e3fdffdf
  14:     0x55965cbb7893 - std::sys_common::backtrace::__rust_begin_short_backtrace::h2b377753957602a0
  15:     0x55965cbb4699 - std::rt::lang_start::{{closure}}::h37e73d37d272589e
  16:     0x55965cd1d9c4 - std::panicking::try::h839c5e98485eaaba
  17:     0x55965cd2783b - std::rt::lang_start_internal::h6a4b333c7c2ab7bd
  18:     0x55965cbb468e - std::rt::lang_start::he8112c8bb2249de6
  19:     0x7fab4d8df0ce - __libc_start_call_main
  20:     0x7fab4d8df189 - __libc_start_main@GLIBC_2.2.5
  21:     0x55965cb8f085 - _start
  22:                0x0 - <unknown>
Jappie3 commented 1 week ago

that's what I get for testing on Hyprland but not on Sway... looking into it :sweat_smile:

Jappie3 commented 1 week ago

crash is fixed, see 7a07f0ad5abf50fcd4e801b0ea2dd9ce02f4ca30

tested in both Hyprland & Wayfire, works with normal & rotated screens sway works with unrotated screens, but when you rotate an output sway somehow goes the opposite direction (clockwise) compared to the other compositors? and then my buffer renders with a counter-clockwise rotation (so 180 degrees flipped)...

Wayfire works, that's also a wlroots compositor, so I suspect Sway is up to some shenanigans (found this thing, could be related? https://github.com/swaywm/sway/issues/7701)

sooo that leaves this issue unresolved ig... I'll see if I can take this upstream to Sway

Jappie3 commented 1 week ago

(feel free to test btw, that way we know the behaviour is reproducible)

Jappie3 commented 1 week ago

7a07f0ad5abf50fcd4e801b0ea2dd9ce02f4ca30 apparently broke fractional scaling - that's fixed now

Did some more testing and this entire situation is one huge mess - I cannot seem to get consistent behaviour between Hyprland, Sway and Wayfire (the 3 I'm testing with). It seems like they all do their own shit regarding fractional scaling and rotating buffers n stuff... I might sporadically look into this if I have more free time in the coming weeks, but I'm not promising anything - especially when it comes to fractionally scaled rotated monitors.