diff --git a/Cargo.lock b/Cargo.lock index aeb3a27172..37398ea1ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -613,15 +613,6 @@ dependencies = [ "objc_id", ] -[[package]] -name = "clipboard_wayland" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61bcb8cde0387fde807b9b7af66ce8bd1665ef736e46e6e47fda82ea003e6ade" -dependencies = [ - "smithay-clipboard", -] - [[package]] name = "clipboard_wayland" version = "0.2.0" @@ -631,16 +622,6 @@ dependencies = [ "smithay-clipboard", ] -[[package]] -name = "clipboard_x11" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40403aa5220e5cd303d32dc4248cac8aa92bf47e3ae31e0e2481081755a63ff1" -dependencies = [ - "thiserror", - "x11rb", -] - [[package]] name = "clipboard_x11" version = "0.3.1" @@ -931,8 +912,8 @@ dependencies = [ "lazy_static", "libc", "mach 0.3.2", - "ndk 0.3.0", - "ndk-glue 0.3.0", + "ndk", + "ndk-glue", "nix 0.20.0", "oboe", "parking_lot 0.11.1", @@ -1054,6 +1035,20 @@ dependencies = [ "itertools 0.9.0", ] +[[package]] +name = "crossbeam" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae5588f6b3c3cb05239e90bd110f257254aecd01e4635400391aeae07497845" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-channel", + "crossbeam-deque 0.8.0", + "crossbeam-epoch 0.9.5", + "crossbeam-queue", + "crossbeam-utils 0.8.5", +] + [[package]] name = "crossbeam-channel" version = "0.5.1" @@ -2386,13 +2381,13 @@ dependencies = [ [[package]] name = "iced_core" -version = "0.3.0" -source = "git+https://github.com/hecrj/iced?rev=8d882d787e6b7fd7c2435f42f82933e2ed904edf#8d882d787e6b7fd7c2435f42f82933e2ed904edf" +version = "0.4.0" +source = "git+https://github.com/Imberflur/iced?tag=winit-0.25#18a48a5eeefd2aa6e50f5dd0751ac2e94c88a9eb" [[package]] name = "iced_futures" -version = "0.2.0" -source = "git+https://github.com/hecrj/iced?rev=8d882d787e6b7fd7c2435f42f82933e2ed904edf#8d882d787e6b7fd7c2435f42f82933e2ed904edf" +version = "0.3.0" +source = "git+https://github.com/Imberflur/iced?tag=winit-0.25#18a48a5eeefd2aa6e50f5dd0751ac2e94c88a9eb" dependencies = [ "futures", "log", @@ -2401,8 +2396,8 @@ dependencies = [ [[package]] name = "iced_graphics" -version = "0.1.0" -source = "git+https://github.com/hecrj/iced?rev=8d882d787e6b7fd7c2435f42f82933e2ed904edf#8d882d787e6b7fd7c2435f42f82933e2ed904edf" +version = "0.2.0" +source = "git+https://github.com/Imberflur/iced?tag=winit-0.25#18a48a5eeefd2aa6e50f5dd0751ac2e94c88a9eb" dependencies = [ "bytemuck", "glam", @@ -2414,8 +2409,8 @@ dependencies = [ [[package]] name = "iced_native" -version = "0.3.0" -source = "git+https://github.com/hecrj/iced?rev=8d882d787e6b7fd7c2435f42f82933e2ed904edf#8d882d787e6b7fd7c2435f42f82933e2ed904edf" +version = "0.4.0" +source = "git+https://github.com/Imberflur/iced?tag=winit-0.25#18a48a5eeefd2aa6e50f5dd0751ac2e94c88a9eb" dependencies = [ "iced_core", "iced_futures", @@ -2426,16 +2421,16 @@ dependencies = [ [[package]] name = "iced_style" -version = "0.2.0" -source = "git+https://github.com/hecrj/iced?rev=8d882d787e6b7fd7c2435f42f82933e2ed904edf#8d882d787e6b7fd7c2435f42f82933e2ed904edf" +version = "0.3.0" +source = "git+https://github.com/Imberflur/iced?tag=winit-0.25#18a48a5eeefd2aa6e50f5dd0751ac2e94c88a9eb" dependencies = [ "iced_core", ] [[package]] name = "iced_winit" -version = "0.2.0" -source = "git+https://github.com/hecrj/iced?rev=8d882d787e6b7fd7c2435f42f82933e2ed904edf#8d882d787e6b7fd7c2435f42f82933e2ed904edf" +version = "0.3.0" +source = "git+https://github.com/Imberflur/iced?tag=winit-0.25#18a48a5eeefd2aa6e50f5dd0751ac2e94c88a9eb" dependencies = [ "iced_futures", "iced_graphics", @@ -2443,7 +2438,7 @@ dependencies = [ "log", "thiserror", "winapi 0.3.9", - "window_clipboard 0.1.4", + "window_clipboard", "winit", ] @@ -2637,7 +2632,7 @@ dependencies = [ [[package]] name = "keyboard-keynames" version = "0.1.0" -source = "git+https://gitlab.com/Frinksy/keyboard-keynames.git?rev=a97ae509cdb9dc70cf1bf0af762d2d1d3a0d6e0c#a97ae509cdb9dc70cf1bf0af762d2d1d3a0d6e0c" +source = "git+https://gitlab.com/Frinksy/keyboard-keynames.git?rev=9ae8f89014d0b0c5b61d0e821c5aeb6140c5c0dc#9ae8f89014d0b0c5b61d0e821c5aeb6140c5c0dc" dependencies = [ "libc", "memmap", @@ -3028,6 +3023,18 @@ dependencies = [ "slab", ] +[[package]] +name = "mio-misc" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ddf05411bb159cdb5801bb10002afb66cb4572be656044315e363460ce69dc2" +dependencies = [ + "crossbeam", + "crossbeam-queue", + "log", + "mio 0.7.11", +] + [[package]] name = "miow" version = "0.2.2" @@ -3097,18 +3104,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "ndk" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eb167c1febed0a496639034d0c76b3b74263636045db5489eee52143c246e73" -dependencies = [ - "jni-sys", - "ndk-sys", - "num_enum 0.4.3", - "thiserror", -] - [[package]] name = "ndk" version = "0.3.0" @@ -3117,24 +3112,10 @@ checksum = "8794322172319b972f528bf90c6b467be0079f1fa82780ffb431088e741a73ab" dependencies = [ "jni-sys", "ndk-sys", - "num_enum 0.5.1", + "num_enum", "thiserror", ] -[[package]] -name = "ndk-glue" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf399b8b7a39c6fb153c4ec32c72fd5fe789df24a647f229c239aa7adb15241" -dependencies = [ - "lazy_static", - "libc", - "log", - "ndk 0.2.1", - "ndk-macro", - "ndk-sys", -] - [[package]] name = "ndk-glue" version = "0.3.0" @@ -3144,7 +3125,7 @@ dependencies = [ "lazy_static", "libc", "log", - "ndk 0.3.0", + "ndk", "ndk-macro", "ndk-sys", ] @@ -3465,16 +3446,6 @@ dependencies = [ "libc", ] -[[package]] -name = "num_enum" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca565a7df06f3d4b485494f25ba05da1435950f4dc263440eda7a6fa9b8e36e4" -dependencies = [ - "derivative", - "num_enum_derive 0.4.3", -] - [[package]] name = "num_enum" version = "0.5.1" @@ -3482,19 +3453,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "226b45a5c2ac4dd696ed30fa6b94b057ad909c7b7fc2e0d0808192bced894066" dependencies = [ "derivative", - "num_enum_derive 0.5.1", -] - -[[package]] -name = "num_enum_derive" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffa5a33ddddfee04c0283a7653987d634e880347e96b5b2ed64de07efb59db9d" -dependencies = [ - "proc-macro-crate", - "proc-macro2 1.0.27", - "quote 1.0.9", - "syn 1.0.72", + "num_enum_derive", ] [[package]] @@ -3574,8 +3533,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa187b38ae20374617b7ad418034ed3dc90ac980181d211518bd03537ae8f8d" dependencies = [ "jni", - "ndk 0.3.0", - "ndk-glue 0.3.0", + "ndk", + "ndk-glue", "num-derive", "num-traits", "oboe-sys", @@ -6147,7 +6106,7 @@ dependencies = [ "veloren-world", "wgpu", "wgpu-profiler", - "window_clipboard 0.2.1", + "window_clipboard", "winit", "winres", ] @@ -6850,19 +6809,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "window_clipboard" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37cf16659e398a96f4ab8deff2b9db2ca0c3c5d6c1b59b1d577b7f888f0f03c6" -dependencies = [ - "clipboard-win 4.2.1", - "clipboard_macos", - "clipboard_wayland 0.1.2", - "clipboard_x11 0.2.0", - "raw-window-handle", -] - [[package]] name = "window_clipboard" version = "0.2.1" @@ -6871,15 +6817,16 @@ checksum = "33a4518b538a45ad39d138a8c3bea8f6b4452174aeb38143d1dd643a3a838ccc" dependencies = [ "clipboard-win 4.2.1", "clipboard_macos", - "clipboard_wayland 0.2.0", - "clipboard_x11 0.3.1", + "clipboard_wayland", + "clipboard_x11", "raw-window-handle", ] [[package]] name = "winit" -version = "0.24.0" -source = "git+https://gitlab.com/veloren/winit.git?branch=macos-test-spiffed#488c511802dfd95ca54f6f76a38547c93c7b02c9" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79610794594d5e86be473ef7763f604f2159cbac8c94debd00df8fb41e86c2f8" dependencies = [ "bitflags", "cocoa", @@ -6891,15 +6838,16 @@ dependencies = [ "lazy_static", "libc", "log", - "mio 0.6.23", - "mio-extras", - "ndk 0.2.1", - "ndk-glue 0.2.1", + "mio 0.7.11", + "mio-misc", + "ndk", + "ndk-glue", "ndk-sys", "objc", "parking_lot 0.11.1", "percent-encoding", "raw-window-handle", + "scopeguard", "serde", "smithay-client-toolkit", "wayland-client 0.28.5", diff --git a/Cargo.toml b/Cargo.toml index db690b31c4..0342211826 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -111,8 +111,6 @@ buildInputs = ["openssl"] nativeBuildInputs = ["pkg-config"] [patch.crates-io] -# macos CI fix isn't released yet -winit = { git = "https://gitlab.com/veloren/winit.git", branch = "macos-test-spiffed" } vek = { git = "https://gitlab.com/veloren/vek.git", branch = "fix_intrinsics2" } # patch wgpu so we can use wgpu-profiler crate wgpu = { git = "https://github.com/gfx-rs/wgpu.git", rev = "a92b8549a8e2cb9dac781bafc5ed32828f3caf46" } diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index c322e6a1af..150f3d35fb 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -44,7 +44,7 @@ anim = {package = "veloren-voxygen-anim", path = "anim"} i18n = {package = "veloren-i18n", path = "i18n"} # Graphics -winit = {version = "0.24.0", features = ["serde"]} +winit = {version = "0.25.0", features = ["serde"]} wgpu = { version = "=0.8.0", features = ["trace", "cross"] } wgpu-profiler = { git = "https://github.com/Imberflur/wgpu-profiler", tag = "wgpu-0.8" } bytemuck = { version="1.4", features=["derive"] } @@ -54,11 +54,11 @@ shaderc = "0.6.2" conrod_core = {git = "https://gitlab.com/veloren/conrod.git", branch="copypasta_0.7"} conrod_winit = {git = "https://gitlab.com/veloren/conrod.git", branch="copypasta_0.7"} euc = "0.5.0" -iced = {package = "iced_native", git = "https://github.com/hecrj/iced", rev = "8d882d787e6b7fd7c2435f42f82933e2ed904edf"} -iced_winit = {git = "https://github.com/hecrj/iced", rev = "8d882d787e6b7fd7c2435f42f82933e2ed904edf"} +iced = {package = "iced_native", git = "https://github.com/Imberflur/iced", tag = "winit-0.25"} +iced_winit = {git = "https://github.com/Imberflur/iced", tag = "winit-0.25"} window_clipboard = "0.2" glyph_brush = "0.7.0" -keyboard-keynames = { git = "https://gitlab.com/Frinksy/keyboard-keynames.git", rev = "a97ae509cdb9dc70cf1bf0af762d2d1d3a0d6e0c" } +keyboard-keynames = { git = "https://gitlab.com/Frinksy/keyboard-keynames.git", rev = "9ae8f89014d0b0c5b61d0e821c5aeb6140c5c0dc" } # ECS specs = {git = "https://github.com/amethyst/specs.git", rev = "f985bec5d456f7b0dd8aae99848f9473c2cd9d46"} diff --git a/voxygen/src/lib.rs b/voxygen/src/lib.rs index 4d2a1a04dd..7532eb903d 100644 --- a/voxygen/src/lib.rs +++ b/voxygen/src/lib.rs @@ -62,7 +62,7 @@ pub struct GlobalState { pub singleplayer: Option, // TODO: redo this so that the watcher doesn't have to exist for reloading to occur pub i18n: LocalizationHandle, - pub clipboard: Option, + pub clipboard: iced_winit::Clipboard, // NOTE: This can be removed from GlobalState if client state behavior is refactored to not // enter the game before confirmation of successful character load /// An error returned by Client that needs to be displayed by the UI diff --git a/voxygen/src/main.rs b/voxygen/src/main.rs index 89ad6e7b9d..10e7742d10 100644 --- a/voxygen/src/main.rs +++ b/voxygen/src/main.rs @@ -181,7 +181,7 @@ fn main() { // Create window let (mut window, event_loop) = Window::new(&settings).expect("Failed to create window!"); - let clipboard = iced_winit::Clipboard::new(window.window()); + let clipboard = iced_winit::Clipboard::connect(window.window()); let lazy_init = SpriteRenderContext::new(window.renderer_mut()); diff --git a/voxygen/src/menu/char_selection/ui/mod.rs b/voxygen/src/menu/char_selection/ui/mod.rs index cc1c853910..a874e8c91e 100644 --- a/voxygen/src/menu/char_selection/ui/mod.rs +++ b/voxygen/src/menu/char_selection/ui/mod.rs @@ -1564,7 +1564,7 @@ impl CharSelectionUi { .view(&global_state.settings, &client, &self.error, &i18n), global_state.window.renderer_mut(), None, - global_state.clipboard.as_ref(), + &mut global_state.clipboard, ); if self.enter_pressed { diff --git a/voxygen/src/menu/main/ui/mod.rs b/voxygen/src/menu/main/ui/mod.rs index d17c06309f..cb333a9671 100644 --- a/voxygen/src/menu/main/ui/mod.rs +++ b/voxygen/src/menu/main/ui/mod.rs @@ -569,7 +569,7 @@ impl MainMenuUi { self.controls.view(&global_state.settings, dt.as_secs_f32()), global_state.window.renderer_mut(), None, - global_state.clipboard.as_ref(), + &mut global_state.clipboard, ); messages.into_iter().for_each(|message| { diff --git a/voxygen/src/ui/ice/mod.rs b/voxygen/src/ui/ice/mod.rs index 849ab7a76a..91393ad0cf 100644 --- a/voxygen/src/ui/ice/mod.rs +++ b/voxygen/src/ui/ice/mod.rs @@ -148,7 +148,7 @@ impl IcedUi { root: E, renderer: &mut Renderer, pool: Option<&SlowJobPool>, - clipboard: Option<&Clipboard>, + clipboard: &mut Clipboard, ) -> (Vec, mouse::Interaction) { span!(_guard, "maintain", "IcedUi::maintain"); // Handle window resizing, dpi factor change, and scale mode changing @@ -194,11 +194,8 @@ impl IcedUi { let _event_status_list = user_interface.update( &self.events, cursor_position, - match clipboard { - Some(c) => Some(c), - None => None, - }, &self.renderer, + clipboard, &mut messages, ); messages diff --git a/voxygen/src/ui/ice/renderer/widget/button.rs b/voxygen/src/ui/ice/renderer/widget/button.rs index cf05a448bf..40a6bff71c 100644 --- a/voxygen/src/ui/ice/renderer/widget/button.rs +++ b/voxygen/src/ui/ice/renderer/widget/button.rs @@ -5,7 +5,7 @@ impl button::Renderer for IcedRenderer { // TODO: what if this gets large enough to not be copied around? type Style = style::button::Style; - const DEFAULT_PADDING: u16 = 0; + const DEFAULT_PADDING: iced::Padding = iced::Padding::ZERO; fn draw( &mut self, diff --git a/voxygen/src/ui/ice/widget/aspect_ratio_container.rs b/voxygen/src/ui/ice/widget/aspect_ratio_container.rs index 8db9bd33ca..e420f22441 100644 --- a/voxygen/src/ui/ice/widget/aspect_ratio_container.rs +++ b/voxygen/src/ui/ice/widget/aspect_ratio_container.rs @@ -119,17 +119,17 @@ where event: Event, layout: Layout<'_>, cursor_position: Point, - messages: &mut Vec, renderer: &R, - clipboard: Option<&dyn Clipboard>, + clipboard: &mut dyn Clipboard, + messages: &mut Vec, ) -> iced::event::Status { self.content.on_event( event, layout.children().next().unwrap(), cursor_position, - messages, renderer, clipboard, + messages, ) } diff --git a/voxygen/src/ui/ice/widget/background_container.rs b/voxygen/src/ui/ice/widget/background_container.rs index ce267b7a13..53de3a647d 100644 --- a/voxygen/src/ui/ice/widget/background_container.rs +++ b/voxygen/src/ui/ice/widget/background_container.rs @@ -255,17 +255,17 @@ where event: Event, layout: Layout<'_>, cursor_position: Point, - messages: &mut Vec, renderer: &R, - clipboard: Option<&dyn Clipboard>, + clipboard: &mut dyn Clipboard, + messages: &mut Vec, ) -> iced::event::Status { self.content.on_event( event, layout.children().next().unwrap(), cursor_position, - messages, renderer, clipboard, + messages, ) } diff --git a/voxygen/src/ui/ice/widget/mouse_detector.rs b/voxygen/src/ui/ice/widget/mouse_detector.rs index a93df67ae5..036a2f19a9 100644 --- a/voxygen/src/ui/ice/widget/mouse_detector.rs +++ b/voxygen/src/ui/ice/widget/mouse_detector.rs @@ -48,9 +48,9 @@ where event: Event, layout: Layout<'_>, _cursor_position: Point, - _messages: &mut Vec, _renderer: &R, - _clipboard: Option<&dyn Clipboard>, + _clipboard: &mut dyn Clipboard, + _messages: &mut Vec, ) -> iced::event::Status { if let Event::Mouse(mouse::Event::CursorMoved { position: Point { x, y }, diff --git a/voxygen/src/ui/ice/widget/overlay.rs b/voxygen/src/ui/ice/widget/overlay.rs index c9b1ff66b9..0bcd0d3833 100644 --- a/voxygen/src/ui/ice/widget/overlay.rs +++ b/voxygen/src/ui/ice/widget/overlay.rs @@ -1,6 +1,6 @@ use iced::{ - layout, mouse, Align, Clipboard, Element, Event, Hasher, Layout, Length, Point, Rectangle, - Size, Widget, + layout, mouse, Align, Clipboard, Element, Event, Hasher, Layout, Length, Padding, Point, + Rectangle, Size, Widget, }; use std::hash::Hash; @@ -10,7 +10,7 @@ use std::hash::Hash; /// the front widget /// Alignment and padding is used for the front widget pub struct Overlay<'a, M, R: self::Renderer> { - padding: u16, + padding: Padding, width: Length, height: Length, max_width: u32, @@ -32,7 +32,7 @@ where U: Into>, { Self { - padding: 0, + padding: Padding::ZERO, width: Length::Shrink, height: Length::Shrink, max_width: u32::MAX, @@ -44,8 +44,8 @@ where } } - pub fn padding(mut self, pad: u16) -> Self { - self.padding = pad; + pub fn padding>(mut self, pad: P) -> Self { + self.padding = pad.into(); self } @@ -99,8 +99,6 @@ where fn height(&self) -> Length { self.height } fn layout(&self, renderer: &R, limits: &layout::Limits) -> layout::Node { - let padding = self.padding as f32; - let limits = limits .loose() .max_width(self.max_width) @@ -111,16 +109,22 @@ where let under = self.under.layout(renderer, &limits.loose()); let under_size = under.size(); - let limits = limits.pad(padding); + let limits = limits.pad(self.padding); let mut over = self.over.layout(renderer, &limits.loose()); let over_size = over.size(); - let size = limits.resolve(Size { - width: under_size.width.max(over_size.width + padding * 2.0), - height: under_size.height.max(over_size.height + padding * 2.0), - }); + let size = limits.resolve( + Size { + width: under_size.width.max(over_size.width), + height: under_size.height.max(over_size.height), + } + .pad(self.padding), + ); - over.move_to(Point::new(padding, padding)); + over.move_to(Point::new( + self.padding.left.into(), + self.padding.top.into(), + )); over.align(self.horizontal_alignment, self.vertical_alignment, size); layout::Node::with_children(size, vec![over, under]) @@ -131,9 +135,9 @@ where event: Event, layout: Layout<'_>, cursor_position: Point, - messages: &mut Vec, renderer: &R, - clipboard: Option<&dyn Clipboard>, + clipboard: &mut dyn Clipboard, + messages: &mut Vec, ) -> iced::event::Status { let mut children = layout.children(); let over_layout = children.next().unwrap(); @@ -143,9 +147,9 @@ where event.clone(), over_layout, cursor_position, - messages, renderer, clipboard, + messages, ); // If mouse press check if over the overlay widget before sending to under @@ -158,9 +162,9 @@ where event, children.next().unwrap(), cursor_position, - messages, renderer, clipboard, + messages, ) .merge(status) } else { diff --git a/voxygen/src/ui/ice/widget/tooltip.rs b/voxygen/src/ui/ice/widget/tooltip.rs index 2e616a1f85..7ef1e58a42 100644 --- a/voxygen/src/ui/ice/widget/tooltip.rs +++ b/voxygen/src/ui/ice/widget/tooltip.rs @@ -189,17 +189,17 @@ where event: Event, layout: Layout<'_>, cursor_position: Point, - messages: &mut Vec, renderer: &R, - clipboard: Option<&dyn Clipboard>, + clipboard: &mut dyn Clipboard, + messages: &mut Vec, ) -> iced::event::Status { self.content.on_event( event, layout, cursor_position, - messages, renderer, clipboard, + messages, ) }