graphics: Move Damage from inputd to graphics-ipc

This commit is contained in:
bjorn3
2024-12-28 16:26:18 +01:00
parent 7b11acbc46
commit 5fc04c332d
15 changed files with 47 additions and 44 deletions
-29
View File
@@ -1,6 +1,3 @@
#![feature(iter_next_chunk)]
use std::cmp;
use std::fs::{File, OpenOptions};
use std::io::{Error, Read, Write};
use std::mem::size_of;
@@ -137,32 +134,6 @@ pub struct VtEvent {
pub stride: u32,
}
// Keep synced with orbital's SyncRect
#[derive(Debug, Copy, Clone)]
#[repr(packed)]
pub struct Damage {
pub x: i32,
pub y: i32,
pub width: i32,
pub height: i32,
}
impl Damage {
#[must_use]
pub fn clip(mut self, width: i32, height: i32) -> Self {
// Clip damage
self.x = cmp::min(self.x, width);
if self.x + self.width > width {
self.width -= cmp::min(self.width, width - self.x);
}
self.y = cmp::min(self.y, height);
if self.y + self.height > height {
self.height = cmp::min(self.height, height - self.y);
}
self
}
}
pub struct ProducerHandle(File);
impl ProducerHandle {