mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2024-12-23 19:31:30 +11:00
Restructure Unix implementation in preparation for Wayland support
* Wayland implementation restructuration * Moved previous X11 code into own module * Moved some data into a common struct between wayland and x11 * Added glue * Moved common unix functions into module * Revert commits * Update x11.rs * Update x11.rs * Cargo fmt * Cargo fmt
This commit is contained in:
parent
703477f742
commit
0a72653310
21
Cargo.toml
21
Cargo.toml
|
@ -41,24 +41,45 @@ features = [
|
|||
|
||||
[target.i686-unknown-linux-gnu.dependencies]
|
||||
x11-dl = "2.18.3"
|
||||
wayland-client = "0.24"
|
||||
wayland-protocols = { version = "0.24", features = ["client"] }
|
||||
tempfile = "3.1.0"
|
||||
|
||||
[target.x86_64-unknown-linux-gnu.dependencies]
|
||||
x11-dl = "2.18.3"
|
||||
wayland-client = "0.24"
|
||||
wayland-protocols = { version = "0.24", features = ["client"] }
|
||||
tempfile = "3.1.0"
|
||||
|
||||
[target.arm-unknown-linux-gnueabihf.dependencies]
|
||||
x11-dl = "2.18.3"
|
||||
wayland-client = "0.24"
|
||||
wayland-protocols = { version = "0.24", features = ["client"] }
|
||||
tempfile = "3.1.0"
|
||||
|
||||
[target.armv7-unknown-linux-gnueabihf.dependencies]
|
||||
x11-dl = "2.18.3"
|
||||
wayland-client = "0.24"
|
||||
wayland-protocols = { version = "0.24", features = ["client"] }
|
||||
tempfile = "3.1.0"
|
||||
|
||||
[target.aarch64-unknown-linux-gnu.dependencies]
|
||||
x11-dl = "2.18.3"
|
||||
wayland-client = "0.24"
|
||||
wayland-protocols = { version = "0.24", features = ["client"] }
|
||||
tempfile = "3.1.0"
|
||||
|
||||
[target.x86_64-unknown-dragonfly.dependencies]
|
||||
x11-dl = "2.18.3"
|
||||
wayland-client = "0.24"
|
||||
wayland-protocols = { version = "0.24", features = ["client"] }
|
||||
tempfile = "3.1.0"
|
||||
|
||||
[target.x86_64-unknown-freebsd.dependencies]
|
||||
x11-dl = "2.18.3"
|
||||
wayland-client = "0.24"
|
||||
wayland-protocols = { version = "0.24", features = ["client"] }
|
||||
tempfile = "3.1.0"
|
||||
|
||||
[target.x86_64-unknown-redox.dependencies]
|
||||
orbclient = "0.3.20"
|
||||
|
|
13
src/lib.rs
13
src/lib.rs
|
@ -828,7 +828,7 @@ impl Menu {
|
|||
/// ```
|
||||
pub fn add_item(&mut self, name: &str, id: usize) -> MenuItem {
|
||||
MenuItem {
|
||||
id: id,
|
||||
id,
|
||||
label: name.to_owned(),
|
||||
menu: Some(self),
|
||||
..MenuItem::default()
|
||||
|
@ -886,7 +886,7 @@ impl<'a> MenuItem<'a> {
|
|||
/// Creates a new menu item
|
||||
pub fn new(name: &str, id: usize) -> MenuItem {
|
||||
MenuItem {
|
||||
id: id,
|
||||
id,
|
||||
label: name.to_owned(),
|
||||
..MenuItem::default()
|
||||
}
|
||||
|
@ -904,8 +904,8 @@ impl<'a> MenuItem<'a> {
|
|||
/// ```
|
||||
pub fn shortcut(self, key: Key, modifier: usize) -> Self {
|
||||
MenuItem {
|
||||
key: key,
|
||||
modifier: modifier,
|
||||
key,
|
||||
modifier,
|
||||
..self
|
||||
}
|
||||
}
|
||||
|
@ -939,10 +939,7 @@ impl<'a> MenuItem<'a> {
|
|||
/// # ;
|
||||
/// ```
|
||||
pub fn enabled(self, enabled: bool) -> Self {
|
||||
MenuItem {
|
||||
enabled: enabled,
|
||||
..self
|
||||
}
|
||||
MenuItem { enabled, ..self }
|
||||
}
|
||||
#[inline]
|
||||
/// Must be called to finalize building of a menu item when started with ```menu.add_item()```
|
||||
|
|
|
@ -290,7 +290,7 @@ impl Window {
|
|||
|
||||
Ok(Window {
|
||||
window_handle: handle,
|
||||
scale_factor: scale_factor,
|
||||
scale_factor,
|
||||
shared_data: SharedData {
|
||||
bg_color: 0,
|
||||
scale_mode: opts.scale_mode as u32,
|
||||
|
|
|
@ -79,8 +79,8 @@ impl Window {
|
|||
is_active: true,
|
||||
buffer_width: width,
|
||||
buffer_height: height,
|
||||
window: window,
|
||||
window_scale: window_scale,
|
||||
window,
|
||||
window_scale,
|
||||
key_handler: KeyHandler::new(),
|
||||
menu_counter: MenuHandle(0),
|
||||
menus: Vec::new(),
|
||||
|
@ -415,7 +415,7 @@ impl Menu {
|
|||
let handle = self.next_item_handle();
|
||||
self.internal.items.push(UnixMenuItem {
|
||||
label: name.to_owned(),
|
||||
handle: handle,
|
||||
handle,
|
||||
sub_menu: Some(Box::new(sub_menu.internal.clone())),
|
||||
id: 0,
|
||||
enabled: true,
|
||||
|
|
1248
src/os/unix/mod.rs
1248
src/os/unix/mod.rs
File diff suppressed because it is too large
Load diff
1156
src/os/unix/x11.rs
Normal file
1156
src/os/unix/x11.rs
Normal file
File diff suppressed because it is too large
Load diff
|
@ -580,7 +580,7 @@ impl Window {
|
|||
key_handler: KeyHandler::new(),
|
||||
update_rate: UpdateRate::new(),
|
||||
is_open: true,
|
||||
scale_factor: scale_factor,
|
||||
scale_factor,
|
||||
width: (width * scale_factor as usize) as i32,
|
||||
height: (height * scale_factor as usize) as i32,
|
||||
menus: Vec::new(),
|
||||
|
|
Loading…
Reference in a new issue