diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b4adb6c..e789957d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: toolchain: 1.80.1 components: clippy - name: install dependencies - run: sudo apt install -y libxkbcommon-dev libwayland-dev libdbus-1-dev libpulse-dev libinput-dev + run: sudo apt update && sudo apt install -y libxkbcommon-dev libwayland-dev libdbus-1-dev libpulse-dev libinput-dev - uses: actions-rs-plus/clippy-check@v2 with: toolchain: 1.80.1 diff --git a/Cargo.lock b/Cargo.lock index dbac25a3..06200722 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -249,8 +249,6 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd884d7c72877a94102c3715f3b1cd09ff4fac28221add3e57cfbe25c236d093" dependencies = [ - "async-fs", - "async-net", "enumflags2", "futures-channel", "futures-util", @@ -399,17 +397,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "async-net" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7" -dependencies = [ - "async-io 2.4.0", - "blocking", - "futures-lite 2.5.0", -] - [[package]] name = "async-process" version = "1.8.1" @@ -613,12 +600,6 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2c54ff287cfc0a34f38a6b832ea1bd8e448a330b3e40a50859e6488bee07f22" -[[package]] -name = "bit_field" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" - [[package]] name = "bitflags" version = "1.3.2" @@ -869,7 +850,7 @@ dependencies = [ [[package]] name = "clipboard_macos" version = "0.1.0" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13-2#6b9faab87bea9cebec6ae036906fd67fed254f5f" dependencies = [ "objc", "objc-foundation", @@ -879,7 +860,7 @@ dependencies = [ [[package]] name = "clipboard_wayland" version = "0.2.2" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13-2#6b9faab87bea9cebec6ae036906fd67fed254f5f" dependencies = [ "dnd", "mime 0.1.0", @@ -889,7 +870,7 @@ dependencies = [ [[package]] name = "clipboard_x11" version = "0.4.2" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13-2#6b9faab87bea9cebec6ae036906fd67fed254f5f" dependencies = [ "thiserror", "x11rb", @@ -1052,7 +1033,7 @@ dependencies = [ "futures", "i18n-embed 0.14.1", "i18n-embed-fl 0.8.0", - "image 0.25.5", + "image", "itertools 0.13.0", "libcosmic", "memmap2 0.9.5", @@ -1185,7 +1166,7 @@ dependencies = [ "anyhow", "i18n-embed 0.14.1", "i18n-embed-fl 0.8.0", - "image 0.25.5", + "image", "libcosmic", "memmap2 0.9.5", "once_cell", @@ -1230,7 +1211,7 @@ dependencies = [ "i18n-embed 0.13.9", "i18n-embed-fl 0.6.7", "libcosmic", - "ron", + "ron 0.8.1", "rust-embed 6.8.1", "rust-embed-utils 7.8.1", "sendfd", @@ -1353,6 +1334,7 @@ dependencies = [ "cosmic-applet-time", "cosmic-applet-workspaces", "cosmic-panel-button", + "libc", "libcosmic", "tracing", "tracing-log", @@ -1362,7 +1344,7 @@ dependencies = [ [[package]] name = "cosmic-client-toolkit" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-protocols//?rev=d218c76#d218c76b58c7a3b20dd5e7943f93fc306a1b81b8" +source = "git+https://github.com/pop-os/cosmic-protocols?rev=29ab323#29ab32305c6457fccf0728caaaf79fcac4cca665" dependencies = [ "cosmic-protocols", "libc", @@ -1384,7 +1366,7 @@ dependencies = [ [[package]] name = "cosmic-config" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#aaa2ba3ad4239cb44ba01c10cbca57174d52a7da" +source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a" dependencies = [ "atomicwrites", "cosmic-config-derive", @@ -1395,7 +1377,7 @@ dependencies = [ "known-folders", "notify", "once_cell", - "ron", + "ron 0.9.0-alpha.1", "serde", "tokio", "tracing", @@ -1406,7 +1388,7 @@ dependencies = [ [[package]] name = "cosmic-config-derive" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#aaa2ba3ad4239cb44ba01c10cbca57174d52a7da" +source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a" dependencies = [ "quote", "syn 1.0.109", @@ -1436,8 +1418,8 @@ dependencies = [ [[package]] name = "cosmic-freedesktop-icons" -version = "0.2.6" -source = "git+https://github.com/pop-os/freedesktop-icons#bfc22d531596b57646dc47bcd70b2eb6f3152cd4" +version = "0.3.0" +source = "git+https://github.com/pop-os/freedesktop-icons#6bf0b5794b8aa37703c382c7586a5c799bad228c" dependencies = [ "dirs 5.0.1", "ini_core", @@ -1486,11 +1468,11 @@ dependencies = [ [[package]] name = "cosmic-panel-config" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-panel#4a777bc4f6c77b409d1fd3aa5b09ecfb1c25ded1" +source = "git+https://github.com/pop-os/cosmic-panel#dc5c75b460c77d9be283ba14bc1023797b24361e" dependencies = [ "anyhow", "cosmic-config", - "ron", + "ron 0.8.1", "serde", "smithay-client-toolkit", "tracing", @@ -1501,7 +1483,7 @@ dependencies = [ [[package]] name = "cosmic-protocols" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-protocols//?rev=d218c76#d218c76b58c7a3b20dd5e7943f93fc306a1b81b8" +source = "git+https://github.com/pop-os/cosmic-protocols?rev=29ab323#29ab32305c6457fccf0728caaaf79fcac4cca665" dependencies = [ "bitflags 2.7.0", "wayland-backend", @@ -1544,7 +1526,7 @@ dependencies = [ [[package]] name = "cosmic-text" version = "0.12.1" -source = "git+https://github.com/pop-os/cosmic-text.git#166b59f560c551dab391a864f7c1f503c1e18446" +source = "git+https://github.com/pop-os/cosmic-text.git#9125dd48b771e9aa7833d106a9850e935f71eaa6" dependencies = [ "bitflags 2.7.0", "fontdb 0.16.2", @@ -1566,7 +1548,7 @@ dependencies = [ [[package]] name = "cosmic-theme" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#aaa2ba3ad4239cb44ba01c10cbca57174d52a7da" +source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a" dependencies = [ "almost", "cosmic-config", @@ -1574,7 +1556,7 @@ dependencies = [ "dirs 5.0.1", "lazy_static", "palette", - "ron", + "ron 0.9.0-alpha.1", "serde", "serde_json", "thiserror", @@ -1617,25 +1599,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "crossbeam-deque" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "crossbeam-utils" version = "0.8.21" @@ -1984,7 +1947,7 @@ dependencies = [ [[package]] name = "dnd" version = "0.1.0" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13-2#6b9faab87bea9cebec6ae036906fd67fed254f5f" dependencies = [ "bitflags 2.7.0", "mime 0.1.0", @@ -2164,21 +2127,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "exr" -version = "1.73.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83197f59927b46c04a183a619b7c29df34e63e63c7869320862268c0ef687e0" -dependencies = [ - "bit_field", - "half", - "lebe", - "miniz_oxide", - "rayon-core", - "smallvec", - "zune-inflate", -] - [[package]] name = "fast-srgb8" version = "1.0.0" @@ -2958,7 +2906,7 @@ dependencies = [ [[package]] name = "iced" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic#aaa2ba3ad4239cb44ba01c10cbca57174d52a7da" +source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a" dependencies = [ "dnd", "iced_accessibility", @@ -2967,7 +2915,7 @@ dependencies = [ "iced_renderer", "iced_widget", "iced_winit", - "image 0.24.9", + "image", "mime 0.1.0", "thiserror", "window_clipboard", @@ -2976,7 +2924,7 @@ dependencies = [ [[package]] name = "iced_accessibility" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#aaa2ba3ad4239cb44ba01c10cbca57174d52a7da" +source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a" dependencies = [ "accesskit", "accesskit_winit", @@ -2985,7 +2933,7 @@ dependencies = [ [[package]] name = "iced_core" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic#aaa2ba3ad4239cb44ba01c10cbca57174d52a7da" +source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a" dependencies = [ "bitflags 2.7.0", "bytes", @@ -3009,7 +2957,7 @@ dependencies = [ [[package]] name = "iced_futures" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic#aaa2ba3ad4239cb44ba01c10cbca57174d52a7da" +source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a" dependencies = [ "futures", "iced_core", @@ -3035,7 +2983,7 @@ dependencies = [ [[package]] name = "iced_graphics" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic#aaa2ba3ad4239cb44ba01c10cbca57174d52a7da" +source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a" dependencies = [ "bitflags 2.7.0", "bytemuck", @@ -3043,7 +2991,7 @@ dependencies = [ "half", "iced_core", "iced_futures", - "image 0.24.9", + "image", "kamadak-exif", "log", "lyon_path", @@ -3057,7 +3005,7 @@ dependencies = [ [[package]] name = "iced_renderer" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic#aaa2ba3ad4239cb44ba01c10cbca57174d52a7da" +source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a" dependencies = [ "iced_graphics", "iced_tiny_skia", @@ -3069,7 +3017,7 @@ dependencies = [ [[package]] name = "iced_runtime" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic#aaa2ba3ad4239cb44ba01c10cbca57174d52a7da" +source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a" dependencies = [ "bytes", "cosmic-client-toolkit", @@ -3084,7 +3032,7 @@ dependencies = [ [[package]] name = "iced_tiny_skia" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic#aaa2ba3ad4239cb44ba01c10cbca57174d52a7da" +source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a" dependencies = [ "bytemuck", "cosmic-text", @@ -3100,7 +3048,7 @@ dependencies = [ [[package]] name = "iced_wgpu" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic#aaa2ba3ad4239cb44ba01c10cbca57174d52a7da" +source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a" dependencies = [ "as-raw-xcb-connection", "bitflags 2.7.0", @@ -3131,7 +3079,7 @@ dependencies = [ [[package]] name = "iced_widget" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic#aaa2ba3ad4239cb44ba01c10cbca57174d52a7da" +source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a" dependencies = [ "cosmic-client-toolkit", "dnd", @@ -3149,7 +3097,7 @@ dependencies = [ [[package]] name = "iced_winit" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic#aaa2ba3ad4239cb44ba01c10cbca57174d52a7da" +source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a" dependencies = [ "cosmic-client-toolkit", "dnd", @@ -3159,10 +3107,12 @@ dependencies = [ "log", "raw-window-handle", "rustc-hash 2.1.0", + "rustix 0.38.43", "thiserror", "tracing", "wasm-bindgen-futures", "wayland-backend", + "wayland-client", "wayland-protocols", "web-sys", "winapi", @@ -3594,24 +3544,6 @@ dependencies = [ "icu_properties", ] -[[package]] -name = "image" -version = "0.24.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d" -dependencies = [ - "bytemuck", - "byteorder", - "color_quant", - "exr", - "gif", - "jpeg-decoder", - "num-traits", - "png", - "qoi", - "tiff", -] - [[package]] name = "image" version = "0.25.5" @@ -3621,6 +3553,9 @@ dependencies = [ "bytemuck", "byteorder-lite", "num-traits", + "png", + "zune-core", + "zune-jpeg", ] [[package]] @@ -3801,9 +3736,6 @@ name = "jpeg-decoder" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" -dependencies = [ - "rayon", -] [[package]] name = "js-sys" @@ -3896,12 +3828,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -[[package]] -name = "lebe" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" - [[package]] name = "libc" version = "0.2.169" @@ -3911,7 +3837,7 @@ checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libcosmic" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic#aaa2ba3ad4239cb44ba01c10cbca57174d52a7da" +source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a" dependencies = [ "apply", "ashpd 0.9.2", @@ -3933,12 +3859,13 @@ dependencies = [ "iced_tiny_skia", "iced_widget", "iced_winit", + "image", "lazy_static", "libc", "mime 0.3.17", "palette", "rfd", - "ron", + "ron 0.8.1", "rustix 0.38.43", "serde", "shlex", @@ -4236,7 +4163,7 @@ dependencies = [ [[package]] name = "mime" version = "0.1.0" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13-2#6b9faab87bea9cebec6ae036906fd67fed254f5f" dependencies = [ "smithay-clipboard", ] @@ -5196,15 +5123,6 @@ version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afbdc74edc00b6f6a218ca6a5364d6226a259d4b8ea1af4a0ea063f27e179f4d" -[[package]] -name = "qoi" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" -dependencies = [ - "bytemuck", -] - [[package]] name = "quick-xml" version = "0.36.2" @@ -5271,26 +5189,6 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - [[package]] name = "read-fonts" version = "0.25.3" @@ -5458,6 +5356,19 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "ron" +version = "0.9.0-alpha.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7644a2a539ff7fa991c8f4652373cd722d387e39229415103243914249730836" +dependencies = [ + "base64 0.22.1", + "bitflags 2.7.0", + "serde", + "serde_derive", + "unicode-ident", +] + [[package]] name = "roxmltree" version = "0.20.0" @@ -6147,17 +6058,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "tiff" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e" -dependencies = [ - "flate2", - "jpeg-decoder", - "weezl", -] - [[package]] name = "time" version = "0.3.37" @@ -7041,7 +6941,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "window_clipboard" version = "0.4.1" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13-2#6b9faab87bea9cebec6ae036906fd67fed254f5f" dependencies = [ "clipboard-win", "clipboard_macos", @@ -7480,7 +7380,7 @@ dependencies = [ [[package]] name = "xdg-shell-wrapper-config" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-panel#4a777bc4f6c77b409d1fd3aa5b09ecfb1c25ded1" +source = "git+https://github.com/pop-os/cosmic-panel#dc5c75b460c77d9be283ba14bc1023797b24361e" dependencies = [ "serde", "wayland-protocols-wlr", @@ -7789,12 +7689,18 @@ dependencies = [ ] [[package]] -name = "zune-inflate" -version = "0.2.54" +name = "zune-core" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a" + +[[package]] +name = "zune-jpeg" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" +checksum = "99a5bab8d7dedf81405c4bb1f2b83ea057643d9cb28778cea9eecddeedd2e028" dependencies = [ - "simd-adler32", + "zune-core", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index e1d85d66..0aee85d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,10 +24,10 @@ resolver = "2" [workspace.dependencies] anyhow = "1.0.81" -cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit", rev = "d218c76" } +cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit", rev = "29ab323" } cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", default-features = false, features = [ "client", -], rev = "c8d3a1c" } +], rev = "29ab323" } cosmic-settings-subscriptions = { git = "https://github.com/pop-os/cosmic-settings-subscriptions" } # cosmic-settings-subscriptions = { path = "../cosmic-settings-subscriptions" } @@ -83,6 +83,3 @@ ignored = ["libcosmic"] # winit = { path = "../winit" } [patch."https://github.com/smithay/client-toolkit.git"] sctk = { package = "smithay-client-toolkit", version = "=0.19.2" } -[patch.'https://github.com/pop-os/cosmic-protocols'] -cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols//", rev = "d218c76" } -cosmic-client-toolkit = { git = "https://github.com/pop-os/cosmic-protocols//", rev = "d218c76" } diff --git a/cosmic-app-list/src/app.rs b/cosmic-app-list/src/app.rs index 759b9d13..a5e61faf 100755 --- a/cosmic-app-list/src/app.rs +++ b/cosmic-app-list/src/app.rs @@ -269,10 +269,11 @@ impl DockItem { let icon_button = if dnd_source_enabled && interaction_enabled { dnd_source(icon_button) .window(window_id) - .drag_icon(move || { + .drag_icon(move |_| { ( cosmic_icon.clone().into(), iced::core::widget::tree::State::None, + iced::Vector::ZERO, ) }) .drag_threshold(16.) diff --git a/cosmic-app-list/src/wayland_handler.rs b/cosmic-app-list/src/wayland_handler.rs index e943cbba..9c5069bf 100644 --- a/cosmic-app-list/src/wayland_handler.rs +++ b/cosmic-app-list/src/wayland_handler.rs @@ -14,7 +14,8 @@ use std::{ use cctk::{ screencopy::{ - capture, Formats, Frame, ScreencopyFrameData, ScreencopyFrameDataExt, ScreencopyHandler, + CaptureFrame, CaptureOptions, CaptureSession, CaptureSource, Capturer, FailureReason, + Formats, Frame, ScreencopyFrameData, ScreencopyFrameDataExt, ScreencopyHandler, ScreencopySessionData, ScreencopySessionDataExt, ScreencopyState, }, sctk::{ @@ -36,15 +37,11 @@ use cctk::{ wl_shm_pool, wl_surface::WlSurface, }, - Connection, Dispatch, Proxy, QueueHandle, WEnum, + Connection, Dispatch, QueueHandle, WEnum, }, workspace::{WorkspaceHandler, WorkspaceState}, }; use cosmic_protocols::{ - image_source::v1::client::zcosmic_toplevel_image_source_manager_v1::ZcosmicToplevelImageSourceManagerV1, - screencopy::v2::client::{ - zcosmic_screencopy_frame_v2, zcosmic_screencopy_manager_v2, zcosmic_screencopy_session_v2, - }, toplevel_info::v1::client::zcosmic_toplevel_handle_v1::{self, ZcosmicToplevelHandleV1}, toplevel_management::v1::client::zcosmic_toplevel_manager_v1, workspace::v1::client::zcosmic_workspace_handle_v1::State as WorkspaceUpdateState, @@ -285,7 +282,7 @@ impl ToplevelInfoHandler for AppData { #[derive(Default)] struct SessionInner { formats: Option, - res: Option>>, + res: Option>>, } // TODO: dmabuf? need to handle modifier negotation @@ -303,13 +300,11 @@ struct SessionData { struct FrameData { frame_data: ScreencopyFrameData, - session: zcosmic_screencopy_session_v2::ZcosmicScreencopySessionV2, + session: CaptureSession, } impl Session { - pub fn for_session( - session: &zcosmic_screencopy_session_v2::ZcosmicScreencopySessionV2, - ) -> Option<&Self> { + pub fn for_session(session: &CaptureSession) -> Option<&Self> { Some(&session.data::()?.session) } @@ -365,8 +360,7 @@ struct CaptureData { qh: QueueHandle, conn: Connection, wl_shm: WlShm, - screencopy_manager: zcosmic_screencopy_manager_v2::ZcosmicScreencopyManagerV2, - toplevel_source_manager: ZcosmicToplevelImageSourceManagerV1, + capturer: Capturer, } impl CaptureData { @@ -384,18 +378,19 @@ impl CaptureData { let overlay_cursor = if overlay_cursor { 1 } else { 0 }; let session = Arc::new(Session::default()); - let image_source = self - .toplevel_source_manager - .create_source(&source, &self.qh, ()); - let screencopy_session = self.screencopy_manager.create_session( - &image_source, - zcosmic_screencopy_manager_v2::Options::empty(), - &self.qh, - SessionData { - session: session.clone(), - session_data: Default::default(), - }, - ); + // Unwrap assumes compositor supports this capture type + let capture_session = self + .capturer + .create_session( + &CaptureSource::CosmicToplevel(source), + CaptureOptions::empty(), + &self.qh, + SessionData { + session: session.clone(), + session_data: Default::default(), + }, + ) + .unwrap(); self.conn.flush().unwrap(); let formats = session @@ -439,14 +434,13 @@ impl CaptureData { (), ); - capture( - &screencopy_session, + capture_session.capture( &buffer, &[], &self.qh, FrameData { frame_data: Default::default(), - session: screencopy_session.clone(), + session: capture_session.clone(), }, ); self.conn.flush().unwrap(); @@ -491,12 +485,7 @@ impl AppData { qh: self.queue_handle.clone(), conn: self.conn.clone(), wl_shm: self.shm_state.wl_shm().clone(), - screencopy_manager: self.screencopy_state.screencopy_manager.clone(), - toplevel_source_manager: self - .screencopy_state - .toplevel_source_manager - .clone() - .unwrap(), + capturer: self.screencopy_state.capturer().clone(), }; std::thread::spawn(move || { use std::ffi::CStr; @@ -559,7 +548,7 @@ impl ScreencopyHandler for AppData { &mut self, _conn: &Connection, _qh: &QueueHandle, - session: &zcosmic_screencopy_session_v2::ZcosmicScreencopySessionV2, + session: &CaptureSession, formats: &Formats, ) { Session::for_session(session).unwrap().update(|data| { @@ -571,38 +560,30 @@ impl ScreencopyHandler for AppData { &mut self, _conn: &Connection, _qh: &QueueHandle, - screencopy_frame: &zcosmic_screencopy_frame_v2::ZcosmicScreencopyFrameV2, + screencopy_frame: &CaptureFrame, _frame: Frame, ) { let session = &screencopy_frame.data::().unwrap().session; Session::for_session(session).unwrap().update(|data| { data.res = Some(Ok(())); }); - session.destroy(); } fn failed( &mut self, _conn: &Connection, _qh: &QueueHandle, - screencopy_frame: &zcosmic_screencopy_frame_v2::ZcosmicScreencopyFrameV2, - reason: WEnum, + screencopy_frame: &CaptureFrame, + reason: WEnum, ) { // TODO send message to thread let session = &screencopy_frame.data::().unwrap().session; Session::for_session(session).unwrap().update(|data| { data.res = Some(Err(reason)); }); - session.destroy(); } - fn stopped( - &mut self, - _conn: &Connection, - _qh: &QueueHandle, - _session: &zcosmic_screencopy_session_v2::ZcosmicScreencopySessionV2, - ) { - } + fn stopped(&mut self, _conn: &Connection, _qh: &QueueHandle, _session: &CaptureSession) {} } pub(crate) fn wayland_handler( diff --git a/cosmic-applet-minimize/src/wayland_handler.rs b/cosmic-applet-minimize/src/wayland_handler.rs index d1b39f0d..6960018c 100644 --- a/cosmic-applet-minimize/src/wayland_handler.rs +++ b/cosmic-applet-minimize/src/wayland_handler.rs @@ -26,17 +26,12 @@ use cosmic::{ cctk::{ self, cosmic_protocols::{ - self, - image_source::v1::client::zcosmic_toplevel_image_source_manager_v1::ZcosmicToplevelImageSourceManagerV1, - screencopy::v2::client::{ - zcosmic_screencopy_frame_v2, zcosmic_screencopy_manager_v2, - zcosmic_screencopy_session_v2, - }, - toplevel_info::v1::client::zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1, + self, toplevel_info::v1::client::zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1, }, screencopy::{ - capture, Formats, Frame, ScreencopyFrameData, ScreencopyFrameDataExt, - ScreencopyHandler, ScreencopySessionData, ScreencopySessionDataExt, ScreencopyState, + CaptureFrame, CaptureOptions, CaptureSession, CaptureSource, Capturer, FailureReason, + Formats, Frame, ScreencopyFrameData, ScreencopyFrameDataExt, ScreencopyHandler, + ScreencopySessionData, ScreencopySessionDataExt, ScreencopyState, }, sctk::shm::{Shm, ShmHandler}, wayland_client::{ @@ -45,7 +40,7 @@ use cosmic::{ wl_shm::{self, WlShm}, wl_shm_pool, }, - Dispatch, Proxy, + Dispatch, }, }, iced_futures::futures, @@ -61,7 +56,7 @@ use wayland_client::{globals::registry_queue_init, Connection, QueueHandle}; #[derive(Default)] struct SessionInner { formats: Option, - res: Option>>, + res: Option>>, } // TODO: dmabuf? need to handle modifier negotation @@ -79,13 +74,11 @@ struct SessionData { struct FrameData { frame_data: ScreencopyFrameData, - session: zcosmic_screencopy_session_v2::ZcosmicScreencopySessionV2, + session: CaptureSession, } impl Session { - pub fn for_session( - session: &zcosmic_screencopy_session_v2::ZcosmicScreencopySessionV2, - ) -> Option<&Self> { + pub fn for_session(session: &CaptureSession) -> Option<&Self> { Some(&session.data::()?.session) } @@ -130,8 +123,7 @@ struct CaptureData { qh: QueueHandle, conn: Connection, wl_shm: WlShm, - screencopy_manager: zcosmic_screencopy_manager_v2::ZcosmicScreencopyManagerV2, - toplevel_source_manager: ZcosmicToplevelImageSourceManagerV1, + capturer: Capturer, } impl CaptureData { @@ -149,18 +141,18 @@ impl CaptureData { let overlay_cursor = if overlay_cursor { 1 } else { 0 }; let session = Arc::new(Session::default()); - let image_source = self - .toplevel_source_manager - .create_source(&source, &self.qh, ()); - let screencopy_session = self.screencopy_manager.create_session( - &image_source, - zcosmic_screencopy_manager_v2::Options::empty(), - &self.qh, - SessionData { - session: session.clone(), - session_data: Default::default(), - }, - ); + let capture_session = self + .capturer + .create_session( + &CaptureSource::CosmicToplevel(source), + CaptureOptions::empty(), + &self.qh, + SessionData { + session: session.clone(), + session_data: Default::default(), + }, + ) + .unwrap(); self.conn.flush().unwrap(); let formats = session @@ -204,14 +196,13 @@ impl CaptureData { (), ); - capture( - &screencopy_session, + capture_session.capture( &buffer, &[], &self.qh, FrameData { frame_data: Default::default(), - session: screencopy_session.clone(), + session: capture_session.clone(), }, ); self.conn.flush().unwrap(); @@ -306,12 +297,7 @@ impl AppData { qh: self.queue_handle.clone(), conn: self.conn.clone(), wl_shm: self.shm_state.wl_shm().clone(), - screencopy_manager: self.screencopy_state.screencopy_manager.clone(), - toplevel_source_manager: self - .screencopy_state - .toplevel_source_manager - .clone() - .unwrap(), + capturer: self.screencopy_state.capturer().clone(), }; std::thread::spawn(move || { use std::ffi::CStr; @@ -509,7 +495,7 @@ impl ScreencopyHandler for AppData { &mut self, _conn: &Connection, _qh: &QueueHandle, - session: &zcosmic_screencopy_session_v2::ZcosmicScreencopySessionV2, + session: &CaptureSession, formats: &Formats, ) { Session::for_session(session).unwrap().update(|data| { @@ -521,38 +507,30 @@ impl ScreencopyHandler for AppData { &mut self, _conn: &Connection, _qh: &QueueHandle, - screencopy_frame: &zcosmic_screencopy_frame_v2::ZcosmicScreencopyFrameV2, + screencopy_frame: &CaptureFrame, _frame: Frame, ) { let session = &screencopy_frame.data::().unwrap().session; Session::for_session(session).unwrap().update(|data| { data.res = Some(Ok(())); }); - session.destroy(); } fn failed( &mut self, _conn: &Connection, _qh: &QueueHandle, - screencopy_frame: &zcosmic_screencopy_frame_v2::ZcosmicScreencopyFrameV2, - reason: WEnum, + screencopy_frame: &CaptureFrame, + reason: WEnum, ) { // TODO send message to thread let session = &screencopy_frame.data::().unwrap().session; Session::for_session(session).unwrap().update(|data| { data.res = Some(Err(reason)); }); - session.destroy(); } - fn stopped( - &mut self, - _conn: &Connection, - _qh: &QueueHandle, - _session: &zcosmic_screencopy_session_v2::ZcosmicScreencopySessionV2, - ) { - } + fn stopped(&mut self, _conn: &Connection, _qh: &QueueHandle, _session: &CaptureSession) {} } impl Dispatch for AppData { diff --git a/cosmic-applet-network/src/app.rs b/cosmic-applet-network/src/app.rs index 0a23761c..d24555ce 100644 --- a/cosmic-applet-network/src/app.rs +++ b/cosmic-applet-network/src/app.rs @@ -51,6 +51,7 @@ enum NewConnectionState { EnterPassword { access_point: AccessPoint, password: String, + password_hidden: bool, }, Waiting(AccessPoint), Failure(AccessPoint), @@ -59,10 +60,7 @@ enum NewConnectionState { impl NewConnectionState { pub fn ssid(&self) -> &str { &match self { - Self::EnterPassword { - access_point, - password: _, - } => access_point, + Self::EnterPassword { access_point, .. } => access_point, Self::Waiting(ap) => ap, Self::Failure(ap) => ap, } @@ -70,10 +68,7 @@ impl NewConnectionState { } pub fn hw_address(&self) -> HwAddress { match self { - Self::EnterPassword { - access_point, - password: _, - } => access_point, + Self::EnterPassword { access_point, .. } => access_point, Self::Waiting(ap) => ap, Self::Failure(ap) => ap, } @@ -84,10 +79,7 @@ impl NewConnectionState { impl From for AccessPoint { fn from(connection_state: NewConnectionState) -> Self { match connection_state { - NewConnectionState::EnterPassword { - access_point, - password: _, - } => access_point, + NewConnectionState::EnterPassword { access_point, .. } => access_point, NewConnectionState::Waiting(access_point) => access_point, NewConnectionState::Failure(access_point) => access_point, } @@ -251,6 +243,7 @@ pub(crate) enum Message { OpenSettings, ResetFailedKnownSsid(String, HwAddress), OpenHwDevice(Option), + TogglePasswordVisibility, // Errored(String), } @@ -432,6 +425,7 @@ impl cosmic::Application for CosmicNetworkApplet { self.new_connection = Some(NewConnectionState::EnterPassword { access_point, password: String::new(), + password_hidden: true, }); } Message::ToggleVisibleNetworks => { @@ -445,6 +439,14 @@ impl cosmic::Application for CosmicNetworkApplet { *password = entered_pw; } } + Message::TogglePasswordVisibility => { + if let Some(NewConnectionState::EnterPassword { + password_hidden, .. + }) = &mut self.new_connection + { + *password_hidden = !*password_hidden; + } + } Message::SubmitPassword => { // save password let tx = if let Some(tx) = self.nm_sender.as_ref() { @@ -456,6 +458,7 @@ impl cosmic::Application for CosmicNetworkApplet { if let Some(NewConnectionState::EnterPassword { password, access_point, + .. }) = self.new_connection.take() { let _ = tx.unbounded_send(NetworkManagerRequest::Password( @@ -965,6 +968,7 @@ impl cosmic::Application for CosmicNetworkApplet { NewConnectionState::EnterPassword { access_point, password, + password_hidden, } => { let id = padded_control( row![ @@ -980,11 +984,15 @@ impl cosmic::Application for CosmicNetworkApplet { let col = padded_control( column![ text::body(fl!("enter-password")), - text_input("", password) - .on_input(Message::Password) - .on_paste(Message::Password) - .on_submit(Message::SubmitPassword) - .password(), + text_input::secure_input( + "", + password, + Some(Message::TogglePasswordVisibility), + *password_hidden, + ) + .on_input(Message::Password) + .on_paste(Message::Password) + .on_submit(Message::SubmitPassword), container(text::body(fl!("router-wps-button"))).padding(8), row![ button::standard(fl!("cancel")) diff --git a/cosmic-applets/Cargo.toml b/cosmic-applets/Cargo.toml index 24d5931a..72dc0264 100644 --- a/cosmic-applets/Cargo.toml +++ b/cosmic-applets/Cargo.toml @@ -20,6 +20,7 @@ cosmic-applet-time = { path = "../cosmic-applet-time" } cosmic-applet-workspaces = { path = "../cosmic-applet-workspaces" } cosmic-applet-input-sources = { path = "../cosmic-applet-input-sources" } cosmic-panel-button = { path = "../cosmic-panel-button" } +libc = "0.2" libcosmic.workspace = true tracing.workspace = true tracing-subscriber.workspace = true diff --git a/cosmic-applets/src/main.rs b/cosmic-applets/src/main.rs index 93b3ec76..a4ed92ca 100644 --- a/cosmic-applets/src/main.rs +++ b/cosmic-applets/src/main.rs @@ -4,6 +4,13 @@ const VERSION: &str = env!("CARGO_PKG_VERSION"); fn main() -> cosmic::iced::Result { + // Prevents glibc from hoarding memory, such as cosmic-applet-minimize + // consuming 100s of megabytes on restoring a minimized window. + #[cfg(target_env = "gnu")] + unsafe { + libc::mallopt(libc::M_MMAP_THRESHOLD, 65536); + } + tracing_subscriber::fmt().with_env_filter("warn").init(); let _ = tracing_log::LogTracer::init(); @@ -32,6 +39,6 @@ fn main() -> cosmic::iced::Result { "cosmic-applet-workspaces" => cosmic_applet_workspaces::run(), "cosmic-applet-input-sources" => cosmic_applet_input_sources::run(), "cosmic-panel-button" => cosmic_panel_button::run(), - _ => return Ok(()), + _ => Ok(()), } }