mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-22 06:45:23 +00:00
Update winit to 0.27 (#1933)
* Update winit to 0.27 * Fix windows * Better fix?
This commit is contained in:
parent
dab8c7ef0e
commit
14f14f76ee
@ -12,7 +12,7 @@ vulkano = { path = "../vulkano" }
|
||||
vulkano-shaders = { path = "../vulkano-shaders" }
|
||||
# The Vulkan library doesn't provide any functionality to create and handle windows, as
|
||||
# this would be out of scope. In order to open a window, we are going to use the `winit` crate.
|
||||
winit = "0.26"
|
||||
winit = "0.27"
|
||||
# The `vulkano_win` crate is the link between `vulkano` and `winit`. Vulkano doesn't know about winit,
|
||||
# and winit doesn't know about vulkano, so import a crate that will provide a link between the two.
|
||||
vulkano-win = { path = "../vulkano-win" }
|
||||
|
@ -14,4 +14,4 @@ categories = ["rendering::graphics-api"]
|
||||
[dependencies]
|
||||
vulkano = { version = "0.30.0", path = "../vulkano" }
|
||||
vulkano-win = { version = "0.30.0", path = "../vulkano-win" }
|
||||
winit = { version = "0.26" }
|
||||
winit = { version = "0.27" }
|
||||
|
@ -17,7 +17,7 @@ use std::collections::hash_map::{Iter, IterMut};
|
||||
use std::collections::HashMap;
|
||||
use vulkano::swapchain::{PresentMode, SwapchainCreateInfo};
|
||||
use winit::dpi::LogicalSize;
|
||||
use winit::window::WindowId;
|
||||
use winit::window::{CursorGrabMode, WindowId};
|
||||
|
||||
/// A struct organizing windows and their corresponding renderers. This makes it easy to handle multiple windows.
|
||||
///
|
||||
@ -143,7 +143,7 @@ impl VulkanoWindows {
|
||||
let winit_window = winit_window_builder.build(event_loop).unwrap();
|
||||
|
||||
if window_descriptor.cursor_locked {
|
||||
match winit_window.set_cursor_grab(true) {
|
||||
match winit_window.set_cursor_grab(CursorGrabMode::Confined) {
|
||||
Ok(_) => {}
|
||||
Err(winit::error::ExternalError::NotSupported(_)) => {}
|
||||
Err(err) => Err(err).unwrap(),
|
||||
@ -262,7 +262,9 @@ fn get_fitting_videomode(
|
||||
match abs_diff(a.size().width, width).cmp(&abs_diff(b.size().width, width)) {
|
||||
Equal => {
|
||||
match abs_diff(a.size().height, height).cmp(&abs_diff(b.size().height, height)) {
|
||||
Equal => b.refresh_rate().cmp(&a.refresh_rate()),
|
||||
Equal => b
|
||||
.refresh_rate_millihertz()
|
||||
.cmp(&a.refresh_rate_millihertz()),
|
||||
default => default,
|
||||
}
|
||||
}
|
||||
@ -279,7 +281,9 @@ fn get_best_videomode(monitor: &winit::monitor::MonitorHandle) -> winit::monitor
|
||||
use std::cmp::Ordering::*;
|
||||
match b.size().width.cmp(&a.size().width) {
|
||||
Equal => match b.size().height.cmp(&a.size().height) {
|
||||
Equal => b.refresh_rate().cmp(&a.refresh_rate()),
|
||||
Equal => b
|
||||
.refresh_rate_millihertz()
|
||||
.cmp(&a.refresh_rate_millihertz()),
|
||||
default => default,
|
||||
},
|
||||
default => default,
|
||||
|
@ -19,7 +19,7 @@ raw-window-handle_ = ["raw-window-handle"]
|
||||
[dependencies]
|
||||
raw-window-handle = { version = "0.4", optional = true }
|
||||
vulkano = { version = "0.30.0", path = "../vulkano" }
|
||||
winit = { version = "0.26", optional = true }
|
||||
winit = { version = "0.27", optional = true }
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
cocoa = { version = "0.24", optional = true }
|
||||
|
@ -208,7 +208,12 @@ unsafe fn winit_to_surface<W: SafeBorrow<Window>>(
|
||||
) -> Result<Arc<Surface<W>>, SurfaceCreationError> {
|
||||
use winit::platform::windows::WindowExtWindows;
|
||||
|
||||
Surface::from_win32(instance, win.borrow().hinstance(), win.borrow().hwnd(), win)
|
||||
Surface::from_win32(
|
||||
instance,
|
||||
win.borrow().hinstance() as *const (),
|
||||
win.borrow().hwnd() as *const (),
|
||||
win,
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
@ -220,7 +225,7 @@ use winit::{monitor::MonitorHandle, platform::windows::MonitorHandleExtWindows};
|
||||
/// Creates a `Win32Monitor` from a Winit monitor handle.
|
||||
#[inline]
|
||||
pub fn create_win32_monitor_from_winit(monitor_handle: &MonitorHandle) -> Win32Monitor {
|
||||
unsafe { Win32Monitor::new(monitor_handle.hmonitor()) }
|
||||
unsafe { Win32Monitor::new(monitor_handle.hmonitor() as *const ()) }
|
||||
}
|
||||
|
||||
/// An alternative to `Borrow<T>` with the requirement that all calls to
|
||||
|
Loading…
Reference in New Issue
Block a user