Rework 'Fullscreen::Borderless' enum variant
This changes 'Fullscreen::Borderless' enum variant from 'Fullscreen::Borderless(MonitorHandle)' to 'Fullscreen::Borderless(Option<MonitorHandle>)'. Providing 'None' to it will result in picking the current monitor.
This commit is contained in:
parent
644dc13e00
commit
71e3d25422
14 changed files with 89 additions and 46 deletions
|
|
@ -853,8 +853,11 @@ unsafe extern "system" fn public_window_callback<T: 'static>(
|
|||
winuser::MonitorFromRect(&new_rect, winuser::MONITOR_DEFAULTTONULL);
|
||||
match fullscreen {
|
||||
Fullscreen::Borderless(ref mut fullscreen_monitor) => {
|
||||
if new_monitor != fullscreen_monitor.inner.hmonitor()
|
||||
&& new_monitor != ptr::null_mut()
|
||||
if new_monitor != ptr::null_mut()
|
||||
&& fullscreen_monitor
|
||||
.as_ref()
|
||||
.map(|monitor| new_monitor != monitor.inner.hmonitor())
|
||||
.unwrap_or(true)
|
||||
{
|
||||
if let Ok(new_monitor_info) = monitor::get_monitor_info(new_monitor) {
|
||||
let new_monitor_rect = new_monitor_info.rcMonitor;
|
||||
|
|
@ -863,9 +866,9 @@ unsafe extern "system" fn public_window_callback<T: 'static>(
|
|||
window_pos.cx = new_monitor_rect.right - new_monitor_rect.left;
|
||||
window_pos.cy = new_monitor_rect.bottom - new_monitor_rect.top;
|
||||
}
|
||||
*fullscreen_monitor = crate::monitor::MonitorHandle {
|
||||
*fullscreen_monitor = Some(crate::monitor::MonitorHandle {
|
||||
inner: MonitorHandle::new(new_monitor),
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
Fullscreen::Exclusive(ref video_mode) => {
|
||||
|
|
|
|||
|
|
@ -496,9 +496,12 @@ impl Window {
|
|||
// Update window bounds
|
||||
match &fullscreen {
|
||||
Some(fullscreen) => {
|
||||
let monitor = match fullscreen {
|
||||
Fullscreen::Exclusive(ref video_mode) => video_mode.monitor(),
|
||||
Fullscreen::Borderless(ref monitor) => monitor.clone(),
|
||||
let monitor = match &fullscreen {
|
||||
Fullscreen::Exclusive(video_mode) => video_mode.monitor(),
|
||||
Fullscreen::Borderless(Some(monitor)) => monitor.clone(),
|
||||
Fullscreen::Borderless(None) => RootMonitorHandle {
|
||||
inner: monitor::current_monitor(window.0),
|
||||
},
|
||||
};
|
||||
|
||||
let position: (i32, i32) = monitor.position().into();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue