Update winit and iced

This commit is contained in:
Imbris 2021-01-23 01:06:15 -05:00
parent 97f0413307
commit adaea096d2
9 changed files with 108 additions and 63 deletions

View File

@ -64,7 +64,7 @@ coverage:
.tmacos: .tmacos:
script: script:
- ln -s /dockercache/cache-release-macos target - ln -s /dockercache/cache-release-macos target
- VELOREN_USERDATA_STRATEGY=executable PATH="/dockercache/osxcross/target/bin:$PATH" COREAUDIO_SDK_PATH=/dockercache/osxcross/target/SDK/MacOSX10.13.sdk CC=o64-clang CXX=o64-clang++ cargo build --target x86_64-apple-darwin --release - VELOREN_USERDATA_STRATEGY=executable WINIT_LINK_COLORSYNC=true PATH="/dockercache/osxcross/target/bin:$PATH" COREAUDIO_SDK_PATH=/dockercache/osxcross/target/SDK/MacOSX10.13.sdk CC=o64-clang CXX=o64-clang++ cargo build --target x86_64-apple-darwin --release
- cp -r target/x86_64-apple-darwin/release/veloren-server-cli $CI_PROJECT_DIR - cp -r target/x86_64-apple-darwin/release/veloren-server-cli $CI_PROJECT_DIR
- cp -r target/x86_64-apple-darwin/release/veloren-voxygen $CI_PROJECT_DIR - cp -r target/x86_64-apple-darwin/release/veloren-voxygen $CI_PROJECT_DIR
artifacts: artifacts:

75
Cargo.lock generated
View File

