aboutsummaryrefslogtreecommitdiff
path: root/src/handlers
diff options
context:
space:
mode:
authorsodiboo <37938646+sodiboo@users.noreply.github.com>2024-03-08 13:10:55 +0100
committerGitHub <noreply@github.com>2024-03-08 04:10:55 -0800
commitca22e70cc4a868fdb4dec2790ec71fb9a2cfb6bd (patch)
tree69373c13068005180cc75372e16cf493dcb98e38 /src/handlers
parent1a784e6e66785f360da6df59ae2fb4b98370ca3c (diff)
downloadniri-ca22e70cc4a868fdb4dec2790ec71fb9a2cfb6bd.tar.gz
niri-ca22e70cc4a868fdb4dec2790ec71fb9a2cfb6bd.tar.bz2
niri-ca22e70cc4a868fdb4dec2790ec71fb9a2cfb6bd.zip
Implement wlr-screencopy v1 (#243)
* Implement wlr-screencopy * Finish the implementation Lots of changes, mainly to fix transform handling. Turns out, grim expects transformed buffers and untransforms them by itself using info from wl_output. This means that render helpers needed to learn how to actually render transformed buffers. Also, it meant that y_invert is no longer needed. Next, moved the rendering to the Screencopy frame handler. Turns out, copy() is more or less expected to return immediately, whereas copy_with_damage() is expected to wait until the next VBlank. At least that's the intent I parse reading the protocol. Finally, brought the version from 3 down to 1, because copy_with_damage() will need bigger changes. Grim still works, others not really, mainly because they bind v3 unnecessarily, even if they don't use the damage request. --------- Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
Diffstat (limited to 'src/handlers')
-rw-r--r--src/handlers/mod.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs
index 8e92ea6e..39173471 100644
--- a/src/handlers/mod.rs
+++ b/src/handlers/mod.rs
@@ -54,12 +54,13 @@ use smithay::{
delegate_text_input_manager, delegate_virtual_keyboard_manager,
};
-use crate::delegate_foreign_toplevel;
use crate::niri::{ClientState, State};
use crate::protocols::foreign_toplevel::{
self, ForeignToplevelHandler, ForeignToplevelManagerState,
};
+use crate::protocols::screencopy::{Screencopy, ScreencopyHandler};
use crate::utils::output_size;
+use crate::{delegate_foreign_toplevel, delegate_screencopy};
impl SeatHandler for State {
type KeyboardFocus = WlSurface;
@@ -380,6 +381,18 @@ impl ForeignToplevelHandler for State {
}
delegate_foreign_toplevel!(State);
+impl ScreencopyHandler for State {
+ fn frame(&mut self, screencopy: Screencopy) {
+ if let Err(err) = self
+ .niri
+ .render_for_screencopy(&mut self.backend, screencopy)
+ {
+ warn!("error rendering for screencopy: {err:?}");
+ }
+ }
+}
+delegate_screencopy!(State);
+
impl DrmLeaseHandler for State {
fn drm_lease_state(&mut self, node: DrmNode) -> &mut DrmLeaseState {
&mut self