cursor: Use seat id for rendering
This commit is contained in:
parent
b64071b068
commit
ea282809f4
1 changed files with 5 additions and 2 deletions
|
|
@ -159,6 +159,7 @@ pub fn draw_dnd_icon(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct PointerElement<T: Texture> {
|
pub struct PointerElement<T: Texture> {
|
||||||
|
seat_id: usize,
|
||||||
texture: T,
|
texture: T,
|
||||||
position: Point<f64, Logical>,
|
position: Point<f64, Logical>,
|
||||||
size: Size<i32, Logical>,
|
size: Size<i32, Logical>,
|
||||||
|
|
@ -167,12 +168,14 @@ pub struct PointerElement<T: Texture> {
|
||||||
|
|
||||||
impl<T: Texture> PointerElement<T> {
|
impl<T: Texture> PointerElement<T> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
|
seat: &Seat<State>,
|
||||||
texture: T,
|
texture: T,
|
||||||
relative_pointer_pos: Point<f64, Logical>,
|
relative_pointer_pos: Point<f64, Logical>,
|
||||||
new_frame: bool,
|
new_frame: bool,
|
||||||
) -> PointerElement<T> {
|
) -> PointerElement<T> {
|
||||||
let size = texture.size().to_logical(1, Transform::Normal);
|
let size = texture.size().to_logical(1, Transform::Normal);
|
||||||
PointerElement {
|
PointerElement {
|
||||||
|
seat_id: seat.id(),
|
||||||
texture,
|
texture,
|
||||||
position: relative_pointer_pos,
|
position: relative_pointer_pos,
|
||||||
size,
|
size,
|
||||||
|
|
@ -187,7 +190,7 @@ where
|
||||||
<R as Renderer>::TextureId: 'static,
|
<R as Renderer>::TextureId: 'static,
|
||||||
{
|
{
|
||||||
fn id(&self) -> usize {
|
fn id(&self) -> usize {
|
||||||
0
|
self.seat_id
|
||||||
}
|
}
|
||||||
|
|
||||||
fn location(&self, scale: impl Into<Scale<f64>>) -> Point<f64, Physical> {
|
fn location(&self, scale: impl Into<Scale<f64>>) -> Point<f64, Physical> {
|
||||||
|
|
@ -336,7 +339,7 @@ where
|
||||||
Point::<i32, Logical>::from((frame.xhot as i32, frame.yhot as i32)).to_f64();
|
Point::<i32, Logical>::from((frame.xhot as i32, frame.yhot as i32)).to_f64();
|
||||||
*state.current_image.borrow_mut() = Some(frame);
|
*state.current_image.borrow_mut() = Some(frame);
|
||||||
|
|
||||||
Some(PointerElement::new(pointer_image.clone(), location - hotspot, new_frame).into())
|
Some(PointerElement::new(seat, pointer_image.clone(), location - hotspot, new_frame).into())
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue