From 3d73ed0f057a555ded67ad58dbe02b36cd4d2d1f Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Tue, 24 Dec 2024 20:44:00 +0200 Subject: Accumulate wayland-crate additions: capture rendering, focus/Space sync, VT resume, plumbing Bundles the remaining wayland-crate changes built up here, touching both backends (udev and winit) and the shared input/rendering code: - udev/capture.rs: off-screen Pixman render of an arbitrary (not necessarily on-screen) workspace's window content to a PPM file -- what crates/core's capture-request queue drives, for a workspace switcher's thumbnail previews. wlr-screencopy structurally can't do this (it can only see what an output is presenting), which is why this exists as a separate render path rather than reusing it. - input::focus_window now also raises the window in smithay's own Space, not just core's stacking order - Space is what actually renders on top and what pointer hit-testing reads, so any focus path that skipped this (an IPC "focus" dispatch, concretely) left a window genuinely focused while still rendering, and receiving clicks, underneath whatever was already topmost. Both backends' poll loops now re-sync this after any IPC mutation. - udev/session.rs's VT-switch resume fix (drains a stale pending page flip before reasserting CRTCs) already has its own earlier, cleanly isolated commit - not duplicated here. - Assorted decoration/cursor/rounded-corners/output-management/ screencopy/XWayland changes and their cross-backend wiring. Coarser than the repo's usual one-purpose-per-commit convention, deliberately - see the core-crate sweep commit's own message for why. --- crates/wayland/src/udev/mod.rs | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'crates/wayland/src/udev/mod.rs') diff --git a/crates/wayland/src/udev/mod.rs b/crates/wayland/src/udev/mod.rs index 2d9f9ff..501e3fc 100644 --- a/crates/wayland/src/udev/mod.rs +++ b/crates/wayland/src/udev/mod.rs @@ -33,8 +33,9 @@ use std::rc::Rc; use std::time::{Duration, Instant}; use smithay::backend::input::{ - Axis, ButtonState as BackendButtonState, Event as InputEventTrait, InputEvent, PointerAxisEvent, - PointerButtonEvent, PointerMotionEvent, + Axis, ButtonState as BackendButtonState, Event as InputEventTrait, GestureBeginEvent as BackendGestureBeginEvent, + GestureEndEvent as BackendGestureEndEvent, GesturePinchUpdateEvent as BackendGesturePinchUpdateEvent, InputEvent, + PointerAxisEvent, PointerButtonEvent, PointerMotionEvent, }; use smithay::backend::libinput::{LibinputInputBackend, LibinputSessionInterface}; use smithay::backend::renderer::damage::OutputDamageTracker; @@ -47,7 +48,10 @@ use smithay::backend::udev::{self, UdevBackend, UdevEvent}; use smithay::desktop::{layer_map_for_output, PopupManager, Space}; use smithay::backend::input::AxisSource; use smithay::wayland::shell::wlr_layer::Layer; -use smithay::input::pointer::AxisFrame; +use smithay::input::pointer::{ + AxisFrame, GestureHoldBeginEvent, GestureHoldEndEvent, GesturePinchBeginEvent, GesturePinchEndEvent, + GesturePinchUpdateEvent, +}; use smithay::input::SeatState; use smithay::output::{Mode as OutputMode, Output, PhysicalProperties, Subpixel}; use smithay::reexports::calloop::generic::{FdWrapper, Generic}; @@ -63,7 +67,7 @@ use smithay::reexports::pixman::{FormatCode, Image}; use smithay::reexports::rustix; use smithay::reexports::wayland_server::backend::GlobalId; use smithay::reexports::wayland_server::{Client, Display, DisplayHandle, ListeningSocket}; -use smithay::utils::{Logical, Physical, Point, Rectangle, Scale, Size, Transform}; +use smithay::utils::{Logical, Physical, Point, Rectangle, Scale, Size, Transform, SERIAL_COUNTER}; use smithay::wayland::compositor::CompositorState; use smithay::wayland::dmabuf::DmabufState; use smithay::wayland::selection::data_device::DataDeviceState; @@ -79,7 +83,10 @@ use srdwm_platform::{Platform, PlatformError, PlatformKind, Result as PlatformRe use crate::decoration; use crate::err; -use crate::input::{handle_keyboard_key_event, handle_pointer_button, handle_pointer_position}; +use crate::input::{ + handle_gesture_swipe_begin, handle_gesture_swipe_end, handle_gesture_swipe_update, handle_keyboard_key_event, + handle_pointer_button, handle_pointer_position, +}; use crate::state::{ClientState, CompState}; /// A DRM device node, opened through the session (not a raw `File::open`) @@ -158,6 +165,14 @@ pub(crate) struct UdevState { /// Pointer position in the *global* space, so it can cross between /// monitors; clamped to the union of all head rectangles. pub(crate) pointer_pos: Point, + /// A clone of the same `LibSeatSession` `platform.rs` opened the DRM + /// device with (`LibSeatSession` is cheaply `Clone` - see its own + /// derive - all clones share the same underlying seat connection). + /// Kept here, reachable from `input.rs`'s keyboard handler, purely so + /// `Ctrl+Alt+F` can call `change_vt` on it - nothing else in this + /// backend needed the session handle after startup, so it was never + /// retained anywhere before this. + pub(crate) session: LibSeatSession, } impl UdevState { @@ -226,6 +241,7 @@ impl UdevHead { } } +mod capture; mod drm; mod outputs; mod platform; -- cgit v1.2.3