@ -491,6 +491,20 @@ name = "bytemuck"
version = "1.4.1" version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41aa2ec95ca3b5c54cf73c91acf06d24f4495d5f1b1c12506ae3483d646177ac" checksum = "41aa2ec95ca3b5c54cf73c91acf06d24f4495d5f1b1c12506ae3483d646177ac"
dependencies = [
"bytemuck_derive",
]
[[package]]
name = "bytemuck_derive"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e215f8c2f9f79cb53c8335e687ffd07d5bfcb6fe5fc80723762d0be46e7cc54"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.7",
"syn 1.0.54",
]
[[package]] [[package]]
name = "byteorder" name = "byteorder"
@ -714,6 +728,22 @@ dependencies = [
"objc", "objc",
] ]
[[package]]
name = "cocoa"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f63902e9223530efb4e26ccd0cf55ec30d592d3b42e21a28defc42a9586e832"
dependencies = [
"bitflags",
"block",
"cocoa-foundation",
"core-foundation 0.9.1",
"core-graphics 0.22.1",
"foreign-types",
"libc",
"objc",
]
[[package]] [[package]]
name = "cocoa-foundation" name = "cocoa-foundation"
version = "0.1.0" version = "0.1.0"
@ -2124,9 +2154,12 @@ dependencies = [
[[package]] [[package]]
name = "glam" name = "glam"
version = "0.9.5" version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8637c7ec4fd0776c51eeab3e0d5d1aa7e440ece3fc2ee7d674e13c957287bfc1" checksum = "579160312273c954cc51bd440f059dde741029ac8daf8c84fece76cb77f62c15"
dependencies = [
"version_check 0.9.2",
]
[[package]] [[package]]
name = "glob" name = "glob"
@ -2146,13 +2179,13 @@ dependencies = [
[[package]] [[package]]
name = "glutin" name = "glutin"
version = "0.25.1" version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8bae26a39a728b003e9fad473ea89527de0de050143b4df866f18bb154bc86e" checksum = "1ae1cbb9176b9151c4ce03f012e3cd1c6c18c4be79edeaeb3d99f5d8085c5fa3"
dependencies = [ dependencies = [
"android_glue", "android_glue",
"cgl", "cgl",
"cocoa", "cocoa 0.23.0",
"core-foundation 0.9.1", "core-foundation 0.9.1",
"glutin_egl_sys", "glutin_egl_sys",
"glutin_emscripten_sys", "glutin_emscripten_sys",
@ -2550,13 +2583,13 @@ dependencies = [
[[package]] [[package]]
name = "iced_core" name = "iced_core"
version = "0.2.1" version = "0.3.0"
source = "git+https://github.com/hecrj/iced?rev=f464316#f46431600cb61d4e83e0ded1ca79525478436be3" source = "git+https://github.com/hecrj/iced?rev=8d882d787e6b7fd7c2435f42f82933e2ed904edf#8d882d787e6b7fd7c2435f42f82933e2ed904edf"
[[package]] [[package]]
name = "iced_futures" name = "iced_futures"
version = "0.1.2" version = "0.2.0"
source = "git+https://github.com/hecrj/iced?rev=f464316#f46431600cb61d4e83e0ded1ca79525478436be3" source = "git+https://github.com/hecrj/iced?rev=8d882d787e6b7fd7c2435f42f82933e2ed904edf#8d882d787e6b7fd7c2435f42f82933e2ed904edf"
dependencies = [ dependencies = [
"futures 0.3.5", "futures 0.3.5",
"log", "log",
@ -2566,7 +2599,7 @@ dependencies = [
[[package]] [[package]]
name = "iced_graphics" name = "iced_graphics"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/hecrj/iced?rev=f464316#f46431600cb61d4e83e0ded1ca79525478436be3" source = "git+https://github.com/hecrj/iced?rev=8d882d787e6b7fd7c2435f42f82933e2ed904edf#8d882d787e6b7fd7c2435f42f82933e2ed904edf"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"glam", "glam",
@ -2578,8 +2611,8 @@ dependencies = [
[[package]] [[package]]
name = "iced_native" name = "iced_native"
version = "0.2.2" version = "0.3.0"
source = "git+https://github.com/hecrj/iced?rev=f464316#f46431600cb61d4e83e0ded1ca79525478436be3" source = "git+https://github.com/hecrj/iced?rev=8d882d787e6b7fd7c2435f42f82933e2ed904edf#8d882d787e6b7fd7c2435f42f82933e2ed904edf"
dependencies = [ dependencies = [
"iced_core", "iced_core",
"iced_futures", "iced_futures",
@ -2590,16 +2623,16 @@ dependencies = [
[[package]] [[package]]
name = "iced_style" name = "iced_style"
version = "0.1.0" version = "0.2.0"
source = "git+https://github.com/hecrj/iced?rev=f464316#f46431600cb61d4e83e0ded1ca79525478436be3" source = "git+https://github.com/hecrj/iced?rev=8d882d787e6b7fd7c2435f42f82933e2ed904edf#8d882d787e6b7fd7c2435f42f82933e2ed904edf"
dependencies = [ dependencies = [
"iced_core", "iced_core",
] ]
[[package]] [[package]]
name = "iced_winit" name = "iced_winit"
version = "0.1.1" version = "0.2.0"
source = "git+https://github.com/hecrj/iced?rev=f464316#f46431600cb61d4e83e0ded1ca79525478436be3" source = "git+https://github.com/hecrj/iced?rev=8d882d787e6b7fd7c2435f42f82933e2ed904edf#8d882d787e6b7fd7c2435f42f82933e2ed904edf"
dependencies = [ dependencies = [
"iced_futures", "iced_futures",
"iced_graphics", "iced_graphics",
@ -3741,9 +3774,9 @@ dependencies = [
[[package]] [[package]]
name = "old_school_gfx_glutin_ext" name = "old_school_gfx_glutin_ext"
version = "0.25.0" version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97d3bf7a77b32b947b6eaa3bc3671d50a74cd9aafdbbd4f9a4feb03ed3a0ee94" checksum = "450a2a0e6805771787b965af9a552581c9dfc588dc33761c1be690117cd792e1"
dependencies = [ dependencies = [
"gfx_core", "gfx_core",
"gfx_device_gl", "gfx_device_gl",
@ -6899,11 +6932,11 @@ dependencies = [
[[package]] [[package]]
name = "winit" name = "winit"
version = "0.23.0" version = "0.24.0"
source = "git+https://gitlab.com/veloren/winit.git?branch=macos-test-spiffed#7c8c5f21384c898f50d37298d229093549b08803" source = "git+https://gitlab.com/veloren/winit.git?branch=macos-test-spiffed#488c511802dfd95ca54f6f76a38547c93c7b02c9"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cocoa", "cocoa 0.24.0",
"core-foundation 0.9.1", "core-foundation 0.9.1",
"core-graphics 0.22.1", "core-graphics 0.22.1",
"core-video-sys", "core-video-sys",

View File

@ -31,16 +31,16 @@ anim = {package = "veloren-voxygen-anim", path = "anim", default-features = fals
gfx = "0.18.2" gfx = "0.18.2"
gfx_device_gl = {version = "0.16.2", optional = true} gfx_device_gl = {version = "0.16.2", optional = true}
gfx_gl = {version = "0.6.1", optional = true} gfx_gl = {version = "0.6.1", optional = true}
glutin = "0.25.1" glutin = "0.26.0"
old_school_gfx_glutin_ext = "0.25" old_school_gfx_glutin_ext = "0.26"
winit = {version = "0.23.0", features = ["serde"]} winit = {version = "0.24.0", features = ["serde"]}
# Ui # Ui
conrod_core = {git = "https://gitlab.com/veloren/conrod.git", branch="copypasta_0.7"} 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"} conrod_winit = {git = "https://gitlab.com/veloren/conrod.git", branch="copypasta_0.7"}
euc = {git = "https://github.com/zesterer/euc.git"} euc = {git = "https://github.com/zesterer/euc.git"}
iced = {package = "iced_native", git = "https://github.com/hecrj/iced", rev = "f464316"} iced = {package = "iced_native", git = "https://github.com/hecrj/iced", rev = "8d882d787e6b7fd7c2435f42f82933e2ed904edf"}
iced_winit = {git = "https://github.com/hecrj/iced", rev = "f464316"} iced_winit = {git = "https://github.com/hecrj/iced", rev = "8d882d787e6b7fd7c2435f42f82933e2ed904edf"}
window_clipboard = "0.1.1" window_clipboard = "0.1.1"
glyph_brush = "0.7.0" glyph_brush = "0.7.0"

View File

@ -105,19 +105,17 @@ impl IcedUi {
// Scale cursor movement events // Scale cursor movement events
// Note: in some cases the scaling could be off if a resized event occured in the same // Note: in some cases the scaling could be off if a resized event occured in the same
// frame, in practice this shouldn't be an issue // frame, in practice this shouldn't be an issue
Event::Mouse(mouse::Event::CursorMoved { x, y }) => { Event::Mouse(mouse::Event::CursorMoved { position }) => {
// TODO: return f32 here // TODO: return f32 here
let scale = self.scale.scale_factor_logical() as f32; let scale = self.scale.scale_factor_logical() as f32;
let x = position.x / scale;
let y = position.y / scale;
// TODO: determine why iced moved cursor position out of the `Cache` and if we // TODO: determine why iced moved cursor position out of the `Cache` and if we
// may need to handle this in a different way to address // may need to handle this in a different way to address
// whatever issue iced was trying to address // whatever issue iced was trying to address
self.cursor_position = Vec2 { self.cursor_position = Vec2::new(x, y);
x: x / scale,
y: y / scale,
};
self.events.push(Event::Mouse(mouse::Event::CursorMoved { self.events.push(Event::Mouse(mouse::Event::CursorMoved {
x: x / scale, position: iced::Point::new(x, y),
y: y / scale,
})); }));
}, },
// Scale pixel scrolling events // Scale pixel scrolling events
@ -183,17 +181,21 @@ impl IcedUi {
); );
drop(guard); drop(guard);
span!(guard, "update user_interface"); let messages = {
let messages = user_interface.update( span!(_guard, "update user_interface");
&self.events, let mut messages = Vec::new();
cursor_position, let _event_status_list = user_interface.update(
match clipboard { &self.events,
Some(c) => Some(c), cursor_position,
None => None, match clipboard {
}, Some(c) => Some(c),
&self.renderer, None => None,
); },
drop(guard); &self.renderer,
&mut messages,
);
messages
};
// Clear events // Clear events
self.events.clear(); self.events.clear();

View File

@ -122,7 +122,7 @@ where
messages: &mut Vec<M>, messages: &mut Vec<M>,
renderer: &R, renderer: &R,
clipboard: Option<&dyn Clipboard>, clipboard: Option<&dyn Clipboard>,
) { ) -> iced::event::Status {
self.content.on_event( self.content.on_event(
event, event,
layout.children().next().unwrap(), layout.children().next().unwrap(),
@ -130,7 +130,7 @@ where
messages, messages,
renderer, renderer,
clipboard, clipboard,
); )
} }
fn draw( fn draw(

View File

@ -258,7 +258,7 @@ where
messages: &mut Vec<M>, messages: &mut Vec<M>,
renderer: &R, renderer: &R,
clipboard: Option<&dyn Clipboard>, clipboard: Option<&dyn Clipboard>,
) { ) -> iced::event::Status {
self.content.on_event( self.content.on_event(
event, event,
layout.children().next().unwrap(), layout.children().next().unwrap(),
@ -266,7 +266,7 @@ where
messages, messages,
renderer, renderer,
clipboard, clipboard,
); )
} }
fn draw( fn draw(

View File

@ -51,8 +51,11 @@ where
_messages: &mut Vec<M>, _messages: &mut Vec<M>,
_renderer: &R, _renderer: &R,
_clipboard: Option<&dyn Clipboard>, _clipboard: Option<&dyn Clipboard>,
) { ) -> iced::event::Status {
if let Event::Mouse(mouse::Event::CursorMoved { x, y }) = event { if let Event::Mouse(mouse::Event::CursorMoved {
position: Point { x, y },
}) = event
{
let bounds = layout.bounds(); let bounds = layout.bounds();
let mouse_over = x > bounds.x let mouse_over = x > bounds.x
&& x < bounds.x + bounds.width && x < bounds.x + bounds.width
@ -62,6 +65,8 @@ where
self.state.mouse_over = mouse_over; self.state.mouse_over = mouse_over;
} }
} }
iced::event::Status::Ignored
} }
fn draw( fn draw(

View File

@ -134,11 +134,12 @@ where
messages: &mut Vec<M>, messages: &mut Vec<M>,
renderer: &R, renderer: &R,
clipboard: Option<&dyn Clipboard>, clipboard: Option<&dyn Clipboard>,
) { ) -> iced::event::Status {
let mut children = layout.children(); let mut children = layout.children();
let over_layout = children.next().unwrap(); let over_layout = children.next().unwrap();
self.over.on_event( // TODO: consider passing to under if ignored?
let status = self.over.on_event(
event.clone(), event.clone(),
over_layout, over_layout,
cursor_position, cursor_position,
@ -152,14 +153,18 @@ where
if !matches!(&event, Event::Mouse(mouse::Event::ButtonPressed(_))) if !matches!(&event, Event::Mouse(mouse::Event::ButtonPressed(_)))
|| !over_layout.bounds().contains(cursor_position) || !over_layout.bounds().contains(cursor_position)
{ {
self.under.on_event( self.under
event, .on_event(
children.next().unwrap(), event,
cursor_position, children.next().unwrap(),
messages, cursor_position,
renderer, messages,
clipboard, renderer,
); clipboard,
)
.merge(status)
} else {
status
} }
} }

View File

@ -192,7 +192,7 @@ where
messages: &mut Vec<M>, messages: &mut Vec<M>,
renderer: &R, renderer: &R,
clipboard: Option<&dyn Clipboard>, clipboard: Option<&dyn Clipboard>,
) { ) -> iced::event::Status {
self.content.on_event( self.content.on_event(
event, event,
layout, layout,
@ -200,7 +200,7 @@ where
messages, messages,
renderer, renderer,
clipboard, clipboard,
); )
} }
fn draw( fn draw(