Skip to content

Commit

Permalink
Upgrade dependencies (ArturKovacs#179)
Browse files Browse the repository at this point in the history
* Upgrade libraries (in particular winit)

* Apply rustfmt

* Fix ureq code after upgrade

* Fix deprecation warning

* Fix rustfmt

* Review fixes
  • Loading branch information
vn971 authored Mar 6, 2021
1 parent 8356939 commit 3ccb605
Show file tree
Hide file tree
Showing 8 changed files with 655 additions and 828 deletions.
1,339 changes: 579 additions & 760 deletions Cargo.lock

Large diffs are not rendered by default.

72 changes: 36 additions & 36 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,6 @@ readme = "README.md"
edition = "2018"
build = "build.rs"

[workspace]
members = [
"subcrates/gelatin",
]

[profile.dev.package."*"]
opt-level = 1
[profile.dev.build-override]
opt-level = 1
[profile.release]
lto = true

[features]
default = []
networking = ["ureq"]
avif = ["libavif-image"]

[package.metadata.bundle]
name = "Emulsion"
identifier = "io.github.arturkovacs.emulsion"
Expand Down Expand Up @@ -59,32 +42,49 @@ linux_mime_types = [
"image/x‑portable‑anymap"
]

[workspace]
members = [
"subcrates/gelatin",
]

[profile.dev.package."*"]
opt-level = 1
[profile.dev.build-override]
opt-level = 1
[profile.release]
lto = true

[features]
default = []
networking = ["ureq"]
avif = ["libavif-image"]

[target.'cfg(windows)'.build-dependencies]
winres = "0.1"
winres = "0.1.11"

[dependencies]
gelatin = { path = "./subcrates/gelatin", version = "0.6" }
ureq = { version = "1", features = ["json"], optional = true }
ureq = { version = "2.0.2", features = ["json"], optional = true }
lazy_static = "1.4.0"
directories-next = "2.0"
open = "1.4.0"
sys-info = "0.7"
error-chain = "0.12"
backtrace = "0.3"
serde = { version = "1.0", features = ["derive"] }
toml = "0.5"
rand = "0.7"
lexical-sort = "0.3"
trash = "1.2"
clap = { version = "2.33", default-features = false }
kamadak-exif = "0.5.1"
arboard = "1.1"
resvg = "0.13.0"
usvg = "0.13.0"
tiny-skia = "0.3.0"
directories-next = "2.0.0"
open = "1.5.0"
sys-info = "0.8.0"
error-chain = "0.12.4"
backtrace = "0.3.56"
serde = { version = "1.0.123", features = ["derive"] }
toml = "0.5.8"
rand = "0.8.3"
lexical-sort = "0.3.1"
trash = "1.3.0"
clap = { version = "2.33.3", default-features = false }
kamadak-exif = "0.5.3"
arboard = "1.1.0"
resvg = "0.13.1"
usvg = "0.13.1"
tiny-skia = "0.4.2"

[dependencies.libavif-image]
version = "0.5"
version = "0.5.0"
default-features = false
features = ["codec-dav1d"]
optional = true
2 changes: 1 addition & 1 deletion src/image_cache/directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ macro_rules! step_to_next_img {
$this.curr_file_idx = i;
$this.set_image_index_from_file_index();
return;
}
}
}
};
}

