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:
script:
- 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-voxygen $CI_PROJECT_DIR
artifacts:

75
Cargo.lock generated
View File

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

View File

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

View File

@ -105,19 +105,17 @@ impl IcedUi {
// Scale cursor movement events
// 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
Event::Mouse(mouse::Event::CursorMoved { x, y }) => {
Event::Mouse(mouse::Event::CursorMoved { position }) => {
// TODO: return f32 here
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
// may need to handle this in a different way to address
// whatever issue iced was trying to address
self.cursor_position = Vec2 {
x: x / scale,
y: y / scale,
};
self.cursor_position = Vec2::new(x, y);
self.events.push(Event::Mouse(mouse::Event::CursorMoved {
x: x / scale,
y: y / scale,
position: iced::Point::new(x, y),
}));
},
// Scale pixel scrolling events
@ -183,17 +181,21 @@ impl IcedUi {
);
drop(guard);
span!(guard, "update user_interface");
let messages = user_interface.update(
&self.events,
cursor_position,
match clipboard {
Some(c) => Some(c),
None => None,
},
&self.renderer,
);
drop(guard);
let messages = {
span!(_guard, "update user_interface");
let mut messages = Vec::new();
let _event_status_list = user_interface.update(
&self.events,
cursor_position,
match clipboard {
Some(c) => Some(c),
None => None,
},
&self.renderer,
&mut messages,
);
messages
};
// Clear events
self.events.clear();

View File

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

View File

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

View File

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

View File

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

View File

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