-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
12 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
use std::os::unix::io::RawFd; | ||
use std::collections::HashMap; | ||
use wayland_backend::io_lifetimes::OwnedFd; | ||
|
||
#[derive(Default)] | ||
pub struct Object { | ||
pub width: u32, | ||
pub height: u32, | ||
pub num_objects: u32, | ||
pub fds: Vec<RawFd>, | ||
pub sizes: Vec<u32>, | ||
pub fds: HashMap<u32, OwnedFd>, | ||
pub sizes: HashMap<u32, u32>, | ||
} | ||
|
||
impl Object { | ||
pub fn set_metadata(&mut self, width: u32, height: u32, num_objects: u32) { | ||
self.width = width; | ||
self.height = height; | ||
self.num_objects = num_objects; | ||
self.fds.resize(num_objects as usize, 0); | ||
self.sizes.resize(num_objects as usize, 0); | ||
self.fds = HashMap::new(); | ||
self.sizes = HashMap::new(); | ||
} | ||
|
||
pub fn set_object(&mut self, index: u32, fd: RawFd, size: u32) { | ||
self.fds[index as usize] = fd; | ||
self.sizes[index as usize] = size; | ||
pub fn set_object(&mut self, index: u32, fd: OwnedFd, size: u32) { | ||
self.fds[&index] = fd; | ||
self.sizes[&index] = size; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters