srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/wayland/src/protocols/seat.rs
blob: bd7ae4cc0042326520a13464e1869594d99559af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//! `wl_seat`: keyboard/pointer/touch focus types and the client-set cursor
//! image.

use smithay::input::pointer::CursorImageStatus;
use smithay::input::{Seat, SeatHandler, SeatState};
use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface;

use crate::state::CompState;

impl SeatHandler for CompState {
    type KeyboardFocus = WlSurface;
    type PointerFocus = WlSurface;
    type TouchFocus = WlSurface;

    fn seat_state(&mut self) -> &mut SeatState<Self> {
        &mut self.seat_state
    }

    fn focus_changed(&mut self, _seat: &Seat<Self>, _focused: Option<&WlSurface>) {}
    /// Clients set their own cursor (an I-beam over text, a hand over a
    /// link). Recorded here and drawn by the render paths - on a bare TTY
    /// nothing else would draw it. See `cursor.rs`.
    fn cursor_image(&mut self, _seat: &Seat<Self>, image: CursorImageStatus) {
        self.cursor_status = image;
        // The client has now explicitly claimed the cursor - see
        // `decoration_cursor_active`'s own doc comment and `input.rs::
        // update_cursor_shape` for why this has to be tracked separately
        // from just overwriting `cursor_status`.
        self.decoration_cursor_active = false;
    }
}