mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
use a more modern clipboard crate for no specific reason
This commit is contained in:
parent
a5d6de8bc8
commit
bcd48f31e0
3 changed files with 88 additions and 80 deletions
124
noita-proxy/Cargo.lock
generated
124
noita-proxy/Cargo.lock
generated
|
@ -139,7 +139,7 @@ version = "3.5.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1df21f715862ede32a0c525ce2ca4d52626bb0007f8c18b87a384503ac33e70"
|
||||
dependencies = [
|
||||
"clipboard-win 5.4.0",
|
||||
"clipboard-win",
|
||||
"image",
|
||||
"log",
|
||||
"objc2 0.6.1",
|
||||
|
@ -150,6 +150,7 @@ dependencies = [
|
|||
"parking_lot",
|
||||
"percent-encoding",
|
||||
"windows-sys 0.59.0",
|
||||
"wl-clipboard-rs",
|
||||
"x11rb",
|
||||
]
|
||||
|
||||
|
@ -727,28 +728,6 @@ version = "0.4.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4bfbf56724aa9eca8afa4fcfadeb479e722935bb2a0900c2d37e0cc477af0688"
|
||||
|
||||
[[package]]
|
||||
name = "clipboard"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "25a904646c0340239dcf7c51677b33928bf24fdf424b79a57909c0109075b2e7"
|
||||
dependencies = [
|
||||
"clipboard-win 2.2.0",
|
||||
"objc",
|
||||
"objc-foundation",
|
||||
"objc_id",
|
||||
"x11-clipboard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clipboard-win"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3a093d6fed558e5fe24c3dfc85a68bb68f1c824f440d3ba5aca189e2998786b"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clipboard-win"
|
||||
version = "5.4.0"
|
||||
|
@ -1470,6 +1449,12 @@ dependencies = [
|
|||
"simd-adler32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fixedbitset"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.1.2"
|
||||
|
@ -2877,10 +2862,10 @@ checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
|
|||
name = "noita-proxy"
|
||||
version = "1.5.5"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"argh",
|
||||
"bitcode",
|
||||
"bytemuck",
|
||||
"clipboard",
|
||||
"cpal",
|
||||
"crossbeam",
|
||||
"dashmap",
|
||||
|
@ -3017,17 +3002,6 @@ dependencies = [
|
|||
"malloc_buf",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc-foundation"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9"
|
||||
dependencies = [
|
||||
"block",
|
||||
"objc",
|
||||
"objc_id",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc-sys"
|
||||
version = "0.3.5"
|
||||
|
@ -3300,15 +3274,6 @@ dependencies = [
|
|||
"objc2-foundation 0.2.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc_id"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b"
|
||||
dependencies = [
|
||||
"objc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.36.7"
|
||||
|
@ -3444,6 +3409,16 @@ dependencies = [
|
|||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "os_pipe"
|
||||
version = "1.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db335f4760b14ead6290116f2427bf33a14d4f0617d49f78a246de10c1831224"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "overload"
|
||||
version = "0.1.1"
|
||||
|
@ -3520,6 +3495,16 @@ version = "2.3.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
||||
|
||||
[[package]]
|
||||
name = "petgraph"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db"
|
||||
dependencies = [
|
||||
"fixedbitset",
|
||||
"indexmap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf"
|
||||
version = "0.11.3"
|
||||
|
@ -5309,6 +5294,19 @@ dependencies = [
|
|||
"strength_reduce",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tree_magic_mini"
|
||||
version = "3.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aac5e8971f245c3389a5a76e648bfc80803ae066a1243a75db0064d7c1129d63"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"memchr",
|
||||
"nom",
|
||||
"once_cell",
|
||||
"petgraph",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "try-lock"
|
||||
version = "0.2.5"
|
||||
|
@ -6450,21 +6448,31 @@ dependencies = [
|
|||
"bitflags 2.9.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wl-clipboard-rs"
|
||||
version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e5ff8d0e60065f549fafd9d6cb626203ea64a798186c80d8e7df4f8af56baeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"os_pipe",
|
||||
"rustix 0.38.44",
|
||||
"tempfile",
|
||||
"thiserror 2.0.12",
|
||||
"tree_magic_mini",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
"wayland-protocols-wlr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "writeable"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb"
|
||||
|
||||
[[package]]
|
||||
name = "x11-clipboard"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89bd49c06c9eb5d98e6ba6536cf64ac9f7ee3a009b2f53996d405b3944f6bcea"
|
||||
dependencies = [
|
||||
"xcb",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11-dl"
|
||||
version = "2.21.0"
|
||||
|
@ -6497,16 +6505,6 @@ version = "0.13.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d"
|
||||
|
||||
[[package]]
|
||||
name = "xcb"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e917a3f24142e9ff8be2414e36c649d47d6cc2ba81f16201cdef96e533e02de"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xcursor"
|
||||
version = "0.3.8"
|
||||
|
|
|
@ -29,7 +29,7 @@ lz4_flex = { version = "0.11.3", default-features = false, features = ["std"]}
|
|||
rand = "0.9.0"
|
||||
steamworks = "0.11.0"
|
||||
crossbeam = { version = "0.8.4", features = ["crossbeam-channel"] }
|
||||
clipboard = "0.5.0"
|
||||
arboard = { version = "3.5.0", features = ["wayland-data-control"]}
|
||||
socket2 = { version = "0.5.7", features = ["all"] }
|
||||
reqwest = { version = "0.12.12", features = ["blocking", "json"]}
|
||||
poll-promise = "0.3.0"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use arboard::Clipboard;
|
||||
use bitcode::{Decode, Encode};
|
||||
use bookkeeping::{
|
||||
noita_launcher::{LaunchTokenResult, NoitaLauncher},
|
||||
|
@ -6,14 +7,12 @@ use bookkeeping::{
|
|||
save_state::SaveState,
|
||||
self_restart::SelfRestarter,
|
||||
};
|
||||
use clipboard::{ClipboardContext, ClipboardProvider};
|
||||
use cpal::traits::{DeviceTrait, HostTrait};
|
||||
use eframe::egui::load::TexturePoll;
|
||||
use eframe::egui::{
|
||||
self, Align2, Button, Color32, ComboBox, Context, DragValue, FontDefinitions, FontFamily,
|
||||
ImageButton, InnerResponse, Key, Layout, Margin, OpenUrl, OutputCommand, Rect, RichText,
|
||||
ScrollArea, Sense, SizeHint, Slider, TextureOptions, ThemePreference, Ui, UiBuilder, Vec2,
|
||||
Visuals, Window, pos2,
|
||||
ImageButton, InnerResponse, Key, Layout, Margin, OpenUrl, Rect, RichText, ScrollArea, Sense,
|
||||
SizeHint, Slider, TextureOptions, ThemePreference, Ui, UiBuilder, Vec2, Visuals, Window, pos2,
|
||||
};
|
||||
use eframe::epaint::TextureHandle;
|
||||
use image::DynamicImage::ImageRgba8;
|
||||
|
@ -1320,6 +1319,7 @@ pub struct App {
|
|||
noitalog: Vec<String>,
|
||||
proxylog: String,
|
||||
save_paths: SavePaths,
|
||||
clipboard: Option<Clipboard>,
|
||||
}
|
||||
|
||||
fn filled_group<R>(ui: &mut Ui, add_contents: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {
|
||||
|
@ -1452,6 +1452,7 @@ impl App {
|
|||
noitalog: Vec::new(),
|
||||
proxylog: String::new(),
|
||||
save_paths,
|
||||
clipboard: Clipboard::new().ok(),
|
||||
};
|
||||
|
||||
if let Some(connect_to) = me.args.auto_connect_to {
|
||||
|
@ -1911,14 +1912,17 @@ impl App {
|
|||
);
|
||||
ui.checkbox(&mut self.app_saved_state.allow_friends, "Allow friends");
|
||||
if ui.button(tr("connect_steam_connect")).clicked() {
|
||||
let id = ClipboardProvider::new()
|
||||
.and_then(|mut ctx: ClipboardContext| ctx.get_contents());
|
||||
let id = self.clipboard.as_mut().and_then(|c| c.get_text().ok());
|
||||
match id {
|
||||
Ok(id) => {
|
||||
Some(id) => {
|
||||
self.set_settings();
|
||||
self.connect_to_steam_lobby(id);
|
||||
}
|
||||
Err(error) => self.notify_error(error),
|
||||
None => self.notify_error(if self.clipboard.is_none() {
|
||||
"no clipboard"
|
||||
} else {
|
||||
"clipboard failed"
|
||||
}),
|
||||
}
|
||||
}
|
||||
if ui.button(tr("Open-lobby-list")).clicked() {
|
||||
|
@ -2238,10 +2242,9 @@ impl App {
|
|||
kind: self.my_lobby_kind,
|
||||
code: id,
|
||||
};
|
||||
ui.output_mut(|o| {
|
||||
o.commands
|
||||
.push(OutputCommand::CopyText(lobby_code.serialize()))
|
||||
});
|
||||
if let Some(clipboard) = self.clipboard.as_mut() {
|
||||
let _ = clipboard.set_text(lobby_code.serialize());
|
||||
}
|
||||
self.copied_lobby = true;
|
||||
}
|
||||
} else {
|
||||
|
@ -2403,11 +2406,18 @@ impl App {
|
|||
}
|
||||
ConnectedMenu::NoitaLog => {
|
||||
if !self.noitalog.is_empty() {
|
||||
let l = self.noitalog.len();
|
||||
if l > 1 {
|
||||
ui.add(Slider::new(&mut self.noitalog_number, 0..=l - 1));
|
||||
}
|
||||
let mut s = self.noitalog[self.noitalog_number].clone() + "\n";
|
||||
ui.horizontal(|ui| {
|
||||
let l = self.noitalog.len();
|
||||
if l > 1 {
|
||||
ui.add(Slider::new(&mut self.noitalog_number, 0..=l - 1));
|
||||
}
|
||||
if let Some(clipboard) = self.clipboard.as_mut() {
|
||||
if ui.button("save to clipboard").clicked() {
|
||||
let _ = clipboard.set_text(&s);
|
||||
}
|
||||
}
|
||||
});
|
||||
ScrollArea::vertical()
|
||||
.auto_shrink([false; 2])
|
||||
.stick_to_bottom(true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue