fix: wrong neshub version, formatting

This commit is contained in:
DatCaptainHorse
2026-08-31 17:24:00 +03:00
parent 6ea241c910
commit d9cdf60039
16 changed files with 618 additions and 317 deletions

View File

@@ -156,12 +156,7 @@ impl KeyboardTarget<NescopeState> for KeyboardFocusTarget {
}
impl PointerTarget<NescopeState> for KeyboardFocusTarget {
fn enter(
&self,
seat: &Seat<NescopeState>,
data: &mut NescopeState,
event: &MotionEvent,
) {
fn enter(&self, seat: &Seat<NescopeState>, data: &mut NescopeState, event: &MotionEvent) {
match self {
Self::Window(w) => match w.underlying_surface() {
WindowSurface::Wayland(w) => {
@@ -175,12 +170,7 @@ impl PointerTarget<NescopeState> for KeyboardFocusTarget {
}
}
fn motion(
&self,
seat: &Seat<NescopeState>,
data: &mut NescopeState,
event: &MotionEvent,
) {
fn motion(&self, seat: &Seat<NescopeState>, data: &mut NescopeState, event: &MotionEvent) {
match self {
Self::Window(w) => match w.underlying_surface() {
WindowSurface::Wayland(w) => {
@@ -205,9 +195,7 @@ impl PointerTarget<NescopeState> for KeyboardFocusTarget {
WindowSurface::Wayland(w) => {
PointerTarget::relative_motion(w.wl_surface(), seat, data, event)
}
WindowSurface::X11(s) => {
PointerTarget::relative_motion(s, seat, data, event)
}
WindowSurface::X11(s) => PointerTarget::relative_motion(s, seat, data, event),
},
Self::ProxiedX11 { proxy_surface, .. } => {
PointerTarget::relative_motion(proxy_surface, seat, data, event)
@@ -215,12 +203,7 @@ impl PointerTarget<NescopeState> for KeyboardFocusTarget {
}
}
fn button(
&self,
seat: &Seat<NescopeState>,
data: &mut NescopeState,
event: &ButtonEvent,
) {
fn button(&self, seat: &Seat<NescopeState>, data: &mut NescopeState, event: &ButtonEvent) {
match self {
Self::Window(w) => match w.underlying_surface() {
WindowSurface::Wayland(w) => {
@@ -234,17 +217,10 @@ impl PointerTarget<NescopeState> for KeyboardFocusTarget {
}
}
fn axis(
&self,
seat: &Seat<NescopeState>,
data: &mut NescopeState,
frame: AxisFrame,
) {
fn axis(&self, seat: &Seat<NescopeState>, data: &mut NescopeState, frame: AxisFrame) {
match self {
Self::Window(w) => match w.underlying_surface() {
WindowSurface::Wayland(w) => {
PointerTarget::axis(w.wl_surface(), seat, data, frame)
}
WindowSurface::Wayland(w) => PointerTarget::axis(w.wl_surface(), seat, data, frame),
WindowSurface::X11(s) => PointerTarget::axis(s, seat, data, frame),
},
Self::ProxiedX11 { proxy_surface, .. } => {
@@ -253,13 +229,7 @@ impl PointerTarget<NescopeState> for KeyboardFocusTarget {
}
}
fn leave(
&self,
seat: &Seat<NescopeState>,
data: &mut NescopeState,
serial: Serial,
time: u32,
) {
fn leave(&self, seat: &Seat<NescopeState>, data: &mut NescopeState, serial: Serial, time: u32) {
match self {
Self::Window(w) => match w.underlying_surface() {
WindowSurface::Wayland(w) => {
@@ -273,21 +243,67 @@ impl PointerTarget<NescopeState> for KeyboardFocusTarget {
}
}
fn gesture_swipe_begin(&self, _seat: &Seat<NescopeState>, _data: &mut NescopeState, _event: &smithay::input::pointer::GestureSwipeBeginEvent) {}
fn gesture_swipe_update(&self, _seat: &Seat<NescopeState>, _data: &mut NescopeState, _event: &smithay::input::pointer::GestureSwipeUpdateEvent) {}
fn gesture_swipe_end(&self, _seat: &Seat<NescopeState>, _data: &mut NescopeState, _event: &smithay::input::pointer::GestureSwipeEndEvent) {}
fn gesture_pinch_begin(&self, _seat: &Seat<NescopeState>, _data: &mut NescopeState, _event: &smithay::input::pointer::GesturePinchBeginEvent) {}
fn gesture_pinch_update(&self, _seat: &Seat<NescopeState>, _data: &mut NescopeState, _event: &smithay::input::pointer::GesturePinchUpdateEvent) {}
fn gesture_pinch_end(&self, _seat: &Seat<NescopeState>, _data: &mut NescopeState, _event: &smithay::input::pointer::GesturePinchEndEvent) {}
fn gesture_hold_begin(&self, _seat: &Seat<NescopeState>, _data: &mut NescopeState, _event: &smithay::input::pointer::GestureHoldBeginEvent) {}
fn gesture_hold_end(&self, _seat: &Seat<NescopeState>, _data: &mut NescopeState, _event: &smithay::input::pointer::GestureHoldEndEvent) {}
fn gesture_swipe_begin(
&self,
_seat: &Seat<NescopeState>,
_data: &mut NescopeState,
_event: &smithay::input::pointer::GestureSwipeBeginEvent,
) {
}
fn gesture_swipe_update(
&self,
_seat: &Seat<NescopeState>,
_data: &mut NescopeState,
_event: &smithay::input::pointer::GestureSwipeUpdateEvent,
) {
}
fn gesture_swipe_end(
&self,
_seat: &Seat<NescopeState>,
_data: &mut NescopeState,
_event: &smithay::input::pointer::GestureSwipeEndEvent,
) {
}
fn gesture_pinch_begin(
&self,
_seat: &Seat<NescopeState>,
_data: &mut NescopeState,
_event: &smithay::input::pointer::GesturePinchBeginEvent,
) {
}
fn gesture_pinch_update(
&self,
_seat: &Seat<NescopeState>,
_data: &mut NescopeState,
_event: &smithay::input::pointer::GesturePinchUpdateEvent,
) {
}
fn gesture_pinch_end(
&self,
_seat: &Seat<NescopeState>,
_data: &mut NescopeState,
_event: &smithay::input::pointer::GesturePinchEndEvent,
) {
}
fn gesture_hold_begin(
&self,
_seat: &Seat<NescopeState>,
_data: &mut NescopeState,
_event: &smithay::input::pointer::GestureHoldBeginEvent,
) {
}
fn gesture_hold_end(
&self,
_seat: &Seat<NescopeState>,
_data: &mut NescopeState,
_event: &smithay::input::pointer::GestureHoldEndEvent,
) {
}
fn frame(&self, seat: &Seat<NescopeState>, data: &mut NescopeState) {
match self {
Self::Window(w) => match w.underlying_surface() {
WindowSurface::Wayland(w) => {
PointerTarget::frame(w.wl_surface(), seat, data)
}
WindowSurface::Wayland(w) => PointerTarget::frame(w.wl_surface(), seat, data),
WindowSurface::X11(s) => PointerTarget::frame(s, seat, data),
},
Self::ProxiedX11 { proxy_surface, .. } => {

View File

@@ -25,10 +25,10 @@
use std::cell::{Cell, RefCell};
use std::path::PathBuf;
use smithay::backend::allocator::Buffer;
use smithay::backend::allocator::dmabuf::Dmabuf;
use smithay::backend::egl::{EGLContext, EGLDisplay};
use smithay::backend::renderer::gles::GlesRenderer;
use smithay::backend::allocator::Buffer;
use smithay::backend::renderer::{ExportMem, ImportDma};
use smithay::utils::{Point, Rectangle, Size};
@@ -66,9 +66,10 @@ fn render_device() -> Result<PathBuf, String> {
.filter_map(Result::ok)
.collect();
nodes.sort();
nodes.into_iter().next().ok_or_else(|| {
"no render node found in /dev/dri; pass --render-device".to_string()
})
nodes
.into_iter()
.next()
.ok_or_else(|| "no render node found in /dev/dri; pass --render-device".to_string())
}
/// Why a read did not happen.

View File

@@ -13,7 +13,10 @@ impl InputIpcSource {
pub fn connect(path: &str) -> io::Result<Self> {
let stream = UnixStream::connect(path)?;
stream.set_nonblocking(true)?;
Ok(Self { stream, buf: Vec::new() })
Ok(Self {
stream,
buf: Vec::new(),
})
}
pub fn try_clone(&self) -> io::Result<UnixStream> {
@@ -46,7 +49,10 @@ impl EventSource for InputIpcSource {
loop {
match self.stream.read(&mut tmp) {
Ok(0) => {
return Err(io::Error::new(io::ErrorKind::UnexpectedEof, "IPC socket closed"));
return Err(io::Error::new(
io::ErrorKind::UnexpectedEof,
"IPC socket closed",
));
}
Ok(n) => {
self.buf.extend_from_slice(&tmp[..n]);

View File

@@ -5,13 +5,9 @@ use std::os::unix::io::{AsRawFd, OwnedFd};
use std::path::Path;
use smithay::reexports::input::{
self as libinput,
event::{
self,
keyboard::KeyboardEventTrait,
pointer::PointerScrollEvent,
},
};
self as libinput,
event::{self, keyboard::KeyboardEventTrait, pointer::PointerScrollEvent},
};
use crate::input::{InputEvent, process_input};
use crate::state::NescopeState;
@@ -67,7 +63,10 @@ pub fn dispatch_libinput(ctx: &mut libinput::Libinput, state: &mut NescopeState)
match pev {
event::PointerEvent::Motion(ev) => {
process_input(
InputEvent::MouseMoveRelative { dx: ev.dx(), dy: ev.dy() },
InputEvent::MouseMoveRelative {
dx: ev.dx(),
dy: ev.dy(),
},
state,
);
}
@@ -89,10 +88,8 @@ pub fn dispatch_libinput(ctx: &mut libinput::Libinput, state: &mut NescopeState)
}
event::PointerEvent::Button(ev) => {
let button = ev.button();
let down = matches!(
ev.button_state(),
event::pointer::ButtonState::Pressed
);
let down =
matches!(ev.button_state(), event::pointer::ButtonState::Pressed);
let ev = if down {
InputEvent::MouseButtonDown { button }
} else {

View File

@@ -45,8 +45,8 @@ pub use crate::screenshot_wire::{REQUEST_CAPTURE, encode_reply};
use smithay::desktop::{Space, Window};
use smithay::reexports::wayland_server::protocol::wl_buffer;
use smithay::wayland::seat::WaylandFocus;
use smithay::wayland::compositor::{BufferAssignment, SurfaceAttributes, with_states};
use smithay::wayland::seat::WaylandFocus;
use smithay::wayland::shm::with_buffer_contents;
/// Read the pixels of the frontmost mapped window.
@@ -185,7 +185,6 @@ impl ScreenshotIpcSource {
pub fn try_clone_writer(&self) -> io::Result<UnixStream> {
self.stream.try_clone()
}
}
impl AsFd for ScreenshotIpcSource {