From 29dc2c766b8432c7e6af45b527464d51ae9fde56 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Wed, 29 Jan 2020 13:22:04 -0800 Subject: [PATCH] update to winit_20. May cause dpi issues. Can't tell yet --- Cargo.lock | 16 ++++++++-------- Cargo.toml | 2 +- src/window.rs | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 98c7bba..3ccb986 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -588,9 +588,9 @@ dependencies = [ [[package]] name = "dispatch" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e93ca78226c51902d7aa8c12c988338aadd9e85ed9c6be8aaac39192ff3605" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" [[package]] name = "dlib" @@ -2254,8 +2254,8 @@ dependencies = [ [[package]] name = "skulpin" -version = "0.5.1" -source = "git+https://github.com/aclysma/skulpin#c0b194833f97b839bd44a30fc2f17851b14e1016" +version = "0.6.0" +source = "git+https://github.com/aclysma/skulpin?branch=winit_20#ca72c710628c7ff6a86de5c9997dd7443049dc47" dependencies = [ "ash", "cocoa", @@ -2649,13 +2649,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "winit" -version = "0.20.0-alpha6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa4308ca09f50e2f4688c631c36879521bffc39b949238b288ffd932864acbc" +version = "0.20.0" +source = "git+https://github.com/rust-windowing/winit?rev=e295104#e2951041990983eb100dde664607de5330e50b13" dependencies = [ "android_glue", "bitflags", - "calloop", "cocoa", "core-foundation", "core-graphics", @@ -2665,6 +2663,8 @@ dependencies = [ "lazy_static", "libc", "log", + "mio", + "mio-extras", "objc", "parking_lot", "percent-encoding", diff --git a/Cargo.toml b/Cargo.toml index 5e08caa..f5a16a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ euclid = "0.20.7" font-kit = "0.4.0" skribo = { git = "https://github.com/linebender/skribo" } lru = "0.4.3" -skulpin = { git = "https://github.com/aclysma/skulpin" } +skulpin = { git = "https://github.com/aclysma/skulpin", branch="winit_20" } derive-new = "0.5" env_logger = "0.7.1" rmpv = "0.4.2" diff --git a/src/window.rs b/src/window.rs index 97ebb71..3f6dd04 100644 --- a/src/window.rs +++ b/src/window.rs @@ -4,7 +4,7 @@ use std::time::{Duration, Instant}; use image::{load_from_memory, GenericImageView, Pixel}; use skulpin::{CoordinateSystem, RendererBuilder, PresentMode}; use skulpin::skia_safe::icu; -use skulpin::winit::dpi::LogicalSize; +use skulpin::winit::dpi::{LogicalSize, PhysicalSize}; use skulpin::winit::event::{ElementState, Event, MouseScrollDelta, StartCause, WindowEvent}; use skulpin::winit::event_loop::{ControlFlow, EventLoop}; use skulpin::winit::window::{Icon, WindowBuilder}; @@ -19,10 +19,10 @@ use crate::INITIAL_DIMENSIONS; #[folder = "assets/"] struct Asset; -fn handle_new_grid_size(new_size: LogicalSize, renderer: &Renderer) { - if new_size.width > 0.0 && new_size.height > 0.0 { - let new_width = ((new_size.width + 1.0) as f32 / renderer.font_width) as u64; - let new_height = ((new_size.height + 1.0) as f32 / renderer.font_height) as u64; +fn handle_new_grid_size(new_size: PhysicalSize, renderer: &Renderer) { + if new_size.width > 0 && new_size.height > 0 { + let new_width = ((new_size.width + 1) as f32 / renderer.font_width) as u64; + let new_height = ((new_size.height + 1) as f32 / renderer.font_height) as u64; // Add 1 here to make sure resizing doesn't change the grid size on startup BRIDGE.queue_command(UiCommand::Resize { width: new_width as i64, height: new_height as i64 }); }