aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-05-15 16:49:46 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-05-15 16:49:46 +0400
commit3e385d5c4868b4f7d65ac1f86659c607a7a919cc (patch)
tree48fa1fcbe24524505d3a53d4e007d7c53a3ce664 /src
parentb87fba2182a0b187c0d991f48d305387d0bea5e3 (diff)
downloadniri-3e385d5c4868b4f7d65ac1f86659c607a7a919cc.tar.gz
niri-3e385d5c4868b4f7d65ac1f86659c607a7a919cc.tar.bz2
niri-3e385d5c4868b4f7d65ac1f86659c607a7a919cc.zip
Clear fd flags before sending selection
Diffstat (limited to 'src')
-rw-r--r--src/handlers/mod.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs
index 080dd161..9f0812d1 100644
--- a/src/handlers/mod.rs
+++ b/src/handlers/mod.rs
@@ -15,6 +15,7 @@ use smithay::desktop::{PopupKind, PopupManager};
use smithay::input::pointer::{CursorIcon, CursorImageStatus, PointerHandle};
use smithay::input::{keyboard, Seat, SeatHandler, SeatState};
use smithay::output::Output;
+use smithay::reexports::rustix::fs::{fcntl_setfl, OFlags};
use smithay::reexports::wayland_protocols::xdg::shell::server::xdg_toplevel;
use smithay::reexports::wayland_server::protocol::wl_data_source::WlDataSource;
use smithay::reexports::wayland_server::protocol::wl_output::WlOutput;
@@ -188,6 +189,10 @@ impl SelectionHandler for State {
let buf = user_data.clone();
thread::spawn(move || {
+ // Clear O_NONBLOCK, otherwise io::copy() will stop halfway.
+ if let Err(err) = fcntl_setfl(&fd, OFlags::empty()) {
+ warn!("error clearing flags on selection target fd: {err:?}");
+ }
if let Err(err) = File::from(fd).write_all(&buf) {
warn!("error writing selection: {err:?}");
}