Expand Down
6 changes: 4 additions & 2 deletions src/image_cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,11 @@ impl ImageCache {
if let Some(tex) = self.texture_cache.get_mut(&req_id) {
tex.fully_loaded = true;
}
PRIORITY_REQUEST_ID.compare_and_swap(
let _ = PRIORITY_REQUEST_ID.compare_exchange(
req_id,
NON_EXISTENT_REQUEST_ID,
Ordering::SeqCst,
Ordering::SeqCst,
);
self.pending_requests.set_finished(&req_id);
Ok(None)
Expand All @@ -603,10 +604,11 @@ impl ImageCache {
tex.fully_loaded = true;
tex.failed = true;
}
PRIORITY_REQUEST_ID.compare_and_swap(
let _ = PRIORITY_REQUEST_ID.compare_exchange(
req_id,
NON_EXISTENT_REQUEST_ID,
Ordering::SeqCst,
Ordering::SeqCst,
);
self.pending_requests.set_finished(&req_id);
Err(errors::Error::from_kind(errors::ErrorKind::FailedToLoadImage(req_id)))
Expand Down
12 changes: 7 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ mod update {
error_chain! {
foreign_links {
Io(std::io::Error);
Ureq(ureq::Error);
ParseIntError(std::num::ParseIntError);
}
}
Expand All @@ -458,11 +459,12 @@ mod update {
fn latest_release() -> errors::Result<ReleaseInfoJson> {
let url = "https://api.github.com/repos/ArturKovacs/emulsion/releases/latest";
let res = ureq::get(&url).set("User-Agent", "emulsion").call();
if res.ok() {
let release_info = res.into_json_deserialize()?;
Ok(release_info)
} else {
Err(res.status_line().into())
match res {
Ok(res) => {
let release_info = res.into_json()?;
Ok(release_info)
}
Err(err) => Err(err.into()),
}
}

Expand Down
31 changes: 20 additions & 11 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,28 @@ pub fn virtual_keycode_is_char(vk: VirtualKeyCode) -> bool {
VirtualKeyCode::Numpad9 => true,
VirtualKeyCode::AbntC1 => true,
VirtualKeyCode::AbntC2 => true,
VirtualKeyCode::Add => true,
VirtualKeyCode::Apostrophe => true,
VirtualKeyCode::Asterisk => true,
VirtualKeyCode::At => true,
VirtualKeyCode::Backslash => true,
VirtualKeyCode::Colon => true,
VirtualKeyCode::Comma => true,
VirtualKeyCode::Divide => true,
VirtualKeyCode::Equals => true,
VirtualKeyCode::Grave => true,
VirtualKeyCode::LBracket => true,
VirtualKeyCode::Minus => true,
VirtualKeyCode::Multiply => true,
VirtualKeyCode::NumpadAdd => true,
VirtualKeyCode::NumpadComma => true,
VirtualKeyCode::NumpadDivide => true,
VirtualKeyCode::NumpadEnter => true,
VirtualKeyCode::NumpadEquals => true,
VirtualKeyCode::NumpadMultiply => true,
VirtualKeyCode::NumpadSubtract => true,
VirtualKeyCode::Period => true,
VirtualKeyCode::Plus => true,
VirtualKeyCode::RBracket => true,
VirtualKeyCode::Semicolon => true,
VirtualKeyCode::Slash => true,
VirtualKeyCode::Subtract => true,
VirtualKeyCode::Tab => true,
VirtualKeyCode::Underline => true,
VirtualKeyCode::Yen => true,
Expand Down Expand Up @@ -173,9 +175,9 @@ pub fn virtual_keycode_to_string(vk: VirtualKeyCode) -> String {
VirtualKeyCode::Numpad9 => "Numpad9".into(),
VirtualKeyCode::AbntC1 => "AbntC1".into(),
VirtualKeyCode::AbntC2 => "AbntC2".into(),
VirtualKeyCode::Add => "Add".into(),
VirtualKeyCode::Apostrophe => "Apostrophe".into(),
VirtualKeyCode::Apps => "Apps".into(),
VirtualKeyCode::Asterisk => "Asterisk".into(),
VirtualKeyCode::At => "At".into(),
VirtualKeyCode::Ax => "Ax".into(),
VirtualKeyCode::Backslash => "Backslash".into(),
Expand All @@ -184,8 +186,6 @@ pub fn virtual_keycode_to_string(vk: VirtualKeyCode) -> String {
VirtualKeyCode::Colon => "Colon".into(),
VirtualKeyCode::Comma => "Comma".into(),
VirtualKeyCode::Convert => "Convert".into(),
VirtualKeyCode::Decimal => "Decimal".into(),
VirtualKeyCode::Divide => "Divide".into(),
VirtualKeyCode::Equals => "Equals".into(),
VirtualKeyCode::Grave => "Grave".into(),
VirtualKeyCode::Kana => "Kana".into(),
Expand All @@ -201,22 +201,32 @@ pub fn virtual_keycode_to_string(vk: VirtualKeyCode) -> String {

// Handling the alphanumeric and the numpad version of `-`
// as the same key.
// Alphanumeric is `Minus`, the numapd is `Subtract`
// Alphanumeric is `Minus`, the numapd is `NumpadSubtract`
VirtualKeyCode::Minus => "Subtract".into(),

VirtualKeyCode::Multiply => "Multiply".into(),
VirtualKeyCode::Mute => "Mute".into(),
VirtualKeyCode::MyComputer => "MyComputer".into(),
VirtualKeyCode::NavigateForward => "NavigateForward".into(),
VirtualKeyCode::NavigateBackward => "NavigateBackward".into(),
VirtualKeyCode::NavigateForward => "NavigateForward".into(),
VirtualKeyCode::NextTrack => "NextTrack".into(),
VirtualKeyCode::NoConvert => "NoConvert".into(),
VirtualKeyCode::NumpadAdd => "Add".into(),
VirtualKeyCode::NumpadComma => "NumpadComma".into(),
VirtualKeyCode::NumpadDecimal => "Decimal".into(),
VirtualKeyCode::NumpadDivide => "Divide".into(),
VirtualKeyCode::NumpadEnter => "NumpadEnter".into(),
VirtualKeyCode::NumpadEquals => "NumpadEquals".into(),
VirtualKeyCode::NumpadMultiply => "Multiply".into(),
VirtualKeyCode::NumpadSubtract => "Subtract".into(),
VirtualKeyCode::OEM102 => "OEM102".into(),
VirtualKeyCode::Period => "Period".into(),
VirtualKeyCode::PlayPause => "PlayPause".into(),

// Handling the alphanumeric and the numpad version of `+`
// as the same key.
// Alphanumeric is `Plus`, the numapd is `NumpadAdd`
VirtualKeyCode::Plus => "Add".into(),

VirtualKeyCode::Power => "Power".into(),
VirtualKeyCode::PrevTrack => "PrevTrack".into(),
VirtualKeyCode::RAlt => "RAlt".into(),
Expand All @@ -228,7 +238,6 @@ pub fn virtual_keycode_to_string(vk: VirtualKeyCode) -> String {
VirtualKeyCode::Slash => "Slash".into(),
VirtualKeyCode::Sleep => "Sleep".into(),
VirtualKeyCode::Stop => "Stop".into(),
VirtualKeyCode::Subtract => "Subtract".into(),
VirtualKeyCode::Sysrq => "Sysrq".into(),
VirtualKeyCode::Tab => "Tab".into(),
VirtualKeyCode::Underline => "Underline".into(),
Expand Down
6 changes: 3 additions & 3 deletions src/widgets/picture_widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -907,16 +907,16 @@ impl Widget for PictureWidget {
$name,
input_key_str.as_str(),
event.modifiers,
) {
) {
if $input == $dir && !pressed {
$input = MovementDir::None;
$vel = 0.0;
}
}
if $input != $dir && pressed {
borrowed.camera_movement_will_start();
$input = $dir;
}
}
}
};
}

Expand Down
15 changes: 5 additions & 10 deletions subcrates/gelatin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,8 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
cgmath = "0.17"
image = "0.23.6"
derive_builder = "0.9"
glium = { version = "0.27" }

# Forcing 0.22.0 to avoid running into
# https://github.com/rust-windowing/winit/issues/1587
# The next release that will include the fix will be
# AFTER 0.22.2
winit = "=0.22.0"
cgmath = "0.18.0"
derive_builder = "0.9.0"
image = "0.23.13"
glium = "0.29.0"
winit = "0.24.0"

0 comments on commit 3ccb605

Please sign in to comment.