Commit f60b2c16 authored by Andrew Plaza's avatar Andrew Plaza
Browse files

Make login window unclosable/kill resize event (orbital.rs, lib.rs)

Orbital: Added an exit flag to orbital.rs, along with adding an "e" if a window
passes the flag to the file. in Window::new_flags (set to true for
default)

sdl2: added exit flag (set to true as default)
parent 377014fb
...@@ -85,17 +85,20 @@ impl Window { ...@@ -85,17 +85,20 @@ impl Window {
pub fn new_flags(x: i32, y: i32, w: u32, h: u32, title: &str, flags: &[WindowFlag]) -> Option<Self> { pub fn new_flags(x: i32, y: i32, w: u32, h: u32, title: &str, flags: &[WindowFlag]) -> Option<Self> {
let mut async = false; let mut async = false;
let mut resizable = false; let mut resizable = false;
let mut exit = true;
for &flag in flags.iter() { for &flag in flags.iter() {
match flag { match flag {
WindowFlag::Async => async = true, WindowFlag::Async => async = true,
WindowFlag::Resizable => resizable = true, WindowFlag::Resizable => resizable = true,
WindowFlag::Exit => exit = false
} }
} }
if let Ok(file) = File::open(&format!( if let Ok(file) = File::open(&format!(
"orbital:{}{}/{}/{}/{}/{}/{}", "orbital:{}{}{}/{}/{}/{}/{}/{}",
if async { "a" } else { "" }, if async { "a" } else { "" },
if resizable { "r" } else { "" }, if resizable { "r" } else { "" },
if exit == false { "e" } else { "" },
x, y, w, h, title x, y, w, h, title
)) { )) {
if let Ok(address) = unsafe { syscall::fmap(file.as_raw_fd(), 0, (w * h * 4) as usize) } { if let Ok(address) = unsafe { syscall::fmap(file.as_raw_fd(), 0, (w * h * 4) as usize) } {
......
...@@ -99,10 +99,12 @@ impl Window { ...@@ -99,10 +99,12 @@ impl Window {
let mut async = false; let mut async = false;
let mut resizable = false; let mut resizable = false;
let mut exit = true;
for &flag in flags.iter() { for &flag in flags.iter() {
match flag { match flag {
WindowFlag::Async => async = true, WindowFlag::Async => async = true,
WindowFlag::Resizable => resizable = true, WindowFlag::Resizable => resizable = true,
WindowFlag::Exit => exit = false,
} }
} }
......
...@@ -23,7 +23,8 @@ pub mod renderer; ...@@ -23,7 +23,8 @@ pub mod renderer;
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub enum WindowFlag { pub enum WindowFlag {
Async, Async,
Resizable Resizable,
Exit
} }
#[cfg(target_os = "redox")] #[cfg(target_os = "redox")]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment