From f5445774de002fe5815e248ca93ff358d9c7ea9b Mon Sep 17 00:00:00 2001 From: Imbris Date: Wed, 23 Aug 2023 00:45:36 -0400 Subject: [PATCH] Update winit to 0.28 Hopefully works better on wayland! --- Cargo.lock | 629 +++++++++-------------- Cargo.toml | 5 + voxygen/Cargo.toml | 15 +- voxygen/egui/Cargo.toml | 2 +- voxygen/src/hud/settings_window/video.rs | 28 +- voxygen/src/window.rs | 47 +- 6 files changed, 302 insertions(+), 424 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a1b10639c3..8aa2c17539 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -100,18 +100,29 @@ dependencies = [ ] [[package]] -name = "andrew" -version = "0.3.1" +name = "android-activity" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c4afb09dd642feec8408e33f92f3ffc4052946f6b20f32fb99c1f58cd4fa7cf" +checksum = "64529721f27c2314ced0890ce45e469574a73e5e6fdd6e9da1860eb29285f5e0" dependencies = [ + "android-properties", "bitflags 1.3.2", - "rusttype 0.9.3", - "walkdir", - "xdg", - "xml-rs", + "cc", + "jni-sys", + "libc", + "log", + "ndk 0.7.0", + "ndk-context", + "ndk-sys 0.4.1+23.1.7779620", + "num_enum 0.6.1", ] +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -264,6 +275,12 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "as-raw-xcb-connection" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d5f312b0a56c5cdf967c0aeb67f6289603354951683bc97ddc595ab974ba9aa" + [[package]] name = "ash" version = "0.32.1" @@ -519,6 +536,25 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-sys" +version = "0.1.0-beta.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa55741ee90902547802152aaf3f8e5248aab7e21468089560d4c8840561146" +dependencies = [ + "objc-sys", +] + +[[package]] +name = "block2" +version = "0.2.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42" +dependencies = [ + "block-sys", + "objc2-encode", +] + [[package]] name = "bumpalo" version = "3.12.1" @@ -581,12 +617,16 @@ checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "calloop" -version = "0.6.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b036167e76041694579972c28cf4877b4f92da222560ddb49008937b6a6727c" +checksum = "52e0d00eb1ea24371a97d2da6201c6747a633dc6dc1988ef503403b4c59504a8" dependencies = [ + "bitflags 1.3.2", "log", - "nix 0.18.0", + "nix 0.25.1", + "slotmap 1.0.6", + "thiserror", + "vec_map", ] [[package]] @@ -758,7 +798,7 @@ dependencies = [ "anstyle", "bitflags 1.3.2", "clap_lex", - "strsim 0.10.0", + "strsim", ] [[package]] @@ -857,8 +897,8 @@ dependencies = [ "bitflags 1.3.2", "block", "cocoa-foundation", - "core-foundation 0.9.3", - "core-graphics 0.22.3", + "core-foundation", + "core-graphics", "foreign-types", "libc", "objc", @@ -872,7 +912,7 @@ checksum = "931d3837c286f56e3c58423ce4eba12d08db2374461a785c86f672b08b5650d6" dependencies = [ "bitflags 1.3.2", "block", - "core-foundation 0.9.3", + "core-foundation", "core-graphics-types", "foreign-types", "libc", @@ -982,50 +1022,22 @@ dependencies = [ "x11-clipboard", ] -[[package]] -name = "core-foundation" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" -dependencies = [ - "core-foundation-sys 0.7.0", - "libc", -] - [[package]] name = "core-foundation" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ - "core-foundation-sys 0.8.4", + "core-foundation-sys", "libc", ] -[[package]] -name = "core-foundation-sys" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" - [[package]] name = "core-foundation-sys" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" -[[package]] -name = "core-graphics" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" -dependencies = [ - "bitflags 1.3.2", - "core-foundation 0.7.0", - "foreign-types", - "libc", -] - [[package]] name = "core-graphics" version = "0.22.3" @@ -1033,7 +1045,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" dependencies = [ "bitflags 1.3.2", - "core-foundation 0.9.3", + "core-foundation", "core-graphics-types", "foreign-types", "libc", @@ -1046,24 +1058,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" dependencies = [ "bitflags 1.3.2", - "core-foundation 0.9.3", + "core-foundation", "foreign-types", "libc", ] -[[package]] -name = "core-video-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828" -dependencies = [ - "cfg-if 0.1.10", - "core-foundation-sys 0.7.0", - "core-graphics 0.19.2", - "libc", - "objc", -] - [[package]] name = "coreaudio-rs" version = "0.10.0" @@ -1103,7 +1102,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74117836a5124f3629e4b474eed03e479abaf98988b4bb317e29f08cfe0e4116" dependencies = [ "alsa", - "core-foundation-sys 0.8.4", + "core-foundation-sys", "coreaudio-rs", "jni 0.19.0", "js-sys", @@ -1111,7 +1110,7 @@ dependencies = [ "libc", "mach", "ndk 0.6.0", - "ndk-glue 0.6.2", + "ndk-glue", "nix 0.23.2", "oboe", "parking_lot 0.11.2", @@ -1128,7 +1127,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f342c1b63e185e9953584ff2199726bf53850d96610a310e3aca09e9405a2d0b" dependencies = [ "alsa", - "core-foundation-sys 0.8.4", + "core-foundation-sys", "coreaudio-rs", "jni 0.19.0", "js-sys", @@ -1290,20 +1289,6 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6548a0ad5d2549e111e1f6a11a6c2e2d00ce6a3dafe22948d67c2b443f775e52" -[[package]] -name = "crossbeam" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-channel", - "crossbeam-deque 0.8.3", - "crossbeam-epoch 0.9.14", - "crossbeam-queue", - "crossbeam-utils 0.8.15", -] - [[package]] name = "crossbeam-channel" version = "0.5.8" @@ -1554,16 +1539,6 @@ dependencies = [ "petgraph 0.4.13", ] -[[package]] -name = "darling" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" -dependencies = [ - "darling_core 0.10.2", - "darling_macro 0.10.2", -] - [[package]] name = "darling" version = "0.13.4" @@ -1584,20 +1559,6 @@ dependencies = [ "darling_macro 0.20.1", ] -[[package]] -name = "darling_core" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2 1.0.56", - "quote 1.0.26", - "strsim 0.9.3", - "syn 1.0.109", -] - [[package]] name = "darling_core" version = "0.13.4" @@ -1608,7 +1569,7 @@ dependencies = [ "ident_case", "proc-macro2 1.0.56", "quote 1.0.26", - "strsim 0.10.0", + "strsim", "syn 1.0.109", ] @@ -1625,17 +1586,6 @@ dependencies = [ "syn 2.0.15", ] -[[package]] -name = "darling_macro" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" -dependencies = [ - "darling_core 0.10.2", - "quote 1.0.26", - "syn 1.0.109", -] - [[package]] name = "darling_macro" version = "0.13.4" @@ -1813,15 +1763,6 @@ dependencies = [ "syn 2.0.15", ] -[[package]] -name = "dlib" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76" -dependencies = [ - "libloading 0.6.7", -] - [[package]] name = "dlib" version = "0.5.0" @@ -1877,8 +1818,7 @@ dependencies = [ [[package]] name = "egui_winit_platform" version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd4cf17c0cd4dbcf2f8fef55a3592b9b7cfd970576c7302d8ba5c521b8560371" +source = "git+https://github.com/Imberflur/egui_winit_platform.git?tag=veloren-winit-0.28#99685556bf323cb6b57565ae63aaf934457e95c0" dependencies = [ "egui", "winit", @@ -2591,7 +2531,7 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd745b0cb1a207756e8fabacf5623066ad6aa543ea0be4bab34e897e6bbe24f9" dependencies = [ - "core-foundation 0.9.3", + "core-foundation", "io-kit-sys", "js-sys", "libc", @@ -2974,7 +2914,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" dependencies = [ "android_system_properties", - "core-foundation-sys 0.8.4", + "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", @@ -2994,12 +2934,12 @@ dependencies = [ [[package]] name = "iced_core" version = "0.4.0" -source = "git+https://github.com/Imberflur/iced?tag=winit-0.25#18a48a5eeefd2aa6e50f5dd0751ac2e94c88a9eb" +source = "git+https://github.com/Imberflur/iced?tag=veloren-winit-0.28#a0f3dd51f2dc116bc3bc19f8421fb454436857f7" [[package]] name = "iced_futures" version = "0.3.0" -source = "git+https://github.com/Imberflur/iced?tag=winit-0.25#18a48a5eeefd2aa6e50f5dd0751ac2e94c88a9eb" +source = "git+https://github.com/Imberflur/iced?tag=veloren-winit-0.28#a0f3dd51f2dc116bc3bc19f8421fb454436857f7" dependencies = [ "futures", "log", @@ -3009,20 +2949,20 @@ dependencies = [ [[package]] name = "iced_graphics" version = "0.2.0" -source = "git+https://github.com/Imberflur/iced?tag=winit-0.25#18a48a5eeefd2aa6e50f5dd0751ac2e94c88a9eb" +source = "git+https://github.com/Imberflur/iced?tag=veloren-winit-0.28#a0f3dd51f2dc116bc3bc19f8421fb454436857f7" dependencies = [ "bytemuck", "glam", "iced_native", "iced_style", - "raw-window-handle 0.3.4", + "raw-window-handle 0.5.2", "thiserror", ] [[package]] name = "iced_native" version = "0.4.0" -source = "git+https://github.com/Imberflur/iced?tag=winit-0.25#18a48a5eeefd2aa6e50f5dd0751ac2e94c88a9eb" +source = "git+https://github.com/Imberflur/iced?tag=veloren-winit-0.28#a0f3dd51f2dc116bc3bc19f8421fb454436857f7" dependencies = [ "iced_core", "iced_futures", @@ -3034,7 +2974,7 @@ dependencies = [ [[package]] name = "iced_style" version = "0.3.0" -source = "git+https://github.com/Imberflur/iced?tag=winit-0.25#18a48a5eeefd2aa6e50f5dd0751ac2e94c88a9eb" +source = "git+https://github.com/Imberflur/iced?tag=veloren-winit-0.28#a0f3dd51f2dc116bc3bc19f8421fb454436857f7" dependencies = [ "iced_core", ] @@ -3042,7 +2982,7 @@ dependencies = [ [[package]] name = "iced_winit" version = "0.3.0" -source = "git+https://github.com/Imberflur/iced?tag=winit-0.25#18a48a5eeefd2aa6e50f5dd0751ac2e94c88a9eb" +source = "git+https://github.com/Imberflur/iced?tag=veloren-winit-0.28#a0f3dd51f2dc116bc3bc19f8421fb454436857f7" dependencies = [ "iced_futures", "iced_graphics", @@ -3173,7 +3113,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2d4429acc1deff0fbdece0325b4997bdb02b2c245ab7023fd5deca0f6348de" dependencies = [ - "core-foundation-sys 0.8.4", + "core-foundation-sys", "mach2", ] @@ -3278,10 +3218,9 @@ dependencies = [ [[package]] name = "keyboard-keynames" version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f32e85d306d31d33240ea15accdf6e153d0a31da1409a21a0d5fb7ca5ef91d6c" +source = "git+https://gitlab.com/Imbris/keyboard-keynames.git?tag=veloren-winit-0.28#fca4bbdfa51bf054b155a455935b3792975c989d" dependencies = [ - "wayland-client 0.29.5", + "wayland-client", "winapi", "winit", "xcb", @@ -3374,16 +3313,6 @@ version = "0.2.142" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" -[[package]] -name = "libloading" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883" -dependencies = [ - "cfg-if 1.0.0", - "winapi", -] - [[package]] name = "libloading" version = "0.7.4" @@ -3570,15 +3499,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" -[[package]] -name = "memmap2" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b70ca2a6103ac8b665dc150b142ef0e4e89df640c9e6cf295d189c3caebe5a" -dependencies = [ - "libc", -] - [[package]] name = "memmap2" version = "0.5.10" @@ -3645,7 +3565,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c66a1fdd7e946fe33fe9725012e25836bba3655769bee9ee347cce7de3f396df" dependencies = [ "cc", - "dlib 0.5.0", + "dlib", "futures", "instant", "js-sys", @@ -3657,9 +3577,9 @@ dependencies = [ "serde_derive", "tempfile", "wasm-bindgen-futures", - "wayland-client 0.29.5", - "wayland-cursor 0.29.5", - "wayland-protocols 0.29.5", + "wayland-client", + "wayland-cursor", + "wayland-protocols", "winapi", "x11-dl", ] @@ -3714,18 +3634,6 @@ dependencies = [ "windows-sys 0.45.0", ] -[[package]] -name = "mio-misc" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b47412f3a52115b936ff2a229b803498c7b4d332adeb87c2f1498c9da54c398c" -dependencies = [ - "crossbeam", - "crossbeam-queue", - "log", - "mio 0.7.14", -] - [[package]] name = "miow" version = "0.3.7" @@ -3794,18 +3702,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "ndk" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8794322172319b972f528bf90c6b467be0079f1fa82780ffb431088e741a73ab" -dependencies = [ - "jni-sys", - "ndk-sys 0.2.2", - "num_enum", - "thiserror", -] - [[package]] name = "ndk" version = "0.6.0" @@ -3815,7 +3711,7 @@ dependencies = [ "bitflags 1.3.2", "jni-sys", "ndk-sys 0.3.0", - "num_enum", + "num_enum 0.5.11", "thiserror", ] @@ -3828,7 +3724,7 @@ dependencies = [ "bitflags 1.3.2", "jni-sys", "ndk-sys 0.4.1+23.1.7779620", - "num_enum", + "num_enum 0.5.11", "raw-window-handle 0.5.2", "thiserror", ] @@ -3839,20 +3735,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" -[[package]] -name = "ndk-glue" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5caf0c24d51ac1c905c27d4eda4fa0635bbe0de596b8f79235e0b17a4d29385" -dependencies = [ - "lazy_static", - "libc", - "log", - "ndk 0.3.0", - "ndk-macro 0.2.0", - "ndk-sys 0.2.2", -] - [[package]] name = "ndk-glue" version = "0.6.2" @@ -3864,23 +3746,10 @@ dependencies = [ "log", "ndk 0.6.0", "ndk-context", - "ndk-macro 0.3.0", + "ndk-macro", "ndk-sys 0.3.0", ] -[[package]] -name = "ndk-macro" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d1c6307dc424d0f65b9b06e94f88248e6305726b14729fd67a5e47b2dc481d" -dependencies = [ - "darling 0.10.2", - "proc-macro-crate 0.1.5", - "proc-macro2 1.0.56", - "quote 1.0.26", - "syn 1.0.109", -] - [[package]] name = "ndk-macro" version = "0.3.0" @@ -3888,18 +3757,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" dependencies = [ "darling 0.13.4", - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2 1.0.56", "quote 1.0.26", "syn 1.0.109", ] -[[package]] -name = "ndk-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121" - [[package]] name = "ndk-sys" version = "0.3.0" @@ -3927,30 +3790,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "nix" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83450fe6a6142ddd95fb064b746083fc4ef1705fe81f64a64e1d4b39f54a1055" -dependencies = [ - "bitflags 1.3.2", - "cc", - "cfg-if 0.1.10", - "libc", -] - -[[package]] -name = "nix" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" -dependencies = [ - "bitflags 1.3.2", - "cc", - "cfg-if 1.0.0", - "libc", -] - [[package]] name = "nix" version = "0.22.3" @@ -3989,6 +3828,19 @@ dependencies = [ "memoffset 0.6.5", ] +[[package]] +name = "nix" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if 1.0.0", + "libc", + "memoffset 0.6.5", +] + [[package]] name = "nix" version = "0.26.2" @@ -4219,7 +4071,16 @@ version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" dependencies = [ - "num_enum_derive", + "num_enum_derive 0.5.11", +] + +[[package]] +name = "num_enum" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" +dependencies = [ + "num_enum_derive 0.6.1", ] [[package]] @@ -4228,12 +4089,24 @@ version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate", "proc-macro2 1.0.56", "quote 1.0.26", "syn 1.0.109", ] +[[package]] +name = "num_enum_derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +dependencies = [ + "proc-macro-crate", + "proc-macro2 1.0.56", + "quote 1.0.26", + "syn 2.0.15", +] + [[package]] name = "objc" version = "0.2.7" @@ -4255,6 +4128,32 @@ dependencies = [ "objc_id", ] +[[package]] +name = "objc-sys" +version = "0.2.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7" + +[[package]] +name = "objc2" +version = "0.3.0-beta.3.patch-leaks.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e01640f9f2cb1220bbe80325e179e532cb3379ebcd1bf2279d703c19fe3a468" +dependencies = [ + "block2", + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2-encode" +version = "2.0.0-pre.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abfcac41015b00a120608fdaa6938c44cb983fee294351cc4bac7638b4e50512" +dependencies = [ + "objc-sys", +] + [[package]] name = "objc_exception" version = "0.1.2" @@ -4686,15 +4585,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml 0.5.11", -] - [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -5649,6 +5539,19 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sctk-adwaita" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda4e97be1fd174ccc2aae81c8b694e803fa99b34e8fd0f057a9d70698e3ed09" +dependencies = [ + "ab_glyph", + "log", + "memmap2", + "smithay-client-toolkit", + "tiny-skia", +] + [[package]] name = "sdl2" version = "0.35.2" @@ -5685,8 +5588,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" dependencies = [ "bitflags 1.3.2", - "core-foundation 0.9.3", - "core-foundation-sys 0.8.4", + "core-foundation", + "core-foundation-sys", "libc", "security-framework-sys", ] @@ -5697,7 +5600,7 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" dependencies = [ - "core-foundation-sys 0.8.4", + "core-foundation-sys", "libc", ] @@ -6003,25 +5906,6 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" -[[package]] -name = "smithay-client-toolkit" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4750c76fd5d3ac95fa3ed80fe667d6a3d8590a960e5b575b98eea93339a80b80" -dependencies = [ - "andrew", - "bitflags 1.3.2", - "calloop", - "dlib 0.4.2", - "lazy_static", - "log", - "memmap2 0.1.0", - "nix 0.18.0", - "wayland-client 0.28.6", - "wayland-cursor 0.28.6", - "wayland-protocols 0.28.6", -] - [[package]] name = "smithay-client-toolkit" version = "0.16.0" @@ -6029,15 +5913,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" dependencies = [ "bitflags 1.3.2", - "dlib 0.5.0", + "calloop", + "dlib", "lazy_static", "log", - "memmap2 0.5.10", + "memmap2", "nix 0.24.3", "pkg-config", - "wayland-client 0.29.5", - "wayland-cursor 0.29.5", - "wayland-protocols 0.29.5", + "wayland-client", + "wayland-cursor", + "wayland-protocols", ] [[package]] @@ -6046,8 +5931,8 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a345c870a1fae0b1b779085e81b51e614767c239e93503588e54c5b17f4b0e8" dependencies = [ - "smithay-client-toolkit 0.16.0", - "wayland-client 0.29.5", + "smithay-client-toolkit", + "wayland-client", ] [[package]] @@ -6259,10 +6144,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" [[package]] -name = "strsim" -version = "0.9.3" +name = "strict-num" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" [[package]] name = "strsim" @@ -6501,6 +6386,31 @@ dependencies = [ "slab", ] +[[package]] +name = "tiny-skia" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df8493a203431061e901613751931f047d1971337153f96d0e5e363d6dbf6a67" +dependencies = [ + "arrayref", + "arrayvec 0.7.2", + "bytemuck", + "cfg-if 1.0.0", + "png", + "tiny-skia-path", +] + +[[package]] +name = "tiny-skia-path" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adbfb5d3f3dd57a0e11d12f4f13d4ebbbc1b5c15b7ab0a156d030b21da5f677c" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + [[package]] name = "tinystr" version = "0.7.1" @@ -7823,7 +7733,7 @@ dependencies = [ "enumset", "lazy_static", "leb128", - "memmap2 0.5.10", + "memmap2", "more-asserts", "region", "smallvec", @@ -7918,7 +7828,7 @@ dependencies = [ "bitflags 1.3.2", "byteorder", "cfg-if 1.0.0", - "num_enum", + "num_enum 0.5.11", "time 0.2.27", "wai-bindgen-gen-core", "wai-bindgen-gen-rust", @@ -7970,22 +7880,6 @@ dependencies = [ "hashbrown 0.9.1", ] -[[package]] -name = "wayland-client" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ab332350e502f159382201394a78e3cc12d0f04db863429260164ea40e0355" -dependencies = [ - "bitflags 1.3.2", - "downcast-rs", - "libc", - "nix 0.20.0", - "scoped-tls", - "wayland-commons 0.28.6", - "wayland-scanner 0.28.6", - "wayland-sys 0.28.6", -] - [[package]] name = "wayland-client" version = "0.29.5" @@ -7997,21 +7891,9 @@ dependencies = [ "libc", "nix 0.24.3", "scoped-tls", - "wayland-commons 0.29.5", - "wayland-scanner 0.29.5", - "wayland-sys 0.29.5", -] - -[[package]] -name = "wayland-commons" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21817947c7011bbd0a27e11b17b337bfd022e8544b071a2641232047966fbda" -dependencies = [ - "nix 0.20.0", - "once_cell", - "smallvec", - "wayland-sys 0.28.6", + "wayland-commons", + "wayland-scanner", + "wayland-sys", ] [[package]] @@ -8023,18 +7905,7 @@ dependencies = [ "nix 0.24.3", "once_cell", "smallvec", - "wayland-sys 0.29.5", -] - -[[package]] -name = "wayland-cursor" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be610084edd1586d45e7bdd275fe345c7c1873598caa464c4fb835dee70fa65a" -dependencies = [ - "nix 0.20.0", - "wayland-client 0.28.6", - "xcursor", + "wayland-sys", ] [[package]] @@ -8044,22 +7915,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661" dependencies = [ "nix 0.24.3", - "wayland-client 0.29.5", + "wayland-client", "xcursor", ] -[[package]] -name = "wayland-protocols" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "286620ea4d803bacf61fa087a4242ee316693099ee5a140796aaba02b29f861f" -dependencies = [ - "bitflags 1.3.2", - "wayland-client 0.28.6", - "wayland-commons 0.28.6", - "wayland-scanner 0.28.6", -] - [[package]] name = "wayland-protocols" version = "0.29.5" @@ -8067,20 +7926,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" dependencies = [ "bitflags 1.3.2", - "wayland-client 0.29.5", - "wayland-commons 0.29.5", - "wayland-scanner 0.29.5", -] - -[[package]] -name = "wayland-scanner" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce923eb2deb61de332d1f356ec7b6bf37094dc5573952e1c8936db03b54c03f1" -dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.26", - "xml-rs", + "wayland-client", + "wayland-commons", + "wayland-scanner", ] [[package]] @@ -8094,24 +7942,13 @@ dependencies = [ "xml-rs", ] -[[package]] -name = "wayland-sys" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d841fca9aed7febf9bed2e9796c49bf58d4152ceda8ac949ebe00868d8f0feb8" -dependencies = [ - "dlib 0.5.0", - "lazy_static", - "pkg-config", -] - [[package]] name = "wayland-sys" version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4" dependencies = [ - "dlib 0.5.0", + "dlib", "lazy_static", "pkg-config", ] @@ -8278,15 +8115,15 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "window_clipboard" -version = "0.2.4" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "015dd4474dc6aa96fe19aae3a24587a088bd90331dba5a5cc60fb3a180234c4d" +checksum = "63287c9c4396ccf5346d035a9b0fcaead9e18377637f5eaa78b7ac65c873ff7d" dependencies = [ "clipboard-win 4.5.0", "clipboard_macos", "clipboard_wayland", "clipboard_x11", - "raw-window-handle 0.3.4", + "raw-window-handle 0.5.2", "thiserror", ] @@ -8534,34 +8371,37 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winit" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79610794594d5e86be473ef7763f604f2159cbac8c94debd00df8fb41e86c2f8" +version = "0.28.6" +source = "git+https://github.com/Imberflur/winit.git?tag=raw-window-handle-0.4-retro-support-v1#19a99553bc6c7298efd2438a917f2dde58ea0ea4" dependencies = [ + "android-activity", "bitflags 1.3.2", - "cocoa", - "core-foundation 0.9.3", - "core-graphics 0.22.3", - "core-video-sys", + "cfg_aliases", + "core-foundation", + "core-graphics", "dispatch 0.2.0", "instant", - "lazy_static", "libc", "log", - "mio 0.7.14", - "mio-misc", - "ndk 0.3.0", - "ndk-glue 0.3.0", - "ndk-sys 0.2.2", - "objc", - "parking_lot 0.11.2", + "mio 0.8.6", + "ndk 0.7.0", + "objc2", + "once_cell", + "orbclient", "percent-encoding", - "raw-window-handle 0.3.4", - "scopeguard", + "raw-window-handle 0.4.3", + "raw-window-handle 0.5.2", + "redox_syscall 0.3.5", + "sctk-adwaita", "serde", - "smithay-client-toolkit 0.12.3", - "wayland-client 0.28.6", - "winapi", + "smithay-client-toolkit", + "wasm-bindgen", + "wayland-client", + "wayland-commons", + "wayland-protocols", + "wayland-scanner", + "web-sys", + "windows-sys 0.45.0", "x11-dl", ] @@ -8680,6 +8520,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b90c622d513012e7419594a2138953603c63848cb189041e7b5dc04d3895da5" dependencies = [ + "as-raw-xcb-connection", "bitflags 1.3.2", "libc", "quick-xml", @@ -8716,7 +8557,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbee136714379ab22da0280207fdb7f47e0bb940adea97731b65598b8c7a92e" dependencies = [ "libc", - "memmap2 0.5.10", + "memmap2", "xcb", ] diff --git a/Cargo.toml b/Cargo.toml index d552f9aa5f..79dbbdd4eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -157,6 +157,8 @@ clap = { version = "4.2", features = ["derive"]} [patch.crates-io] vek = { git = "https://github.com/yoanlcq/vek.git", rev = "84d5cb65841d46599a986c5477341bea4456be26" } +# patch winit to support older raw-window-handle that works with old wgpu +winit = { git = "https://github.com/Imberflur/winit.git", tag = "raw-window-handle-0.4-retro-support-v1" } # patch wgpu so we can use wgpu-profiler crate # wgpu = { git = "https://github.com/gfx-rs/wgpu.git", rev = "a92b8549a8e2cb9dac781bafc5ed32828f3caf46" } wgpu = { git = "https://github.com/pythonesque/wgpu.git", rev = "179ea209374a92837cde252f1d9ee01f628cae08" } @@ -174,6 +176,9 @@ ntapi = { git = "https://github.com/MSxDOS/ntapi.git", rev = "9f56b149c9e2579673 # gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx.git", rev = "e305dcca3557923a6a8810162d8dd09cb45a43a6" } # gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx.git", rev = "e305dcca3557923a6a8810162d8dd09cb45a43a6" } +# # Uncomment this to use a local fork of winit (for testing purposes) +# winit = { path = "../winit" } + # # Uncomment this to use a local fork of wgpu (for testing purposes) # [patch.'https://github.com/gfx-rs/wgpu'] # wgpu-core = { path = "../wgpu/wgpu-core" } diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index 3467736b98..56cc710cf0 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -56,7 +56,7 @@ i18n-helpers = {package = "veloren-voxygen-i18n-helpers", path = "i18n-helpers"} voxygen-egui = {package = "veloren-voxygen-egui", path = "egui", optional = true } # Graphics -winit = {version = "0.25.0", features = ["serde"]} +winit = {version = "0.28.6", features = ["serde"]} wgpu = { version = "=0.8.0", features = ["trace", "cross"] } wgpu-profiler = { git = "https://github.com/Imberflur/wgpu-profiler", tag = "wgpu-0.8" } bytemuck = { version="1.4", features=["derive"] } @@ -71,16 +71,16 @@ cmake = "=0.1.45" conrod_core = {git = "https://gitlab.com/veloren/conrod.git", branch="copypasta_0.7"} conrod_winit = {git = "https://gitlab.com/veloren/conrod.git", branch="copypasta_0.7"} euc = "0.5.0" -iced = {package = "iced_native", git = "https://github.com/Imberflur/iced", tag = "winit-0.25"} -iced_winit = {git = "https://github.com/Imberflur/iced", tag = "winit-0.25"} -window_clipboard = "0.2" +iced = {package = "iced_native", git = "https://github.com/Imberflur/iced", tag = "veloren-winit-0.28"} +iced_winit = {git = "https://github.com/Imberflur/iced", tag = "veloren-winit-0.28"} +window_clipboard = "0.3" glyph_brush = "0.7.0" -keyboard-keynames = "0.1.2" - +# https://gitlab.com/Frinksy/keyboard-keynames/-/merge_requests/8 +keyboard-keynames = { git = "https://gitlab.com/Imbris/keyboard-keynames.git", tag = "veloren-winit-0.28" } # EGUI egui = {version = "0.12", optional = true } egui_wgpu_backend = {git = "https://github.com/hasenbanck/egui_wgpu_backend.git", rev = "63a002c6a9b6c016e45806dd065864431caab621", optional = true } -egui_winit_platform = {version = "0.8", optional = true } +egui_winit_platform = { git = "https://github.com/Imberflur/egui_winit_platform.git", tag = "veloren-winit-0.28", optional = true } # ECS specs = { workspace = true, features = ["serde", "storage-event-control"] } @@ -104,6 +104,7 @@ backtrace = "0.3.40" bincode = { workspace = true } chrono = { workspace = true } chumsky = "0.9" +# TODO: unused cpal = "0.14" crossbeam-utils = { workspace = true } crossbeam-channel = { workspace = true } diff --git a/voxygen/egui/Cargo.toml b/voxygen/egui/Cargo.toml index 24450cf94a..a301880c9d 100644 --- a/voxygen/egui/Cargo.toml +++ b/voxygen/egui/Cargo.toml @@ -12,7 +12,7 @@ be-dyn-lib = [] client = {package = "veloren-client", path = "../../client"} common = {package = "veloren-common", path = "../../common"} egui = "0.12" -egui_winit_platform = "0.8" +egui_winit_platform = { git = "https://github.com/Imberflur/egui_winit_platform.git", tag = "veloren-winit-0.28" } lazy_static = { workspace = true } common-dynlib = {package = "veloren-common-dynlib", path = "../../common/dynlib", optional = true} diff --git a/voxygen/src/hud/settings_window/video.rs b/voxygen/src/hud/settings_window/video.rs index 208a646a07..06a004de6b 100644 --- a/voxygen/src/hud/settings_window/video.rs +++ b/voxygen/src/hud/settings_window/video.rs @@ -1548,11 +1548,12 @@ impl<'a> Widget for Video<'a> { let bit_depths: Vec = correct_res .iter() .filter( - |mode| match self.global_state.settings.graphics.fullscreen.refresh_rate { - Some(refresh_rate) => mode.refresh_rate() == refresh_rate, + |mode| match self.global_state.settings.graphics.fullscreen.refresh_rate_millihertz { + Some(rate) => mode.refresh_rate_millihertz() == rate, None => true, }, ) + // TODO: why do we sort by this and then map to it? .sorted_by_key(|mode| mode.bit_depth()) .map(|mode| mode.bit_depth()) .rev() @@ -1601,7 +1602,7 @@ impl<'a> Widget for Video<'a> { } // Refresh Rate - let refresh_rates: Vec = correct_res + let refresh_rates: Vec = correct_res .into_iter() .filter( |mode| match self.global_state.settings.graphics.fullscreen.bit_depth { @@ -1609,8 +1610,9 @@ impl<'a> Widget for Video<'a> { None => true, }, ) - .sorted_by_key(|mode| mode.refresh_rate()) - .map(|mode| mode.refresh_rate()) + // TODO: why do we sort by this and then map to it? + .sorted_by_key(|mode| mode.refresh_rate_millihertz()) + .map(|mode| mode.refresh_rate_millihertz()) .rev() .dedup() .collect(); @@ -1627,10 +1629,20 @@ impl<'a> Widget for Video<'a> { once(String::from( self.localized_strings.get_msg("common-automatic"), )) - .chain(refresh_rates.iter().map(|rate| format!("{}", rate))) + .chain( + refresh_rates + .iter() + .map(|&rate| format!("{:.1}", rate as f32 / 1000.0)), + ) .collect::>() .as_slice(), - match self.global_state.settings.graphics.fullscreen.refresh_rate { + match self + .global_state + .settings + .graphics + .fullscreen + .refresh_rate_millihertz + { Some(refresh_rate) => refresh_rates .iter() .position(|rate| rate == &refresh_rate) @@ -1647,7 +1659,7 @@ impl<'a> Widget for Video<'a> { .set(state.ids.refresh_rate, ui) { events.push(GraphicsChange::ChangeFullscreenMode(FullScreenSettings { - refresh_rate: if clicked == 0 { + refresh_rate_millihertz: if clicked == 0 { None } else { Some(refresh_rates[clicked - 1]) diff --git a/voxygen/src/window.rs b/voxygen/src/window.rs index dc9601b728..70c8124976 100644 --- a/voxygen/src/window.rs +++ b/voxygen/src/window.rs @@ -1028,9 +1028,21 @@ impl Window { pub fn is_cursor_grabbed(&self) -> bool { self.cursor_grabbed } pub fn grab_cursor(&mut self, grab: bool) { + use winit::window::CursorGrabMode; + self.cursor_grabbed = grab; self.window.set_cursor_visible(!grab); - let _ = self.window.set_cursor_grab(grab); + let res = if grab { + self.window + .set_cursor_grab(CursorGrabMode::Confined) + .or_else(|_e| self.window.set_cursor_grab(CursorGrabMode::Locked)) + } else { + self.window.set_cursor_grab(CursorGrabMode::None) + }; + + if let Err(e) = res { + error!(?e, ?grab, "Failed to toggle cursor grab"); + } } /// Moves mouse cursor to center of screen @@ -1073,7 +1085,7 @@ impl Window { &self, resolution: [u16; 2], bit_depth: Option, - refresh_rate: Option, + refresh_rate_millihertz: Option, correct_res: Option>, correct_depth: Option>, correct_rate: Option>, @@ -1103,14 +1115,14 @@ impl Window { .cloned() }); - match refresh_rate { + match refresh_rate_millihertz { // A bit depth and a refresh rate is given Some(rate) => { // analogous to correct_res let correct_rate = correct_rate.unwrap_or_else(|| { correct_res .iter() - .find(|mode| mode.refresh_rate() == rate) + .find(|mode| mode.refresh_rate_millihertz() == rate) .cloned() }); @@ -1121,7 +1133,7 @@ impl Window { correct_res .iter() .filter(|mode| mode.bit_depth() == depth) - .find(|mode| mode.refresh_rate() == rate) + .find(|mode| mode.refresh_rate_millihertz() == rate) .cloned() .or_else(|| { if correct_depth.is_none() && correct_rate.is_none() { @@ -1166,14 +1178,14 @@ impl Window { } }, // No bit depth is given - None => match refresh_rate { + None => match refresh_rate_millihertz { // No bit depth and a refresh rate is given Some(rate) => { // analogous to correct_res let correct_rate = correct_rate.unwrap_or_else(|| { correct_res .iter() - .find(|mode| mode.refresh_rate() == rate) + .find(|mode| mode.refresh_rate_millihertz() == rate) .cloned() }); @@ -1205,7 +1217,7 @@ impl Window { .into_iter() // Prefer bit depth over refresh rate .sorted_by_key(|mode| mode.bit_depth()) - .max_by_key(|mode| mode.refresh_rate()), + .max_by_key(|mode| mode.refresh_rate_millihertz()), }, } } @@ -1214,7 +1226,7 @@ impl Window { &self, resolution: [u16; 2], bit_depth: Option, - refresh_rate: Option, + refresh_rate_millihertz: Option, ) -> Option { // (resolution, bit depth, refresh rate) represents a video mode // spec: as specified @@ -1225,7 +1237,14 @@ impl Window { // (spec, spec, max), (spec, max, spec) // (spec, max, max) // (max, max, max) - match self.select_video_mode_rec(resolution, bit_depth, refresh_rate, None, None, None) { + match self.select_video_mode_rec( + resolution, + bit_depth, + refresh_rate_millihertz, + None, + None, + None, + ) { Some(mode) => Some(mode), // if there is no video mode with the specified resolution, // fall back to the video mode with max resolution, bit depth and refresh rate @@ -1238,7 +1257,7 @@ impl Window { let mode = monitor .video_modes() // Prefer bit depth over refresh rate - .sorted_by_key(|mode| mode.refresh_rate()) + .sorted_by_key(|mode| mode.refresh_rate_millihertz()) .sorted_by_key(|mode| mode.bit_depth()) .max_by_key(|mode| mode.size().width); @@ -1263,7 +1282,7 @@ impl Window { if let Some(video_mode) = self.select_video_mode( fullscreen.resolution, fullscreen.bit_depth, - fullscreen.refresh_rate, + fullscreen.refresh_rate_millihertz, ) { winit::window::Fullscreen::Exclusive(video_mode) } else { @@ -1411,7 +1430,7 @@ pub struct FullScreenSettings { pub mode: FullscreenMode, pub resolution: [u16; 2], pub bit_depth: Option, - pub refresh_rate: Option, + pub refresh_rate_millihertz: Option, } impl Default for FullScreenSettings { @@ -1421,7 +1440,7 @@ impl Default for FullScreenSettings { mode: FullscreenMode::Borderless, resolution: [1920, 1080], bit_depth: None, - refresh_rate: None, + refresh_rate_millihertz: None, } } }