From 7de52054ff14aa7f918102543483b57ce9764d95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Vojinovi=C4=87?= Date: Thu, 24 Oct 2024 00:15:05 +0200 Subject: [PATCH] chore: update iced/libcosmic --- Cargo.lock | 597 ++++++++++++-------------- src/shell/element/resize_indicator.rs | 49 +-- src/shell/element/stack.rs | 25 +- src/shell/element/stack/tab.rs | 39 +- src/shell/element/stack/tab_text.rs | 2 +- src/shell/element/stack/tabs.rs | 45 +- src/shell/element/stack_hover.rs | 16 +- src/shell/element/swap_indicator.rs | 16 +- src/shell/element/window.rs | 12 +- src/shell/grabs/menu/item.rs | 15 +- src/shell/grabs/menu/mod.rs | 36 +- src/utils/iced.rs | 201 ++++----- 12 files changed, 503 insertions(+), 550 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8b27bc28..8c3446a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -89,7 +89,7 @@ dependencies = [ "log", "ndk", "ndk-context", - "ndk-sys", + "ndk-sys 0.6.0+11769913", "num_enum", "thiserror", ] @@ -168,9 +168,9 @@ checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "as-raw-xcb-connection" @@ -178,22 +178,13 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" -[[package]] -name = "ash" -version = "0.37.3+1.3.251" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e9c3835d686b0a6084ab4234fcd1b07dbf6e4767dce60874b12356a25ecd4a" -dependencies = [ - "libloading 0.7.4", -] - [[package]] name = "ash" version = "0.38.0+1.3.281" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" dependencies = [ - "libloading 0.8.5", + "libloading", ] [[package]] @@ -391,18 +382,18 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bit-set" -version = "0.5.3" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +checksum = "f0481a0e032742109b1133a095184ee93d88f3dc9e0d28a5d033dc77a073f44f" dependencies = [ "bit-vec", ] [[package]] name = "bit-vec" -version = "0.6.3" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +checksum = "d2c54ff287cfc0a34f38a6b832ea1bd8e448a330b3e40a50859e6488bee07f22" [[package]] name = "bit_field" @@ -617,7 +608,7 @@ dependencies = [ [[package]] name = "clipboard_macos" version = "0.1.0" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-dnd-8#7c59b07b9172d8e0401f7e06609e1050575309c9" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" dependencies = [ "objc", "objc-foundation", @@ -627,7 +618,7 @@ dependencies = [ [[package]] name = "clipboard_wayland" version = "0.2.2" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-dnd-8#7c59b07b9172d8e0401f7e06609e1050575309c9" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" dependencies = [ "dnd", "mime 0.1.0", @@ -637,7 +628,7 @@ dependencies = [ [[package]] name = "clipboard_x11" version = "0.4.2" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-dnd-8#7c59b07b9172d8e0401f7e06609e1050575309c9" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" dependencies = [ "thiserror", "x11rb", @@ -871,7 +862,7 @@ dependencies = [ [[package]] name = "cosmic-config" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/#5306649be1cfb6c384da11e2ab25cafc4be79b14" +source = "git+https://github.com/pop-os/libcosmic/#a6db807c1bbffc90b68513171348cad0b4469eac" dependencies = [ "atomicwrites", "calloop 0.14.1", @@ -890,7 +881,7 @@ dependencies = [ [[package]] name = "cosmic-config-derive" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/#5306649be1cfb6c384da11e2ab25cafc4be79b14" +source = "git+https://github.com/pop-os/libcosmic/#a6db807c1bbffc90b68513171348cad0b4469eac" dependencies = [ "quote", "syn 1.0.109", @@ -925,15 +916,15 @@ dependencies = [ [[package]] name = "cosmic-text" version = "0.12.1" -source = "git+https://github.com/pop-os/cosmic-text.git#4fe90bb6126c22f589b46768d7754d65ae300c5e" +source = "git+https://github.com/pop-os/cosmic-text.git#1f4065c1c3399efad58841082212f7c039b58480" dependencies = [ "bitflags 2.6.0", - "fontdb", + "fontdb 0.16.2", "log", "rangemap", "rayon", - "rustc-hash", - "rustybuzz 0.14.1", + "rustc-hash 1.1.0", + "rustybuzz", "self_cell 1.0.4", "smol_str", "swash", @@ -948,7 +939,7 @@ dependencies = [ [[package]] name = "cosmic-theme" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/#5306649be1cfb6c384da11e2ab25cafc4be79b14" +source = "git+https://github.com/pop-os/libcosmic/#a6db807c1bbffc90b68513171348cad0b4469eac" dependencies = [ "almost", "cosmic-config", @@ -1060,11 +1051,12 @@ checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" [[package]] name = "d3d12" -version = "0.19.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdbd1f579714e3c809ebd822c81ef148b1ceaeb3d535352afc73fd0c4c6a0017" dependencies = [ "bitflags 2.6.0", - "libloading 0.8.5", + "libloading", "winapi", ] @@ -1199,7 +1191,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading 0.8.5", + "libloading", ] [[package]] @@ -1214,7 +1206,7 @@ dependencies = [ [[package]] name = "dnd" version = "0.1.0" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-dnd-8#7c59b07b9172d8e0401f7e06609e1050575309c9" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" dependencies = [ "bitflags 2.6.0", "mime 0.1.0", @@ -1223,6 +1215,15 @@ dependencies = [ "smithay-clipboard", ] +[[package]] +name = "document-features" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" +dependencies = [ + "litrs", +] + [[package]] name = "downcast-rs" version = "1.2.1" @@ -1366,7 +1367,7 @@ dependencies = [ "enum-map", "log", "mime_guess2", - "resvg", + "resvg 0.37.0", ] [[package]] @@ -1652,7 +1653,7 @@ dependencies = [ "fluent-syntax", "intl-memoizer", "intl_pluralrules", - "rustc-hash", + "rustc-hash 1.1.0", "self_cell 0.10.3", "smallvec", "unic-langid", @@ -1723,6 +1724,20 @@ dependencies = [ "ttf-parser 0.20.0", ] +[[package]] +name = "fontdb" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e32eac81c1135c1df01d4e6d4233c47ba11f6a6d07f33e0bba09d18797077770" +dependencies = [ + "fontconfig-parser", + "log", + "memmap2 0.9.4", + "slotmap", + "tinyvec", + "ttf-parser 0.21.1", +] + [[package]] name = "foreign-types" version = "0.5.0" @@ -1759,16 +1774,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fraction" -version = "0.15.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f158e3ff0a1b334408dc9fb811cd99b446986f4d8b741bb08f9df1604085ae7" -dependencies = [ - "lazy_static", - "num", -] - [[package]] name = "freedesktop-icons" version = "0.2.6" @@ -1960,16 +1965,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "gif" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80792593675e051cf94a4b111980da2ba60d4a83e43e0048c5693baab3977045" -dependencies = [ - "color_quant", - "weezl", -] - [[package]] name = "gif" version = "0.13.1" @@ -1999,9 +1994,9 @@ dependencies = [ [[package]] name = "glam" -version = "0.24.2" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5418c17512bdf42730f9032c74e1ae39afc408745ebb2acf72fbc4691c17945" +checksum = "151665d9be52f9bb40fc7966565d39666f2d1e69233571b71b87791c7e0528b3" [[package]] name = "glow" @@ -2041,24 +2036,13 @@ dependencies = [ [[package]] name = "glutin_wgl_sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8098adac955faa2d31079b65dc48841251f69efd3ac25477903fc424362ead" +checksum = "0a4e1951bbd9434a81aa496fe59ccc2235af3820d27b85f9314e279609211e2c" dependencies = [ "gl_generator", ] -[[package]] -name = "glyphon" -version = "0.5.0" -source = "git+https://github.com/pop-os/glyphon.git?tag=v0.5.0#1b0646ff8f74da92d3be704dfc2257d7f4d7eed8" -dependencies = [ - "cosmic-text", - "etagere", - "lru", - "wgpu", -] - [[package]] name = "gpu-alloc" version = "0.6.0" @@ -2080,9 +2064,9 @@ dependencies = [ [[package]] name = "gpu-allocator" -version = "0.25.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f56f6318968d03c18e1bcf4857ff88c61157e9da8e47c5f29055d60e1228884" +checksum = "fdd4240fc91d3433d5e5b0fc5b67672d771850dc19bbee03c1381e19322803d7" dependencies = [ "log", "presser", @@ -2093,9 +2077,9 @@ dependencies = [ [[package]] name = "gpu-descriptor" -version = "0.2.4" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc11df1ace8e7e564511f53af41f3e42ddc95b56fd07b3f4445d2a6048bc682c" +checksum = "9c08c1f623a8d0b722b8b99f821eb0ba672a1618f0d3b16ddbee1cedd2dd8557" dependencies = [ "bitflags 2.6.0", "gpu-descriptor-types", @@ -2104,9 +2088,9 @@ dependencies = [ [[package]] name = "gpu-descriptor-types" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bf0b36e6f090b7e1d8a4b49c0cb81c1f8376f72198c65dd3ad9ff3556b8b78c" +checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" dependencies = [ "bitflags 2.6.0", ] @@ -2162,7 +2146,7 @@ dependencies = [ "bitflags 2.6.0", "com", "libc", - "libloading 0.8.5", + "libloading", "thiserror", "widestring", "winapi", @@ -2311,8 +2295,8 @@ dependencies = [ [[package]] name = "iced" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic/#5306649be1cfb6c384da11e2ab25cafc4be79b14" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic/#a6db807c1bbffc90b68513171348cad0b4469eac" dependencies = [ "dnd", "iced_core", @@ -2327,45 +2311,60 @@ dependencies = [ [[package]] name = "iced_core" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic/#5306649be1cfb6c384da11e2ab25cafc4be79b14" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic/#a6db807c1bbffc90b68513171348cad0b4469eac" dependencies = [ "bitflags 2.6.0", + "bytes", "dnd", + "glam", "log", "mime 0.1.0", "num-traits", + "once_cell", "palette", "raw-window-handle", + "rustc-hash 2.0.0", "serde", "smol_str", "thiserror", - "web-time 0.2.4", + "web-time", "window_clipboard", - "xxhash-rust", ] [[package]] name = "iced_futures" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic/#5306649be1cfb6c384da11e2ab25cafc4be79b14" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic/#a6db807c1bbffc90b68513171348cad0b4469eac" dependencies = [ "futures", "iced_core", "log", + "rustc-hash 2.0.0", "wasm-bindgen-futures", "wasm-timer", ] +[[package]] +name = "iced_glyphon" +version = "0.6.0" +source = "git+https://github.com/pop-os/glyphon.git?tag=iced-0.14-dev#6ef9d12a20cfd0f7bdf38136a26ded9f7459ec8b" +dependencies = [ + "cosmic-text", + "etagere", + "lru", + "rustc-hash 2.0.0", + "wgpu", +] + [[package]] name = "iced_graphics" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic/#5306649be1cfb6c384da11e2ab25cafc4be79b14" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic/#a6db807c1bbffc90b68513171348cad0b4469eac" dependencies = [ "bitflags 2.6.0", "bytemuck", "cosmic-text", - "glam", "half", "iced_core", "iced_futures", @@ -2375,16 +2374,15 @@ dependencies = [ "lyon_path", "once_cell", "raw-window-handle", - "rustc-hash", + "rustc-hash 2.0.0", "thiserror", "unicode-segmentation", - "xxhash-rust", ] [[package]] name = "iced_renderer" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic/#5306649be1cfb6c384da11e2ab25cafc4be79b14" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic/#a6db807c1bbffc90b68513171348cad0b4469eac" dependencies = [ "iced_graphics", "iced_tiny_skia", @@ -2395,63 +2393,56 @@ dependencies = [ [[package]] name = "iced_runtime" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic/#5306649be1cfb6c384da11e2ab25cafc4be79b14" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic/#a6db807c1bbffc90b68513171348cad0b4469eac" dependencies = [ + "bytes", "dnd", "iced_core", "iced_futures", + "raw-window-handle", "thiserror", "window_clipboard", ] -[[package]] -name = "iced_style" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic/#5306649be1cfb6c384da11e2ab25cafc4be79b14" -dependencies = [ - "iced_core", - "once_cell", - "palette", -] - [[package]] name = "iced_tiny_skia" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic/#5306649be1cfb6c384da11e2ab25cafc4be79b14" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic/#a6db807c1bbffc90b68513171348cad0b4469eac" dependencies = [ "bytemuck", "cosmic-text", "iced_graphics", - "kurbo", + "kurbo 0.10.4", "log", - "resvg", - "rustc-hash", + "resvg 0.42.0", + "rustc-hash 2.0.0", "softbuffer", "tiny-skia", - "xxhash-rust", ] [[package]] name = "iced_wgpu" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic/#5306649be1cfb6c384da11e2ab25cafc4be79b14" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic/#a6db807c1bbffc90b68513171348cad0b4469eac" dependencies = [ "as-raw-xcb-connection", "bitflags 2.6.0", "bytemuck", "futures", "glam", - "glyphon", "guillotiere", + "iced_glyphon", "iced_graphics", "log", "lyon", "once_cell", "raw-window-handle", - "resvg", + "resvg 0.42.0", + "rustc-hash 2.0.0", "rustix", "smithay-client-toolkit", + "thiserror", "tiny-xlib", "wayland-backend", "wayland-client", @@ -2463,15 +2454,16 @@ dependencies = [ [[package]] name = "iced_widget" -version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic/#5306649be1cfb6c384da11e2ab25cafc4be79b14" +version = "0.14.0-dev" +source = "git+https://github.com/pop-os/libcosmic/#a6db807c1bbffc90b68513171348cad0b4469eac" dependencies = [ "dnd", "iced_renderer", "iced_runtime", - "iced_style", "num-traits", + "once_cell", "ouroboros", + "rustc-hash 2.0.0", "thiserror", "unicode-segmentation", "window_clipboard", @@ -2511,7 +2503,7 @@ dependencies = [ "byteorder", "color_quant", "exr", - "gif 0.13.1", + "gif", "jpeg-decoder", "num-traits", "png", @@ -2631,6 +2623,15 @@ version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a611371471e98973dbcab4e0ec66c31a10bc356eeb4d54a0e05eac8158fe38c" +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -2712,7 +2713,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" dependencies = [ "libc", - "libloading 0.8.5", + "libloading", "pkg-config", ] @@ -2760,6 +2761,26 @@ dependencies = [ "arrayvec", ] +[[package]] +name = "kurbo" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1618d4ebd923e97d67e7cd363d80aef35fe961005cbbbb3d2dad8bdd1bc63440" +dependencies = [ + "arrayvec", + "smallvec", +] + +[[package]] +name = "kurbo" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89234b2cc610a7dd927ebde6b41dd1a5d4214cffaef4cf1fb2195d592f92518f" +dependencies = [ + "arrayvec", + "smallvec", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -2781,7 +2802,7 @@ checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libcosmic" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/#5306649be1cfb6c384da11e2ab25cafc4be79b14" +source = "git+https://github.com/pop-os/libcosmic/#a6db807c1bbffc90b68513171348cad0b4469eac" dependencies = [ "apply", "chrono", @@ -2789,14 +2810,12 @@ dependencies = [ "cosmic-theme", "css-color", "derive_setters", - "fraction", "freedesktop-icons", "iced", "iced_core", "iced_futures", "iced_renderer", "iced_runtime", - "iced_style", "iced_tiny_skia", "iced_widget", "lazy_static", @@ -2811,16 +2830,6 @@ dependencies = [ "ustr", ] -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - [[package]] name = "libloading" version = "0.8.5" @@ -2828,7 +2837,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -2918,6 +2927,12 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0b5399f6804fbab912acbd8878ed3532d506b7c951b8f9f164ef90fef39e3f4" +[[package]] +name = "litrs" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" + [[package]] name = "locale_config" version = "0.3.0" @@ -2975,9 +2990,6 @@ name = "lru" version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" -dependencies = [ - "hashbrown 0.14.5", -] [[package]] name = "lyon" @@ -3084,9 +3096,9 @@ dependencies = [ [[package]] name = "metal" -version = "0.27.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25" +checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21" dependencies = [ "bitflags 2.6.0", "block", @@ -3100,7 +3112,7 @@ dependencies = [ [[package]] name = "mime" version = "0.1.0" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-dnd-8#7c59b07b9172d8e0401f7e06609e1050575309c9" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" dependencies = [ "smithay-clipboard", ] @@ -3163,18 +3175,19 @@ checksum = "16cf681a23b4d0a43fc35024c176437f9dcd818db34e0f42ab456a0ee5ad497b" [[package]] name = "naga" -version = "0.19.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109" +version = "22.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bd5a652b6faf21496f2cfd88fc49989c8db0825d1f6746b1a71a6ede24a63ad" dependencies = [ "arrayvec", "bit-set", "bitflags 2.6.0", + "cfg_aliases 0.1.1", "codespan-reporting", "hexf-parse", "indexmap 2.3.0", "log", - "num-traits", - "rustc-hash", + "rustc-hash 1.1.0", "spirv", "termcolor", "thiserror", @@ -3190,7 +3203,7 @@ dependencies = [ "bitflags 2.6.0", "jni-sys", "log", - "ndk-sys", + "ndk-sys 0.6.0+11769913", "num_enum", "raw-window-handle", "thiserror", @@ -3202,6 +3215,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" +[[package]] +name = "ndk-sys" +version = "0.5.0+25.2.9519653" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" +dependencies = [ + "jni-sys", +] + [[package]] name = "ndk-sys" version = "0.6.0+11769913" @@ -3281,76 +3303,12 @@ dependencies = [ "winapi", ] -[[package]] -name = "num" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" -dependencies = [ - "num-bigint", - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-complex" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" -dependencies = [ - "num-traits", -] - [[package]] name = "num-conv" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -3408,7 +3366,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" dependencies = [ "malloc_buf", - "objc_exception", ] [[package]] @@ -3625,15 +3582,6 @@ dependencies = [ "objc2-foundation", ] -[[package]] -name = "objc_exception" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" -dependencies = [ - "cc", -] - [[package]] name = "objc_id" version = "0.1.1" @@ -3704,9 +3652,9 @@ dependencies = [ [[package]] name = "ouroboros" -version = "0.17.2" +version = "0.18.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2ba07320d39dfea882faa70554b4bd342a5f273ed59ba7c1c6b4c840492c954" +checksum = "944fa20996a25aded6b4795c6d63f10014a7a83f8be9828a11860b08c5fc4a67" dependencies = [ "aliasable", "ouroboros_macro", @@ -3715,13 +3663,14 @@ dependencies = [ [[package]] name = "ouroboros_macro" -version = "0.17.2" +version = "0.18.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec4c6225c69b4ca778c0aea097321a64c421cf4577b331c61b229267edabb6f8" +checksum = "39b0deead1528fd0e5947a8546a9642a9777c25f6e1e26f34c97b204bbb465bd" dependencies = [ "heck", - "proc-macro-error", + "itertools", "proc-macro2", + "proc-macro2-diagnostics", "quote", "syn 2.0.72", ] @@ -3871,7 +3820,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" dependencies = [ - "siphasher", + "siphasher 0.3.11", ] [[package]] @@ -4038,6 +3987,19 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proc-macro2-diagnostics" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", + "version_check", + "yansi", +] + [[package]] name = "profiling" version = "1.0.15" @@ -4273,15 +4235,28 @@ version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cadccb3d99a9efb8e5e00c16fbb732cbe400db2ec7fc004697ee7d97d86cf1f4" dependencies = [ - "gif 0.12.0", + "log", + "pico-args", + "rgb", + "svgtypes 0.13.0", + "tiny-skia", + "usvg 0.37.0", +] + +[[package]] +name = "resvg" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "944d052815156ac8fa77eaac055220e95ba0b01fa8887108ca710c03805d9051" +dependencies = [ + "gif", "jpeg-decoder", "log", "pico-args", - "png", "rgb", - "svgtypes", + "svgtypes 0.15.2", "tiny-skia", - "usvg", + "usvg 0.42.0", ] [[package]] @@ -4373,6 +4348,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustix" version = "0.38.34" @@ -4392,22 +4373,6 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" -[[package]] -name = "rustybuzz" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0ae5692c5beaad6a9e22830deeed7874eae8a4e3ba4076fb48e12c56856222c" -dependencies = [ - "bitflags 2.6.0", - "bytemuck", - "smallvec", - "ttf-parser 0.20.0", - "unicode-bidi-mirroring 0.1.0", - "unicode-ccc 0.1.2", - "unicode-properties", - "unicode-script", -] - [[package]] name = "rustybuzz" version = "0.14.1" @@ -4419,8 +4384,8 @@ dependencies = [ "libm", "smallvec", "ttf-parser 0.21.1", - "unicode-bidi-mirroring 0.2.0", - "unicode-ccc 0.2.0", + "unicode-bidi-mirroring", + "unicode-ccc", "unicode-properties", "unicode-script", ] @@ -4630,6 +4595,12 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "skrifa" version = "0.20.0" @@ -4670,7 +4641,7 @@ version = "0.3.0" source = "git+https://github.com/smithay//smithay?rev=bc1d732#bc1d7320f95cdf17f9e7aa6867cccc5903548032" dependencies = [ "appendlist", - "ash 0.38.0+1.3.281", + "ash", "bitflags 2.6.0", "calloop 0.14.1", "cc", @@ -4688,7 +4659,7 @@ dependencies = [ "indexmap 2.3.0", "input", "libc", - "libloading 0.8.5", + "libloading", "libseat", "once_cell", "pixman", @@ -4877,8 +4848,18 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e44e288cd960318917cbd540340968b90becc8bc81f171345d706e7a89d9d70" dependencies = [ - "kurbo", - "siphasher", + "kurbo 0.9.5", + "siphasher 0.3.11", +] + +[[package]] +name = "svgtypes" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "794de53cc48eaabeed0ab6a3404a65f40b3e38c067e4435883a65d2aa4ca000e" +dependencies = [ + "kurbo 0.11.1", + "siphasher 1.0.1", ] [[package]] @@ -5072,7 +5053,7 @@ checksum = "1d52f22673960ad13af14ff4025997312def1223bfa7c8e4949d099e6b3d5d1c" dependencies = [ "as-raw-xcb-connection", "ctor-lite", - "libloading 0.8.5", + "libloading", "pkg-config", "tracing", ] @@ -5272,7 +5253,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deb68604048ff8fa93347f02441e4487594adc20bb8a084f9e564d2b827a0a9f" dependencies = [ - "rustc-hash", + "rustc-hash 1.1.0", ] [[package]] @@ -5338,24 +5319,12 @@ version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" -[[package]] -name = "unicode-bidi-mirroring" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56d12260fb92d52f9008be7e4bca09f584780eb2266dc8fecc6a192bec561694" - [[package]] name = "unicode-bidi-mirroring" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23cb788ffebc92c5948d0e997106233eeb1d8b9512f93f41651f52b6c5f5af86" -[[package]] -name = "unicode-ccc" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2520efa644f8268dce4dcd3050eaa7fc044fca03961e9998ac7e2e92b77cf1" - [[package]] name = "unicode-ccc" version = "0.2.0" @@ -5453,42 +5422,52 @@ dependencies = [ "log", "pico-args", "usvg-parser", - "usvg-text-layout", "usvg-tree", "xmlwriter", ] [[package]] -name = "usvg-parser" -version = "0.37.0" +name = "usvg" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd4e3c291f45d152929a31f0f6c819245e2921bfd01e7bd91201a9af39a2bdc" +checksum = "b84ea542ae85c715f07b082438a4231c3760539d902e11d093847a0b22963032" dependencies = [ + "base64 0.22.1", "data-url", "flate2", + "fontdb 0.18.0", "imagesize", - "kurbo", + "kurbo 0.11.1", "log", - "roxmltree 0.19.0", + "pico-args", + "roxmltree 0.20.0", + "rustybuzz", "simplecss", - "siphasher", - "svgtypes", - "usvg-tree", + "siphasher 1.0.1", + "strict-num", + "svgtypes 0.15.2", + "tiny-skia-path", + "unicode-bidi", + "unicode-script", + "unicode-vo", + "xmlwriter", ] [[package]] -name = "usvg-text-layout" +name = "usvg-parser" version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d383a3965de199d7f96d4e11a44dd859f46e86de7f3dca9a39bf82605da0a37c" +checksum = "9bd4e3c291f45d152929a31f0f6c819245e2921bfd01e7bd91201a9af39a2bdc" dependencies = [ - "fontdb", - "kurbo", + "data-url", + "flate2", + "imagesize", + "kurbo 0.9.5", "log", - "rustybuzz 0.12.1", - "unicode-bidi", - "unicode-script", - "unicode-vo", + "roxmltree 0.19.0", + "simplecss", + "siphasher 0.3.11", + "svgtypes 0.13.0", "usvg-tree", ] @@ -5500,7 +5479,7 @@ checksum = "8ee3d202ebdb97a6215604b8f5b4d6ef9024efd623cf2e373a6416ba976ec7d3" dependencies = [ "rctree", "strict-num", - "svgtypes", + "svgtypes 0.13.0", "tiny-skia-path", ] @@ -5781,16 +5760,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "web-time" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa30049b1c872b72c89866d458eae9f20380ab280ffd1b1e18df2d3e2d98cfe0" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "web-time" version = "1.1.0" @@ -5809,12 +5778,13 @@ checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" [[package]] name = "wgpu" -version = "0.19.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109" +version = "22.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d1c4ba43f80542cf63a0a6ed3134629ae73e8ab51e4b765a67f3aa062eb433" dependencies = [ "arrayvec", - "cfg-if", "cfg_aliases 0.1.1", + "document-features", "js-sys", "log", "naga", @@ -5833,14 +5803,15 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "0.19.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109" +version = "22.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0348c840d1051b8e86c3bcd31206080c5e71e5933dabd79be1ce732b0b2f089a" dependencies = [ "arrayvec", "bit-vec", "bitflags 2.6.0", "cfg_aliases 0.1.1", - "codespan-reporting", + "document-features", "indexmap 2.3.0", "log", "naga", @@ -5848,22 +5819,22 @@ dependencies = [ "parking_lot 0.12.3", "profiling", "raw-window-handle", - "rustc-hash", + "rustc-hash 1.1.0", "smallvec", "thiserror", - "web-sys", "wgpu-hal", "wgpu-types", ] [[package]] name = "wgpu-hal" -version = "0.19.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6bbf4b4de8b2a83c0401d9e5ae0080a2792055f25859a02bf9be97952bbed4f" dependencies = [ "android_system_properties", "arrayvec", - "ash 0.37.3+1.3.251", + "ash", "bit-set", "bitflags 2.6.0", "block", @@ -5879,10 +5850,11 @@ dependencies = [ "js-sys", "khronos-egl", "libc", - "libloading 0.8.5", + "libloading", "log", "metal", "naga", + "ndk-sys 0.5.0+25.2.9519653", "objc", "once_cell", "parking_lot 0.12.3", @@ -5890,7 +5862,7 @@ dependencies = [ "range-alloc", "raw-window-handle", "renderdoc-sys", - "rustc-hash", + "rustc-hash 1.1.0", "smallvec", "thiserror", "wasm-bindgen", @@ -5901,8 +5873,9 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "0.19.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=20fda69#20fda698341efbdc870b8027d6d49f5bf3f36109" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc9d91f0e2c4b51434dfa6db77846f2793149d8e73f800fa2e41f52b8eac3c5d" dependencies = [ "bitflags 2.6.0", "js-sys", @@ -5949,7 +5922,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "window_clipboard" version = "0.4.1" -source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-dnd-8#7c59b07b9172d8e0401f7e06609e1050575309c9" +source = "git+https://github.com/pop-os/window_clipboard.git?tag=pop-0.13#a83bf83784276aaa882ef13555295a2ad9edd265" dependencies = [ "clipboard-win", "clipboard_macos", @@ -6293,7 +6266,7 @@ dependencies = [ "wayland-protocols", "wayland-protocols-plasma", "web-sys", - "web-time 1.1.0", + "web-time", "windows-sys 0.52.0", "x11-dl", "x11rb", @@ -6338,7 +6311,7 @@ dependencies = [ "as-raw-xcb-connection", "gethostname", "libc", - "libloading 0.8.5", + "libloading", "once_cell", "rustix", "x11rb-protocol", @@ -6439,10 +6412,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" [[package]] -name = "xxhash-rust" -version = "0.8.12" +name = "yansi" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a5cbf750400958819fb6178eaa83bee5cd9c29a26a40cc241df8c70fdd46984" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" [[package]] name = "yazi" diff --git a/src/shell/element/resize_indicator.rs b/src/shell/element/resize_indicator.rs index 99c975ea..21f73428 100644 --- a/src/shell/element/resize_indicator.rs +++ b/src/shell/element/resize_indicator.rs @@ -9,7 +9,10 @@ use crate::{ use calloop::LoopHandle; use cosmic::{ - iced::widget::{column, container, horizontal_space, row, vertical_space}, + iced::{ + widget::{column, container, horizontal_space, row, vertical_space}, + Alignment, + }, iced_core::{Background, Border, Color, Length}, theme, widget::{icon::from_name, text}, @@ -66,7 +69,7 @@ impl Program for ResizeIndicatorInternal { fn view(&self) -> cosmic::Element<'_, Self::Message> { let edges = self.edges.lock().unwrap(); let icon_container_style = || { - theme::Container::custom(|theme| container::Appearance { + theme::Container::custom(|theme| container::Style { icon_color: Some(Color::from(theme.cosmic().accent.on)), text_color: Some(Color::from(theme.cosmic().accent.on)), background: Some(Background::Color(theme.cosmic().accent_color().into())), @@ -90,14 +93,13 @@ impl Program for ResizeIndicatorInternal { .prefer_svg(true) .apply(container) .padding(8) - .style(icon_container_style()) + .class(icon_container_style()) .width(Length::Shrink) .apply(container) - .center_x() - .width(Length::Fill) + .center_x(Length::Fill) .into() } else { - vertical_space(36).into() + vertical_space().height(36).into() }, row(vec![ if edges.contains(ResizeEdge::LEFT) { @@ -110,35 +112,32 @@ impl Program for ResizeIndicatorInternal { .prefer_svg(true) .apply(container) .padding(8) - .style(icon_container_style()) + .class(icon_container_style()) .width(Length::Shrink) .apply(container) - .center_y() - .height(Length::Fill) + .center_y(Length::Fill) .into() } else { - horizontal_space(36).into() + horizontal_space().width(36).into() }, row(vec![ text::heading(&self.shortcut1).into(), text::body(fl!("grow-window")).into(), - horizontal_space(40).into(), + horizontal_space().width(40).into(), text::heading(&self.shortcut2).into(), text::body(fl!("shrink-window")).into(), ]) .apply(container) - .center_x() - .center_y() + .align_x(Alignment::Center) + .align_y(Alignment::Center) .padding(16) .apply(container) - .style(icon_container_style()) + .class(icon_container_style()) .width(Length::Shrink) .height(Length::Shrink) .apply(container) - .height(Length::Fill) - .width(Length::Fill) - .center_x() - .center_y() + .center_x(Length::Fill) + .center_y(Length::Fill) .into(), if edges.contains(ResizeEdge::RIGHT) { from_name(if self.direction == ResizeDirection::Outwards { @@ -150,14 +149,13 @@ impl Program for ResizeIndicatorInternal { .prefer_svg(true) .apply(container) .padding(8) - .style(icon_container_style()) + .class(icon_container_style()) .height(Length::Shrink) .apply(container) - .center_y() - .height(Length::Fill) + .center_y(Length::Fill) .into() } else { - horizontal_space(36).into() + horizontal_space().width(36).into() }, ]) .width(Length::Fill) @@ -173,14 +171,13 @@ impl Program for ResizeIndicatorInternal { .prefer_svg(true) .apply(container) .padding(8) - .style(icon_container_style()) + .class(icon_container_style()) .width(Length::Shrink) .apply(container) - .center_x() - .width(Length::Fill) + .center_x(Length::Fill) .into() } else { - vertical_space(36).into() + vertical_space().height(36).into() }, ]) .into() diff --git a/src/shell/element/stack.rs b/src/shell/element/stack.rs index 484caac7..90ae4d22 100644 --- a/src/shell/element/stack.rs +++ b/src/shell/element/stack.rs @@ -14,9 +14,9 @@ use crate::{ }; use calloop::LoopHandle; use cosmic::{ - iced::{id::Id, widget as iced_widget}, + iced::{id::Id, widget as iced_widget, Alignment}, iced_core::{border::Radius, Background, Border, Color, Length}, - iced_runtime::Command, + iced_runtime::Task, iced_widget::scrollable::AbsoluteOffset, theme, widget as cosmic_widget, Apply, Element as CosmicElement, Theme, }; @@ -712,7 +712,7 @@ impl Program for CosmicStackInternal { &mut self, message: Self::Message, loop_handle: &LoopHandle<'static, crate::state::State>, - ) -> Command { + ) -> Task { match message { Message::DragStart => { if let Some((seat, serial)) = self.last_seat.lock().unwrap().clone() { @@ -874,7 +874,7 @@ impl Program for CosmicStackInternal { } _ => unreachable!(), } - Command::none() + Task::none() } fn view(&self) -> CosmicElement<'_, Self::Message> { @@ -890,8 +890,8 @@ impl Program for CosmicStackInternal { .size(16) .prefer_svg(true) .icon() - .style(if group_focused { - theme::Svg::custom(|theme| iced_widget::svg::Appearance { + .class(if group_focused { + theme::Svg::custom(|theme| iced_widget::svg::Style { color: Some(if theme.cosmic().is_dark { Color::BLACK } else { @@ -903,7 +903,7 @@ impl Program for CosmicStackInternal { }) .apply(iced_widget::container) .padding([4, 24]) - .center_y() + .align_y(Alignment::Center) .apply(iced_widget::mouse_area) .on_press(Message::DragStart) .on_right_press(Message::Menu) @@ -935,7 +935,8 @@ impl Program for CosmicStackInternal { .height(Length::Fill) .width(Length::Fill), ), - iced_widget::horizontal_space(0) + iced_widget::horizontal_space() + .width(Length::Fixed(0.0)) .apply(iced_widget::container) .padding([64, 24]) .apply(iced_widget::mouse_area) @@ -953,10 +954,10 @@ impl Program for CosmicStackInternal { iced_widget::row(elements) .height(TAB_HEIGHT as u16) - .width(Length::Fill) //width as u16) + .width(Length::Fill) .apply(iced_widget::container) - .center_y() - .style(theme::Container::custom(move |theme| { + .align_y(Alignment::Center) + .class(theme::Container::custom(move |theme| { let background = if group_focused { Some(Background::Color(theme.cosmic().accent_color().into())) } else { @@ -965,7 +966,7 @@ impl Program for CosmicStackInternal { ))) }; - iced_widget::container::Appearance { + iced_widget::container::Style { icon_color: Some(Color::from(theme.cosmic().background.on)), text_color: Some(Color::from(theme.cosmic().background.on)), background, diff --git a/src/shell/element/stack/tab.rs b/src/shell/element/stack/tab.rs index 9d6dfd6c..f3532a72 100644 --- a/src/shell/element/stack/tab.rs +++ b/src/shell/element/stack/tab.rs @@ -5,11 +5,7 @@ use cosmic::{ alignment, event, layout::{Layout, Limits, Node}, mouse, overlay, renderer, - widget::{ - operation::{Operation, OperationOutputWrapper}, - tree::Tree, - Id, Widget, - }, + widget::{operation::Operation, tree::Tree, Id, Widget}, Border, Clipboard, Color, Length, Rectangle, Shell, Size, }, iced_widget::scrollable::AbsoluteOffset, @@ -54,19 +50,19 @@ pub(super) enum TabRuleTheme { impl From for theme::Rule { fn from(theme: TabRuleTheme) -> Self { match theme { - TabRuleTheme::ActiveActivated => Self::custom(|theme| widget::rule::Appearance { + TabRuleTheme::ActiveActivated => Self::custom(|theme| widget::rule::Style { color: theme.cosmic().accent_color().into(), width: 4, radius: 0.0.into(), fill_mode: FillMode::Full, }), - TabRuleTheme::ActiveDeactivated => Self::custom(|theme| widget::rule::Appearance { + TabRuleTheme::ActiveDeactivated => Self::custom(|theme| widget::rule::Style { color: theme.cosmic().palette.neutral_5.into(), width: 4, radius: 0.0.into(), fill_mode: FillMode::Full, }), - TabRuleTheme::Default => Self::custom(|theme| widget::rule::Appearance { + TabRuleTheme::Default => Self::custom(|theme| widget::rule::Style { color: theme.cosmic().palette.neutral_5.into(), width: 4, radius: 8.0.into(), @@ -96,11 +92,11 @@ impl TabBackgroundTheme { } } -impl From for theme::Container { +impl From for theme::Container<'_> { fn from(background_theme: TabBackgroundTheme) -> Self { match background_theme { TabBackgroundTheme::ActiveActivated => { - Self::custom(move |theme| widget::container::Appearance { + Self::custom(move |theme| widget::container::Style { icon_color: Some(Color::from(theme.cosmic().accent_text_color())), text_color: Some(Color::from(theme.cosmic().accent_text_color())), background: Some(background_theme.background_color(theme).into()), @@ -113,7 +109,7 @@ impl From for theme::Container { }) } TabBackgroundTheme::ActiveDeactivated => { - Self::custom(move |theme| widget::container::Appearance { + Self::custom(move |theme| widget::container::Style { icon_color: None, text_color: None, background: Some(background_theme.background_color(theme).into()), @@ -215,20 +211,19 @@ impl Tab { .icon() .apply(widget::button) .padding(0) - .style(theme::iced::Button::Text); + .class(theme::iced::Button::Text); if let Some(close_message) = self.close_message { close_button = close_button.on_press(close_message); } let items = vec![ - widget::vertical_rule(4).style(self.rule_theme).into(), + widget::vertical_rule(4).class(self.rule_theme).into(), self.app_icon .clone() .apply(widget::container) - .height(Length::Fill) .width(Length::Shrink) .padding([2, 4]) - .center_y() + .center_y(Length::Fill) .into(), tab_text(self.title, self.active) .font(self.font) @@ -238,10 +233,9 @@ impl Tab { .into(), close_button .apply(widget::container) - .height(Length::Fill) .width(Length::Shrink) .padding([2, 4]) - .center_y() + .center_y(Length::Fill) .align_x(alignment::Horizontal::Right) .into(), ]; @@ -269,7 +263,7 @@ pub(super) struct TabInternal<'a, Message: TabMessage> { id: Id, idx: usize, active: bool, - background: theme::Container, + background: theme::Container<'a>, elements: Vec>, press_message: Option, right_click_message: Option, @@ -347,7 +341,7 @@ where tree: &mut Tree, layout: Layout<'_>, renderer: &cosmic::Renderer, - operation: &mut dyn Operation>, + operation: &mut dyn Operation<()>, ) { operation.container(None, layout.bounds(), &mut |operation| { self.elements @@ -454,8 +448,8 @@ where cursor: mouse::Cursor, viewport: &Rectangle, ) { - use cosmic::widget::container::StyleSheet; - let style = theme.appearance(&self.background); + use cosmic::widget::container::Catalog; + let style = theme.style(&self.background); draw_background(renderer, &style, layout.bounds()); @@ -486,7 +480,8 @@ where tree: &'b mut Tree, layout: Layout<'_>, renderer: &cosmic::Renderer, + translation: cosmic::iced::Vector, ) -> Option> { - overlay::from_children(&mut self.elements, tree, layout, renderer) + overlay::from_children(&mut self.elements, tree, layout, renderer, translation) } } diff --git a/src/shell/element/stack/tab_text.rs b/src/shell/element/stack/tab_text.rs index 185edf59..d3a136a5 100644 --- a/src/shell/element/stack/tab_text.rs +++ b/src/shell/element/stack/tab_text.rs @@ -84,7 +84,7 @@ impl TabText { vertical_alignment: alignment::Vertical::Center, shaping: Shaping::Advanced, line_height: LineHeight::default(), - wrap: cosmic::iced::advanced::text::Wrap::None, + wrapping: cosmic::iced::advanced::text::Wrapping::None, }) } } diff --git a/src/shell/element/stack/tabs.rs b/src/shell/element/stack/tabs.rs index 08aa329b..bf4a096d 100644 --- a/src/shell/element/stack/tabs.rs +++ b/src/shell/element/stack/tabs.rs @@ -8,7 +8,7 @@ use cosmic::{ widget::{ operation::{ scrollable::{AbsoluteOffset, RelativeOffset}, - Operation, OperationOutputWrapper, Scrollable, + Operation, Scrollable, }, tree::{self, Tree}, Widget, @@ -16,10 +16,9 @@ use cosmic::{ Background, Border, Clipboard, Color, Length, Point, Rectangle, Renderer, Shell, Size, Vector, }, - iced_style::container::StyleSheet as ContainerStyleSheet, iced_widget::container::draw_background, theme, - widget::icon::from_name, + widget::{container::Catalog, icon::from_name}, Apply, }; use keyframe::{ @@ -45,6 +44,7 @@ struct ScrollAnimationState { start_time: Instant, start: Offset, end: Offset, + extra: Offset, } #[derive(Debug, Clone)] @@ -75,9 +75,24 @@ impl Scrollable for State { start_time: Instant::now(), start: self.offset_x, end: new_offset, + extra: Offset::Absolute(0.), }); self.offset_x = new_offset; } + + fn scroll_by( + &mut self, + offset: AbsoluteOffset, + _bounds: Rectangle, + _content_bounds: Rectangle, + ) { + self.scroll_animation = Some(ScrollAnimationState { + start_time: Instant::now(), + start: self.offset_x, + end: self.offset_x, + extra: Offset::Absolute(offset.x.max(0.0)), + }); + } } impl Default for State { @@ -145,7 +160,7 @@ where Element::new(tab.internal(i)) }); - let tabs_rule = widget::vertical_rule(4).style(if tabs.len() - 1 == active { + let tabs_rule = widget::vertical_rule(4).class(if tabs.len() - 1 == active { if activated { TabRuleTheme::ActiveActivated } else { @@ -166,7 +181,7 @@ where .prefer_svg(true) .icon() .apply(widget::button) - .style(theme::iced::Button::Text) + .class(theme::iced::Button::Text) .on_press(Message::scroll_back()); let next_button = from_name("go-next-symbolic") @@ -174,17 +189,17 @@ where .prefer_svg(true) .icon() .apply(widget::button) - .style(theme::iced::Button::Text) + .class(theme::iced::Button::Text) .on_press(Message::scroll_further()); let mut elements = Vec::with_capacity(tabs.len() + 5); - elements.push(widget::vertical_rule(4).style(rule_style).into()); + elements.push(widget::vertical_rule(4).class(rule_style).into()); elements.push(prev_button.into()); elements.extend(tabs); elements.push(tabs_rule.into()); elements.push(next_button.into()); - elements.push(widget::vertical_rule(4).style(rule_style).into()); + elements.push(widget::vertical_rule(4).class(rule_style).into()); Tabs { elements, @@ -239,6 +254,7 @@ impl State { Vector::new( animation.start.absolute(bounds.width, content_bounds.width) + + animation.extra.absolute(bounds.width, content_bounds.width) * percentage + (animation.end.absolute(bounds.width, content_bounds.width) - animation.start.absolute(bounds.width, content_bounds.width)) * percentage, @@ -490,9 +506,9 @@ where height: b.bounds().height, }); - let background_style = ContainerStyleSheet::appearance( + let background_style = Catalog::style( theme, - &theme::Container::custom(|theme| widget::container::Appearance { + &theme::Container::custom(|theme| widget::container::Style { icon_color: None, text_color: None, background: Some(Background::Color(super::tab::primary_container_color( @@ -666,10 +682,12 @@ where tree: &mut Tree, layout: Layout<'_>, renderer: &cosmic::Renderer, - operation: &mut dyn Operation>, + operation: &mut dyn Operation<()>, ) { let state = tree.state.downcast_mut::(); let bounds = layout.bounds(); + let content_layout = layout.children().next().unwrap(); + let content_bounds = content_layout.bounds(); state.cleanup_old_animations(); @@ -677,6 +695,7 @@ where state, self.id.as_ref(), bounds, + content_bounds, Vector { x: 0.0, y: 0.0 }, /* seemingly unused */ ); @@ -819,6 +838,7 @@ where start_time: Instant::now(), start: Offset::Absolute(offset.x), end: Offset::Absolute(new_offset.x), + extra: Offset::Absolute(0.), }); state.offset_x = Offset::Absolute(new_offset.x); } @@ -993,7 +1013,8 @@ where tree: &'b mut Tree, layout: Layout<'_>, renderer: &cosmic::Renderer, + translation: cosmic::iced::Vector, ) -> Option> { - overlay::from_children(&mut self.elements, tree, layout, renderer) + overlay::from_children(&mut self.elements, tree, layout, renderer, translation) } } diff --git a/src/shell/element/stack_hover.rs b/src/shell/element/stack_hover.rs index 26177bfd..a260f9ea 100644 --- a/src/shell/element/stack_hover.rs +++ b/src/shell/element/stack_hover.rs @@ -38,16 +38,16 @@ impl Program for StackHoverInternal { .prefer_svg(true) .icon() .into(), - horizontal_space(16).into(), + horizontal_space().width(16).into(), text::title3(fl!("stack-windows")).into(), ]) - .align_items(Alignment::Center) + .align_y(Alignment::Center) .apply(container) - .center_x() - .center_y() + .align_x(Alignment::Center) + .align_y(Alignment::Center) .padding(16) .apply(container) - .style(theme::Container::custom(|theme| container::Appearance { + .class(theme::Container::custom(|theme| container::Style { icon_color: Some(Color::from(theme.cosmic().accent.on)), text_color: Some(Color::from(theme.cosmic().accent.on)), background: Some(Background::Color(theme.cosmic().accent_color().into())), @@ -61,10 +61,8 @@ impl Program for StackHoverInternal { .width(Length::Shrink) .height(Length::Shrink) .apply(container) - .width(Length::Fill) - .height(Length::Fill) - .center_x() - .center_y() + .center_x(Length::Fill) + .center_y(Length::Fill) .into() } } diff --git a/src/shell/element/swap_indicator.rs b/src/shell/element/swap_indicator.rs index 713af6a2..13033b00 100644 --- a/src/shell/element/swap_indicator.rs +++ b/src/shell/element/swap_indicator.rs @@ -34,16 +34,16 @@ impl Program for SwapIndicatorInternal { .prefer_svg(true) .icon() .into(), - horizontal_space(16).into(), + horizontal_space().width(16).into(), text::title3(fl!("swap-windows")).into(), ]) - .align_items(Alignment::Center) + .align_y(Alignment::Center) .apply(container) - .center_x() - .center_y() + .align_x(Alignment::Center) + .align_y(Alignment::Center) .padding(16) .apply(container) - .style(theme::Container::custom(|theme| container::Appearance { + .class(theme::Container::custom(|theme| container::Style { icon_color: Some(Color::from(theme.cosmic().accent.on)), text_color: Some(Color::from(theme.cosmic().accent.on)), background: Some(Background::Color(theme.cosmic().accent_color().into())), @@ -57,10 +57,8 @@ impl Program for SwapIndicatorInternal { .width(Length::Shrink) .height(Length::Shrink) .apply(container) - .height(Length::Fill) - .width(Length::Fill) - .center_x() - .center_y() + .center_x(Length::Fill) + .center_y(Length::Fill) .into() } } diff --git a/src/shell/element/window.rs b/src/shell/element/window.rs index dd43457d..c88c6121 100644 --- a/src/shell/element/window.rs +++ b/src/shell/element/window.rs @@ -11,7 +11,7 @@ use crate::{ }, }; use calloop::LoopHandle; -use cosmic::iced::{Color, Command}; +use cosmic::iced::{Color, Task}; use smithay::{ backend::{ input::KeyState, @@ -404,7 +404,7 @@ impl Program for CosmicWindowInternal { &mut self, message: Self::Message, loop_handle: &LoopHandle<'static, crate::state::State>, - ) -> Command { + ) -> Task { match message { Message::DragStart => { if let Some((seat, serial)) = self.last_seat.lock().unwrap().clone() { @@ -504,7 +504,7 @@ impl Program for CosmicWindowInternal { } } } - Command::none() + Task::none() } fn background_color(&self, theme: &cosmic::Theme) -> Color { @@ -517,7 +517,7 @@ impl Program for CosmicWindowInternal { fn view(&self) -> cosmic::Element<'_, Self::Message> { let mut header = cosmic::widget::header_bar() - .start(cosmic::widget::horizontal_space(32)) + .start(cosmic::widget::horizontal_space().width(32)) .title(self.last_title.lock().unwrap().clone()) .on_drag(Message::DragStart) .on_close(Message::Close) @@ -528,12 +528,12 @@ impl Program for CosmicWindowInternal { if cosmic::config::show_minimize() { header = header .on_minimize(Message::Minimize) - .start(cosmic::widget::horizontal_space(40)); // 32 + 8 spacing + .start(cosmic::widget::horizontal_space().width(40)); // 32 + 8 spacing } if cosmic::config::show_maximize() { header = header .on_maximize(Message::Maximize) - .start(cosmic::widget::horizontal_space(40)); // 32 + 8 spacing + .start(cosmic::widget::horizontal_space().width(40)); // 32 + 8 spacing } header.into() diff --git a/src/shell/grabs/menu/item.rs b/src/shell/grabs/menu/item.rs index b6aa0227..bf69e3ab 100644 --- a/src/shell/grabs/menu/item.rs +++ b/src/shell/grabs/menu/item.rs @@ -3,17 +3,17 @@ use cosmic::{ iced_core::{ event, layout, mouse, overlay, renderer::{Quad, Style}, - widget::{tree, Id, OperationOutputWrapper, Tree, Widget}, + widget::{tree, Id, Tree, Widget}, Background, Border, Clipboard, Color, Event, Layout, Length, Rectangle, Renderer as IcedRenderer, Shell, Size, }, - widget::button::StyleSheet, + widget::button::Catalog, }; pub struct SubmenuItem<'a, Message> { elem: cosmic::Element<'a, Message>, idx: usize, - styling: ::Style, + styling: ::Class, } impl<'a, Message> SubmenuItem<'a, Message> { @@ -25,7 +25,7 @@ impl<'a, Message> SubmenuItem<'a, Message> { } } - pub fn style(mut self, style: ::Style) -> Self { + pub fn style(mut self, style: ::Class) -> Self { self.styling = style; self } @@ -133,7 +133,7 @@ where state: &mut Tree, layout: Layout<'_>, renderer: &cosmic::Renderer, - operation: &mut dyn cosmic::widget::Operation>, + operation: &mut dyn cosmic::widget::Operation<()>, ) { let state = &mut state.children[0]; let layout = layout.children().next().unwrap(); @@ -206,10 +206,13 @@ where state: &'b mut Tree, layout: Layout<'_>, renderer: &cosmic::Renderer, + translation: cosmic::iced::Vector, ) -> Option> { let state = &mut state.children[0]; let layout = layout.children().next().unwrap(); - self.elem.as_widget_mut().overlay(state, layout, renderer) + self.elem + .as_widget_mut() + .overlay(state, layout, renderer, translation) } } diff --git a/src/shell/grabs/menu/mod.rs b/src/shell/grabs/menu/mod.rs index 83cc70f1..62fcaa7e 100644 --- a/src/shell/grabs/menu/mod.rs +++ b/src/shell/grabs/menu/mod.rs @@ -7,10 +7,10 @@ use calloop::LoopHandle; use cosmic::{ iced::{Alignment, Background}, iced_core::{alignment::Horizontal, Border, Length, Rectangle as IcedRectangle}, - iced_widget::{self, text::Appearance as TextAppearance, Column, Row}, + iced_widget::{self, text::Style as TextStyle, Column, Row}, theme, widget::{button, divider, horizontal_space, icon::from_name, text}, - Apply as _, Command, + Apply as _, Task, }; use smithay::{ backend::{ @@ -202,7 +202,7 @@ impl Program for ContextMenu { &mut self, message: Self::Message, loop_handle: &LoopHandle<'static, crate::state::State>, - ) -> Command { + ) -> Task { match message { Message::ItemPressed(idx) => { if let Some(Item::Entry { on_press, .. }) = self.items.get_mut(idx) { @@ -331,7 +331,7 @@ impl Program for ContextMenu { } }; - Command::none() + Task::none() } fn view(&self) -> cosmic::Element<'_, Self::Message> { @@ -350,7 +350,7 @@ impl Program for ContextMenu { match item { Item::Separator => divider::horizontal::light().into(), Item::Submenu { title, .. } => Row::with_children(vec![ - horizontal_space(16).into(), + horizontal_space().width(16).into(), text::body(title).width(mode).into(), from_name("go-next-symbolic") .size(16) @@ -361,7 +361,7 @@ impl Program for ContextMenu { .spacing(8) .width(width) .padding([8, 16]) - .align_items(Alignment::Center) + .align_y(Alignment::Center) .apply(|row| item::SubmenuItem::new(row, idx)) .style(theme::Button::MenuItem) .into(), @@ -378,20 +378,20 @@ impl Program for ContextMenu { .size(16) .prefer_svg(true) .icon() - .style(theme::Svg::custom(|theme| iced_widget::svg::Appearance { + .class(theme::Svg::custom(|theme| iced_widget::svg::Style { color: Some(theme.cosmic().accent.base.into()), })) .into() } else { - horizontal_space(16).into() + horizontal_space().width(16).into() }, text::body(title) .width(mode) - .style(if *disabled { + .class(if *disabled { theme::Text::Custom(|theme| { let mut color = theme.cosmic().background.component.on; color.alpha *= 0.5; - TextAppearance { + TextStyle { color: Some(color.into()), } }) @@ -399,17 +399,17 @@ impl Program for ContextMenu { theme::Text::Default }) .into(), - horizontal_space(16).into(), + horizontal_space().width(16).into(), ]; if let Some(shortcut) = shortcut.as_ref() { components.push( text::body(shortcut) - .horizontal_alignment(Horizontal::Right) + .align_x(Horizontal::Right) .width(Length::Shrink) - .style(theme::Text::Custom(|theme| { + .class(theme::Text::Custom(|theme| { let mut color = theme.cosmic().background.component.on; color.alpha *= 0.75; - TextAppearance { + TextStyle { color: Some(color.into()), } })) @@ -420,12 +420,12 @@ impl Program for ContextMenu { Row::with_children(components) .spacing(8) .width(mode) - .align_items(Alignment::Center) + .align_y(Alignment::Center) .apply(button::custom) .width(width) .padding([8, 16]) .on_press_maybe((!disabled).then_some(Message::ItemPressed(idx))) - .style(theme::Button::MenuItem) + .class(theme::Button::MenuItem) .into() } } @@ -433,10 +433,10 @@ impl Program for ContextMenu { .width(Length::Shrink) .apply(iced_widget::container) .padding(1) - .style(theme::Container::custom(|theme| { + .class(theme::Container::custom(|theme| { let cosmic = theme.cosmic(); let component = &cosmic.background.component; - iced_widget::container::Appearance { + iced_widget::container::Style { icon_color: Some(cosmic.accent.base.into()), text_color: Some(component.on.into()), background: Some(Background::Color(component.base.into())), diff --git a/src/utils/iced.rs b/src/utils/iced.rs index 7ab7a14f..18513644 100644 --- a/src/utils/iced.rs +++ b/src/utils/iced.rs @@ -10,26 +10,24 @@ use cosmic::{ iced::{ advanced::widget::Tree, event::Event, + futures::{FutureExt, StreamExt}, keyboard::{Event as KeyboardEvent, Modifiers as IcedModifiers}, mouse::{Button as MouseButton, Cursor, Event as MouseEvent, ScrollDelta}, touch::{Event as TouchEvent, Finger}, - window::{Event as WindowEvent, Id}, - Command, Limits, Point as IcedPoint, Rectangle as IcedRectangle, Size as IcedSize, + window::Event as WindowEvent, + Limits, Point as IcedPoint, Size as IcedSize, Task, }, - iced_core::{clipboard::Null as NullClipboard, renderer::Style, Color, Length, Pixels}, - iced_renderer::graphics::Renderer as IcedGraphicsRenderer, + iced_core::{clipboard::Null as NullClipboard, id::Id, renderer::Style, Color, Length, Pixels}, iced_runtime::{ - command::Action, program::{Program as IcedProgram, State}, - Debug, + task::into_stream, + Action, Debug, }, Theme, }; -use iced_tiny_skia::{ - graphics::{damage, Viewport}, - Backend, Primitive, -}; +use iced_tiny_skia::{graphics::Viewport, Primitive}; +use once_cell::sync::Lazy; use ordered_float::OrderedFloat; use smithay::{ backend::{ @@ -67,6 +65,8 @@ use smithay::{ }, }; +static ID: Lazy = Lazy::new(|| Id::new("Program")); + pub struct IcedElement(pub(crate) Arc>>); impl fmt::Debug for IcedElement

{ @@ -104,9 +104,9 @@ pub trait Program { &mut self, message: Self::Message, loop_handle: &LoopHandle<'static, crate::state::State>, - ) -> Command { + ) -> Task { let _ = (message, loop_handle); - Command::none() + Task::none() } fn view(&self) -> cosmic::Element<'_, Self::Message>; @@ -131,7 +131,7 @@ impl IcedProgram for ProgramWrapper

{ type Renderer = cosmic::Renderer; type Theme = cosmic::Theme; - fn update(&mut self, message: Self::Message) -> Command { + fn update(&mut self, message: Self::Message) -> Task { self.0.update(message, &self.1) } @@ -159,9 +159,9 @@ pub(crate) struct IcedElementInternal { // futures handle: LoopHandle<'static, crate::state::State>, - scheduler: Scheduler<

::Message>, + scheduler: Scheduler::Message>>, executor_token: Option, - rx: Receiver<

::Message>, + rx: Receiver::Message>>, } impl Clone for IcedElementInternal

{ @@ -178,14 +178,10 @@ impl Clone for IcedElementInternal

{ if !self.state.is_queue_empty() { tracing::warn!("Missing force_update call"); } - let mut renderer = cosmic::Renderer::TinySkia(IcedGraphicsRenderer::new( - Backend::new(), - cosmic::font::default(), - Pixels(16.0), - )); + let mut renderer = cosmic::Renderer::new(cosmic::font::default(), Pixels(16.0)); let mut debug = Debug::new(); let state = State::new( - Id::MAIN, + ID.clone(), ProgramWrapper(self.state.program().0.clone(), handle.clone()), IcedSize::new(self.size.w as f32, self.size.h as f32), &mut renderer, @@ -244,15 +240,11 @@ impl IcedElement

{ theme: cosmic::Theme, ) -> IcedElement

{ let size = size.into(); - let mut renderer = cosmic::Renderer::TinySkia(IcedGraphicsRenderer::new( - Backend::new(), - cosmic::font::default(), - Pixels(16.0), - )); + let mut renderer = cosmic::Renderer::new(cosmic::font::default(), Pixels(16.0)); let mut debug = Debug::new(); let state = State::new( - Id::MAIN, + ID.clone(), ProgramWrapper(program, handle.clone()), IcedSize::new(size.w as f32, size.h as f32), &mut renderer, @@ -368,8 +360,8 @@ impl IcedElement

{ impl IcedElementInternal

{ #[profiling::function] - fn update(&mut self, mut force: bool) -> Vec::Message>> { - while let Ok(message) = self.rx.try_recv() { + fn update(&mut self, mut force: bool) -> Vec::Message>> { + while let Ok(Some(message)) = self.rx.try_recv() { self.state.queue_message(message); force = true; } @@ -383,17 +375,16 @@ impl IcedElementInternal

{ .map(|p| IcedPoint::new(p.x as f32, p.y as f32)) .map(Cursor::Available) .unwrap_or(Cursor::Unavailable); - let actions = self .state .update( - Id::MAIN, + ID.clone(), IcedSize::new(self.size.w as f32, self.size.h as f32), cursor, &mut self.renderer, &self.theme, &Style { - scale_factor: 1.0, //TODO: why is this + scale_factor: 1.0, // TODO: why is this icon_color: self.theme.cosmic().on_bg_color().into(), text_color: self.theme.cosmic().on_bg_color().into(), }, @@ -402,17 +393,15 @@ impl IcedElementInternal

{ ) .1; - actions - .into_iter() - .filter_map(|action| { - if let Action::Future(future) = action { - let _ = self.scheduler.schedule(future); - None - } else { - Some(action) - } - }) - .collect::>() + if let Some(action) = actions { + if let Some(t) = into_stream(action) { + let _ = self.scheduler.schedule(t.into_future().map(|f| match f.0 { + Some(Action::Output(msg)) => Some(msg), + _ => None, + })); + } + } + Vec::new() } } @@ -751,14 +740,11 @@ impl SpaceElement for IcedElement

{ fn set_activate(&self, activated: bool) { let mut internal = self.0.lock().unwrap(); - internal.state.queue_event(Event::Window( - Id::MAIN, - if activated { - WindowEvent::Focused - } else { - WindowEvent::Unfocused - }, - )); + internal.state.queue_event(Event::Window(if activated { + WindowEvent::Focused + } else { + WindowEvent::Unfocused + })); let _ = internal.update(true); // TODO } @@ -860,83 +846,62 @@ where } else { false }; + if force { + internal_ref.pending_update = None; + } let _ = internal_ref.update(force); - - if let Some((buffer, ref mut old_primitives)) = - internal_ref.buffers.get_mut(&OrderedFloat(scale.x)) - { + if let Some((buffer, _)) = internal_ref.buffers.get_mut(&OrderedFloat(scale.x)) { let size: Size = internal_ref .size .to_f64() .to_buffer(scale.x, Transform::Normal) .to_i32_round(); - if size.w > 0 && size.h > 0 { - let cosmic::Renderer::TinySkia(renderer) = &mut internal_ref.renderer; let state_ref = &internal_ref.state; let mut clip_mask = tiny_skia::Mask::new(size.w as u32, size.h as u32).unwrap(); let overlay = internal_ref.debug.overlay(); let theme = &internal_ref.theme; - buffer - .render() - .draw(move |buf| { - let mut pixels = - tiny_skia::PixmapMut::from_bytes(buf, size.w as u32, size.h as u32) - .expect("Failed to create pixel map"); - - renderer.with_primitives(|backend, primitives| { - let background_color = state_ref.program().0.background_color(theme); - let bounds = IcedSize::new(size.w as u32, size.h as u32); - let viewport = Viewport::with_physical_size(bounds, scale.x); - - let mut damage = old_primitives - .as_ref() - .and_then(|(last_primitives, last_color)| { - (last_color == &background_color) - .then(|| damage::list(last_primitives, primitives)) - }) - .unwrap_or_else(|| { - vec![IcedRectangle::with_size(viewport.logical_size())] - }); - damage = damage::group(damage, scale.x as f32, bounds); - - if !damage.is_empty() { - backend.draw( - &mut pixels, - &mut clip_mask, - primitives, - &viewport, - &damage, - background_color, - &overlay, - ); - - *old_primitives = Some((primitives.to_vec(), background_color)); - } - - let damage = damage - .into_iter() - .map(|x| x.snap()) - .map(|damage_rect| { - Rectangle::from_loc_and_size( - (damage_rect.x as i32, damage_rect.y as i32), - (damage_rect.width as i32, damage_rect.height as i32), - ) - }) - .collect::>(); - - state_ref.program().0.foreground( - &mut pixels, - &damage, - scale.x as f32, - theme, - ); - - Result::<_, ()>::Ok(damage) + _ = buffer.render().draw(|buf| { + let mut pixels = + tiny_skia::PixmapMut::from_bytes(buf, size.w as u32, size.h as u32) + .expect("Failed to create pixel map"); + + let background_color = state_ref.program().0.background_color(theme); + let bounds = IcedSize::new(size.w as u32, size.h as u32); + let viewport = Viewport::with_physical_size(bounds, scale.x); + + let damage = vec![cosmic::iced::Rectangle::new( + cosmic::iced::Point::default(), + viewport.logical_size(), + )]; + + internal_ref.renderer.draw( + &mut pixels, + &mut clip_mask, + &viewport, + &damage, + background_color, + &overlay, + ); + + let damage = damage + .into_iter() + .filter_map(|x| x.snap()) + .map(|damage_rect| { + Rectangle::from_loc_and_size( + (damage_rect.x as i32, damage_rect.y as i32), + (damage_rect.width as i32, damage_rect.height as i32), + ) }) - }) - .unwrap(); + .collect::>(); + state_ref + .program() + .0 + .foreground(&mut pixels, &damage, scale.x as f32, theme); + + Result::<_, ()>::Ok(damage) + }); } if let Ok(buffer) = MemoryRenderBufferRenderElement::from_buffer( @@ -946,9 +911,11 @@ where Some(alpha), Some(Rectangle::from_loc_and_size( (0., 0.), - size.to_f64().to_logical(1.0, Transform::Normal), + size.to_f64() + .to_logical(1., Transform::Normal) + .to_i32_round(), )), - Some(internal_ref.size), + Some(size.to_logical(1, Transform::Normal)), Kind::Unspecified, ) { return vec![C::from(buffer)];