mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 14:51:30 +11:00
Removed comments, fixed Some/None matches, removed unnecessary lock checks
This commit is contained in:
parent
d6a53cf5d3
commit
c6ffedccbd
|
@ -25,7 +25,6 @@ pub struct ThreadLocalData {
|
||||||
pub win: winapi::HWND,
|
pub win: winapi::HWND,
|
||||||
pub sender: Sender<Event>,
|
pub sender: Sender<Event>,
|
||||||
pub window_state: Arc<Mutex<WindowState>>
|
pub window_state: Arc<Mutex<WindowState>>
|
||||||
//pub cursor_state: Arc<Mutex<CursorState>>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MinMaxInfo {
|
struct MinMaxInfo {
|
||||||
|
@ -295,21 +294,18 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT,
|
||||||
winapi::WM_GETMINMAXINFO => {
|
winapi::WM_GETMINMAXINFO => {
|
||||||
let mut mmi = lparam as *mut MinMaxInfo;
|
let mut mmi = lparam as *mut MinMaxInfo;
|
||||||
//(*mmi).max_position = winapi::POINT { x: -8, y: -8 }; // The upper left corner of the window if it were maximized on the primary monitor.
|
//(*mmi).max_position = winapi::POINT { x: -8, y: -8 }; // The upper left corner of the window if it were maximized on the primary monitor.
|
||||||
//(*mmi).max_size = winapi::POINT { x: 200, y: 200 }; // The dimensions of the primary monitor.
|
//(*mmi).max_size = winapi::POINT { x: .., y: .. }; // The dimensions of the primary monitor.
|
||||||
|
|
||||||
CONTEXT_STASH.with(|context_stash| {
|
CONTEXT_STASH.with(|context_stash| {
|
||||||
let cstash = context_stash.borrow();
|
match context_stash.borrow().as_ref() {
|
||||||
let cstash = cstash.as_ref();
|
Some(cstash) => {
|
||||||
|
let window_state = cstash.window_state.lock().unwrap();
|
||||||
|
|
||||||
let _window_state = if let Some(cstash) = cstash {
|
|
||||||
if let Ok(window_state) = cstash.window_state.lock() {
|
|
||||||
match window_state.attributes.min_dimensions {
|
match window_state.attributes.min_dimensions {
|
||||||
Some((width, height)) => {
|
Some((width, height)) => {
|
||||||
(*mmi).min_track = winapi::POINT { x: width as i32, y: height as i32 };
|
(*mmi).min_track = winapi::POINT { x: width as i32, y: height as i32 };
|
||||||
},
|
},
|
||||||
None => {
|
None => { }
|
||||||
(*mmi).min_track = winapi::POINT { x: 800, y: 600 };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
match window_state.attributes.max_dimensions {
|
match window_state.attributes.max_dimensions {
|
||||||
|
@ -318,10 +314,9 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT,
|
||||||
},
|
},
|
||||||
None => { }
|
None => { }
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
} else {
|
None => { }
|
||||||
return
|
}
|
||||||
};
|
|
||||||
});
|
});
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
|
|
|
@ -527,12 +527,12 @@ pub struct WindowAttributes {
|
||||||
/// The default is `None`.
|
/// The default is `None`.
|
||||||
pub dimensions: Option<(u32, u32)>,
|
pub dimensions: Option<(u32, u32)>,
|
||||||
|
|
||||||
/// The minimum dimensions a window can be, If this is `None`, the minimum will be set to 800x600.
|
/// The minimum dimensions a window can be, If this is `None`, the window will have no minimum dimensions (aside from reserved).
|
||||||
///
|
///
|
||||||
/// The default is `None`.
|
/// The default is `None`.
|
||||||
pub min_dimensions: Option<(u32, u32)>,
|
pub min_dimensions: Option<(u32, u32)>,
|
||||||
|
|
||||||
/// The maximum dimensions a window can be, If this is `None`, the maximum will be the dimensions of the primary monitor.
|
/// The maximum dimensions a window can be, If this is `None`, the maximum will have no maximum or will be set to the primary monitor's dimensions by the platform.
|
||||||
///
|
///
|
||||||
/// The default is `None`.
|
/// The default is `None`.
|
||||||
pub max_dimensions: Option<(u32, u32)>,
|
pub max_dimensions: Option<(u32, u32)>,
|
||||||
|
|
Loading…
Reference in a new issue