mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-20 19:08:00 +03:00
parent
82d6ad4616
commit
d2501e8886
@ -12,3 +12,7 @@ rustflags = ["-C", "link-arg=-fuse-ld=mold"]
|
|||||||
[target.aarch64-unknown-linux-gnu]
|
[target.aarch64-unknown-linux-gnu]
|
||||||
linker = "clang"
|
linker = "clang"
|
||||||
rustflags = ["-C", "link-arg=-fuse-ld=mold"]
|
rustflags = ["-C", "link-arg=-fuse-ld=mold"]
|
||||||
|
|
||||||
|
# This cfg will reduce the size of `windows::core::Error` from 16 bytes to 4 bytes
|
||||||
|
[target.'cfg(target_os = "windows")']
|
||||||
|
rustflags = ["--cfg", "windows_slim_errors"]
|
||||||
|
117
Cargo.lock
generated
117
Cargo.lock
generated
@ -2142,7 +2142,7 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
"serde",
|
"serde",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"windows-targets 0.52.5",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2353,7 +2353,7 @@ dependencies = [
|
|||||||
"tiny_http",
|
"tiny_http",
|
||||||
"url",
|
"url",
|
||||||
"util",
|
"util",
|
||||||
"windows 0.57.0",
|
"windows 0.58.0",
|
||||||
"worktree",
|
"worktree",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -4331,7 +4331,7 @@ dependencies = [
|
|||||||
"text",
|
"text",
|
||||||
"time",
|
"time",
|
||||||
"util",
|
"util",
|
||||||
"windows 0.57.0",
|
"windows 0.58.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -4651,7 +4651,7 @@ dependencies = [
|
|||||||
"unindent",
|
"unindent",
|
||||||
"url",
|
"url",
|
||||||
"util",
|
"util",
|
||||||
"windows 0.57.0",
|
"windows 0.58.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -4874,8 +4874,8 @@ dependencies = [
|
|||||||
"wayland-cursor",
|
"wayland-cursor",
|
||||||
"wayland-protocols",
|
"wayland-protocols",
|
||||||
"wayland-protocols-plasma",
|
"wayland-protocols-plasma",
|
||||||
"windows 0.57.0",
|
"windows 0.58.0",
|
||||||
"windows-core 0.57.0",
|
"windows-core 0.58.0",
|
||||||
"x11-clipboard",
|
"x11-clipboard",
|
||||||
"x11rb",
|
"x11rb",
|
||||||
"xim",
|
"xim",
|
||||||
@ -6314,7 +6314,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"smol",
|
"smol",
|
||||||
"util",
|
"util",
|
||||||
"windows 0.57.0",
|
"windows 0.58.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -6794,7 +6794,7 @@ dependencies = [
|
|||||||
"tempfile",
|
"tempfile",
|
||||||
"util",
|
"util",
|
||||||
"walkdir",
|
"walkdir",
|
||||||
"windows 0.57.0",
|
"windows 0.58.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -10768,7 +10768,7 @@ dependencies = [
|
|||||||
"theme",
|
"theme",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"util",
|
"util",
|
||||||
"windows 0.57.0",
|
"windows 0.58.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -11094,7 +11094,7 @@ dependencies = [
|
|||||||
"ui",
|
"ui",
|
||||||
"util",
|
"util",
|
||||||
"vcs_menu",
|
"vcs_menu",
|
||||||
"windows 0.57.0",
|
"windows 0.58.0",
|
||||||
"workspace",
|
"workspace",
|
||||||
"zed_actions",
|
"zed_actions",
|
||||||
]
|
]
|
||||||
@ -11722,7 +11722,7 @@ dependencies = [
|
|||||||
"story",
|
"story",
|
||||||
"strum",
|
"strum",
|
||||||
"theme",
|
"theme",
|
||||||
"windows 0.57.0",
|
"windows 0.58.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -12857,17 +12857,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
|
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-core 0.52.0",
|
"windows-core 0.52.0",
|
||||||
"windows-targets 0.52.5",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows"
|
name = "windows"
|
||||||
version = "0.57.0"
|
version = "0.58.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143"
|
checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-core 0.57.0",
|
"windows-core 0.58.0",
|
||||||
"windows-targets 0.52.5",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -12876,26 +12876,27 @@ version = "0.52.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
|
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-targets 0.52.5",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-core"
|
name = "windows-core"
|
||||||
version = "0.57.0"
|
version = "0.58.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d"
|
checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-implement",
|
"windows-implement",
|
||||||
"windows-interface",
|
"windows-interface",
|
||||||
"windows-result",
|
"windows-result",
|
||||||
"windows-targets 0.52.5",
|
"windows-strings",
|
||||||
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-implement"
|
name = "windows-implement"
|
||||||
version = "0.57.0"
|
version = "0.58.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7"
|
checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -12904,9 +12905,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-interface"
|
name = "windows-interface"
|
||||||
version = "0.57.0"
|
version = "0.58.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7"
|
checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -12915,11 +12916,21 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-result"
|
name = "windows-result"
|
||||||
version = "0.1.1"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "749f0da9cc72d82e600d8d2e44cadd0b9eedb9038f71a1c58556ac1c5791813b"
|
checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-targets 0.52.5",
|
"windows-targets 0.52.6",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-strings"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
|
||||||
|
dependencies = [
|
||||||
|
"windows-result",
|
||||||
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -12946,7 +12957,7 @@ version = "0.52.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-targets 0.52.5",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -12981,18 +12992,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-targets"
|
name = "windows-targets"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
|
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows_aarch64_gnullvm 0.52.5",
|
"windows_aarch64_gnullvm 0.52.6",
|
||||||
"windows_aarch64_msvc 0.52.5",
|
"windows_aarch64_msvc 0.52.6",
|
||||||
"windows_i686_gnu 0.52.5",
|
"windows_i686_gnu 0.52.6",
|
||||||
"windows_i686_gnullvm",
|
"windows_i686_gnullvm",
|
||||||
"windows_i686_msvc 0.52.5",
|
"windows_i686_msvc 0.52.6",
|
||||||
"windows_x86_64_gnu 0.52.5",
|
"windows_x86_64_gnu 0.52.6",
|
||||||
"windows_x86_64_gnullvm 0.52.5",
|
"windows_x86_64_gnullvm 0.52.6",
|
||||||
"windows_x86_64_msvc 0.52.5",
|
"windows_x86_64_msvc 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -13009,9 +13020,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_gnullvm"
|
name = "windows_aarch64_gnullvm"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
|
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_msvc"
|
name = "windows_aarch64_msvc"
|
||||||
@ -13027,9 +13038,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_msvc"
|
name = "windows_aarch64_msvc"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
|
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnu"
|
name = "windows_i686_gnu"
|
||||||
@ -13045,15 +13056,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnu"
|
name = "windows_i686_gnu"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
|
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnullvm"
|
name = "windows_i686_gnullvm"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
|
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_msvc"
|
name = "windows_i686_msvc"
|
||||||
@ -13069,9 +13080,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_msvc"
|
name = "windows_i686_msvc"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
|
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnu"
|
name = "windows_x86_64_gnu"
|
||||||
@ -13087,9 +13098,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnu"
|
name = "windows_x86_64_gnu"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
|
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnullvm"
|
name = "windows_x86_64_gnullvm"
|
||||||
@ -13105,9 +13116,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnullvm"
|
name = "windows_x86_64_gnullvm"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
|
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_msvc"
|
name = "windows_x86_64_msvc"
|
||||||
@ -13123,9 +13134,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_msvc"
|
name = "windows_x86_64_msvc"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
|
@ -445,7 +445,7 @@ wit-component = "0.201"
|
|||||||
sys-locale = "0.3.1"
|
sys-locale = "0.3.1"
|
||||||
|
|
||||||
[workspace.dependencies.windows]
|
[workspace.dependencies.windows]
|
||||||
version = "0.57"
|
version = "0.58"
|
||||||
features = [
|
features = [
|
||||||
"implement",
|
"implement",
|
||||||
"Foundation_Numerics",
|
"Foundation_Numerics",
|
||||||
|
@ -150,7 +150,7 @@ x11-clipboard = "0.9.2"
|
|||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
windows.workspace = true
|
windows.workspace = true
|
||||||
windows-core = "0.57"
|
windows-core = "0.58"
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "hello_world"
|
name = "hello_world"
|
||||||
|
@ -6,6 +6,7 @@ mod platform;
|
|||||||
mod system_settings;
|
mod system_settings;
|
||||||
mod util;
|
mod util;
|
||||||
mod window;
|
mod window;
|
||||||
|
mod wrapper;
|
||||||
|
|
||||||
pub(crate) use direct_write::*;
|
pub(crate) use direct_write::*;
|
||||||
pub(crate) use dispatcher::*;
|
pub(crate) use dispatcher::*;
|
||||||
@ -15,5 +16,6 @@ pub(crate) use platform::*;
|
|||||||
pub(crate) use system_settings::*;
|
pub(crate) use system_settings::*;
|
||||||
pub(crate) use util::*;
|
pub(crate) use util::*;
|
||||||
pub(crate) use window::*;
|
pub(crate) use window::*;
|
||||||
|
pub(crate) use wrapper::*;
|
||||||
|
|
||||||
pub(crate) use windows::Win32::Foundation::HWND;
|
pub(crate) use windows::Win32::Foundation::HWND;
|
||||||
|
@ -924,7 +924,7 @@ struct RendererContext<'t, 'a, 'b> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
impl IDWritePixelSnapping_Impl for TextRenderer {
|
impl IDWritePixelSnapping_Impl for TextRenderer_Impl {
|
||||||
fn IsPixelSnappingDisabled(
|
fn IsPixelSnappingDisabled(
|
||||||
&self,
|
&self,
|
||||||
_clientdrawingcontext: *const ::core::ffi::c_void,
|
_clientdrawingcontext: *const ::core::ffi::c_void,
|
||||||
@ -959,7 +959,7 @@ impl IDWritePixelSnapping_Impl for TextRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
impl IDWriteTextRenderer_Impl for TextRenderer {
|
impl IDWriteTextRenderer_Impl for TextRenderer_Impl {
|
||||||
fn DrawGlyphRun(
|
fn DrawGlyphRun(
|
||||||
&self,
|
&self,
|
||||||
clientdrawingcontext: *const ::core::ffi::c_void,
|
clientdrawingcontext: *const ::core::ffi::c_void,
|
||||||
|
@ -27,6 +27,10 @@ pub(crate) struct WindowsDisplay {
|
|||||||
uuid: Uuid,
|
uuid: Uuid,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The `HMONITOR` is thread-safe.
|
||||||
|
unsafe impl Send for WindowsDisplay {}
|
||||||
|
unsafe impl Sync for WindowsDisplay {}
|
||||||
|
|
||||||
impl WindowsDisplay {
|
impl WindowsDisplay {
|
||||||
pub(crate) fn new(display_id: DisplayId) -> Option<Self> {
|
pub(crate) fn new(display_id: DisplayId) -> Option<Self> {
|
||||||
let screen = available_monitors().into_iter().nth(display_id.0 as _)?;
|
let screen = available_monitors().into_iter().nth(display_id.0 as _)?;
|
||||||
|
@ -217,7 +217,7 @@ fn handle_destroy_msg(handle: HWND, state_ptr: Rc<WindowsWindowStatePtr>) -> Opt
|
|||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
PostMessageW(None, CLOSE_ONE_WINDOW, None, LPARAM(handle.0)).log_err();
|
PostMessageW(None, CLOSE_ONE_WINDOW, None, LPARAM(handle.0 as isize)).log_err();
|
||||||
}
|
}
|
||||||
Some(0)
|
Some(0)
|
||||||
}
|
}
|
||||||
@ -1040,7 +1040,7 @@ fn handle_nc_mouse_up_msg(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn handle_cursor_changed(lparam: LPARAM, state_ptr: Rc<WindowsWindowStatePtr>) -> Option<isize> {
|
fn handle_cursor_changed(lparam: LPARAM, state_ptr: Rc<WindowsWindowStatePtr>) -> Option<isize> {
|
||||||
state_ptr.state.borrow_mut().current_cursor = HCURSOR(lparam.0);
|
state_ptr.state.borrow_mut().current_cursor = HCURSOR(lparam.0 as _);
|
||||||
Some(0)
|
Some(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ impl Platform for WindowsPlatform {
|
|||||||
match msg.message {
|
match msg.message {
|
||||||
WM_QUIT => break 'a,
|
WM_QUIT => break 'a,
|
||||||
CLOSE_ONE_WINDOW => {
|
CLOSE_ONE_WINDOW => {
|
||||||
if self.close_one_window(HWND(msg.lParam.0)) {
|
if self.close_one_window(HWND(msg.lParam.0 as _)) {
|
||||||
break 'a;
|
break 'a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -484,7 +484,7 @@ impl Platform for WindowsPlatform {
|
|||||||
let hcursor = load_cursor(style);
|
let hcursor = load_cursor(style);
|
||||||
let mut lock = self.state.borrow_mut();
|
let mut lock = self.state.borrow_mut();
|
||||||
if lock.current_cursor.0 != hcursor.0 {
|
if lock.current_cursor.0 != hcursor.0 {
|
||||||
self.post_message(CURSOR_STYLE_CHANGED, WPARAM(0), LPARAM(hcursor.0));
|
self.post_message(CURSOR_STYLE_CHANGED, WPARAM(0), LPARAM(hcursor.0 as isize));
|
||||||
lock.current_cursor = hcursor;
|
lock.current_cursor = hcursor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -595,7 +595,7 @@ fn open_target(target: &str) {
|
|||||||
None,
|
None,
|
||||||
SW_SHOWDEFAULT,
|
SW_SHOWDEFAULT,
|
||||||
);
|
);
|
||||||
if ret.0 <= 32 {
|
if ret.0 as isize <= 32 {
|
||||||
log::error!("Unable to open target: {}", std::io::Error::last_os_error());
|
log::error!("Unable to open target: {}", std::io::Error::last_os_error());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -611,7 +611,7 @@ fn open_target_in_explorer(target: &str) {
|
|||||||
None,
|
None,
|
||||||
SW_SHOWDEFAULT,
|
SW_SHOWDEFAULT,
|
||||||
);
|
);
|
||||||
if ret.0 <= 32 {
|
if ret.0 as isize <= 32 {
|
||||||
log::error!(
|
log::error!(
|
||||||
"Unable to open target in explorer: {}",
|
"Unable to open target in explorer: {}",
|
||||||
std::io::Error::last_os_error()
|
std::io::Error::last_os_error()
|
||||||
@ -643,11 +643,12 @@ unsafe fn show_savefile_dialog(directory: PathBuf) -> Result<IFileSaveDialog> {
|
|||||||
Ok(dialog)
|
Ok(dialog)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn begin_vsync(vsync_evnet: HANDLE) {
|
fn begin_vsync(vsync_event: HANDLE) {
|
||||||
|
let event: SafeHandle = vsync_event.into();
|
||||||
std::thread::spawn(move || unsafe {
|
std::thread::spawn(move || unsafe {
|
||||||
loop {
|
loop {
|
||||||
windows::Win32::Graphics::Dwm::DwmFlush().log_err();
|
windows::Win32::Graphics::Dwm::DwmFlush().log_err();
|
||||||
SetEvent(vsync_evnet).log_err();
|
SetEvent(*event).log_err();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -723,7 +724,7 @@ fn set_data_to_clipboard(data: &[u16], format: u32) -> Result<()> {
|
|||||||
let handle = GlobalLock(global);
|
let handle = GlobalLock(global);
|
||||||
u_memcpy(handle as _, data.as_ptr(), data.len() as _);
|
u_memcpy(handle as _, data.as_ptr(), data.len() as _);
|
||||||
let _ = GlobalUnlock(global);
|
let _ = GlobalUnlock(global);
|
||||||
SetClipboardData(format, HANDLE(global.0 as isize))?;
|
SetClipboardData(format, HANDLE(global.0))?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -85,13 +85,13 @@ pub(crate) fn windows_credentials_target_name(url: &str) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn load_cursor(style: CursorStyle) -> HCURSOR {
|
pub(crate) fn load_cursor(style: CursorStyle) -> HCURSOR {
|
||||||
static ARROW: OnceLock<HCURSOR> = OnceLock::new();
|
static ARROW: OnceLock<SafeCursor> = OnceLock::new();
|
||||||
static IBEAM: OnceLock<HCURSOR> = OnceLock::new();
|
static IBEAM: OnceLock<SafeCursor> = OnceLock::new();
|
||||||
static CROSS: OnceLock<HCURSOR> = OnceLock::new();
|
static CROSS: OnceLock<SafeCursor> = OnceLock::new();
|
||||||
static HAND: OnceLock<HCURSOR> = OnceLock::new();
|
static HAND: OnceLock<SafeCursor> = OnceLock::new();
|
||||||
static SIZEWE: OnceLock<HCURSOR> = OnceLock::new();
|
static SIZEWE: OnceLock<SafeCursor> = OnceLock::new();
|
||||||
static SIZENS: OnceLock<HCURSOR> = OnceLock::new();
|
static SIZENS: OnceLock<SafeCursor> = OnceLock::new();
|
||||||
static NO: OnceLock<HCURSOR> = OnceLock::new();
|
static NO: OnceLock<SafeCursor> = OnceLock::new();
|
||||||
let (lock, name) = match style {
|
let (lock, name) = match style {
|
||||||
CursorStyle::IBeam | CursorStyle::IBeamCursorForVerticalLayout => (&IBEAM, IDC_IBEAM),
|
CursorStyle::IBeam | CursorStyle::IBeamCursorForVerticalLayout => (&IBEAM, IDC_IBEAM),
|
||||||
CursorStyle::Crosshair => (&CROSS, IDC_CROSS),
|
CursorStyle::Crosshair => (&CROSS, IDC_CROSS),
|
||||||
@ -107,14 +107,15 @@ pub(crate) fn load_cursor(style: CursorStyle) -> HCURSOR {
|
|||||||
CursorStyle::OperationNotAllowed => (&NO, IDC_NO),
|
CursorStyle::OperationNotAllowed => (&NO, IDC_NO),
|
||||||
_ => (&ARROW, IDC_ARROW),
|
_ => (&ARROW, IDC_ARROW),
|
||||||
};
|
};
|
||||||
*lock.get_or_init(|| {
|
*(*lock.get_or_init(|| {
|
||||||
HCURSOR(
|
HCURSOR(
|
||||||
unsafe { LoadImageW(None, name, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED) }
|
unsafe { LoadImageW(None, name, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED) }
|
||||||
.log_err()
|
.log_err()
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.0,
|
.0,
|
||||||
)
|
)
|
||||||
})
|
.into()
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -297,7 +297,7 @@ impl WindowsWindow {
|
|||||||
current_cursor,
|
current_cursor,
|
||||||
};
|
};
|
||||||
let lpparam = Some(&context as *const _ as *const _);
|
let lpparam = Some(&context as *const _ as *const _);
|
||||||
let raw_hwnd = unsafe {
|
let creation_result = unsafe {
|
||||||
CreateWindowExW(
|
CreateWindowExW(
|
||||||
dwexstyle,
|
dwexstyle,
|
||||||
classname,
|
classname,
|
||||||
@ -313,7 +313,10 @@ impl WindowsWindow {
|
|||||||
lpparam,
|
lpparam,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
// We should call `?` on state_ptr first, then call `?` on raw_hwnd.
|
||||||
|
// Or, we will lose the error info reported by `WindowsWindowState::new`
|
||||||
let state_ptr = context.inner.take().unwrap()?;
|
let state_ptr = context.inner.take().unwrap()?;
|
||||||
|
let raw_hwnd = creation_result?;
|
||||||
register_drag_drop(state_ptr.clone())?;
|
register_drag_drop(state_ptr.clone())?;
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -343,9 +346,10 @@ impl WindowsWindow {
|
|||||||
|
|
||||||
impl rwh::HasWindowHandle for WindowsWindow {
|
impl rwh::HasWindowHandle for WindowsWindow {
|
||||||
fn window_handle(&self) -> std::result::Result<rwh::WindowHandle<'_>, rwh::HandleError> {
|
fn window_handle(&self) -> std::result::Result<rwh::WindowHandle<'_>, rwh::HandleError> {
|
||||||
let raw =
|
let raw = rwh::Win32WindowHandle::new(unsafe {
|
||||||
rwh::Win32WindowHandle::new(unsafe { NonZeroIsize::new_unchecked(self.0.hwnd.0) })
|
NonZeroIsize::new_unchecked(self.0.hwnd.0 as isize)
|
||||||
.into();
|
})
|
||||||
|
.into();
|
||||||
Ok(unsafe { rwh::WindowHandle::borrow_raw(raw) })
|
Ok(unsafe { rwh::WindowHandle::borrow_raw(raw) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -509,8 +513,8 @@ impl PlatformWindow for WindowsWindow {
|
|||||||
|
|
||||||
fn activate(&self) {
|
fn activate(&self) {
|
||||||
let hwnd = self.0.hwnd;
|
let hwnd = self.0.hwnd;
|
||||||
unsafe { SetActiveWindow(hwnd) };
|
unsafe { SetActiveWindow(hwnd).log_err() };
|
||||||
unsafe { SetFocus(hwnd) };
|
unsafe { SetFocus(hwnd).log_err() };
|
||||||
// todo(windows)
|
// todo(windows)
|
||||||
// crate `windows 0.56` reports true as Err
|
// crate `windows 0.56` reports true as Err
|
||||||
unsafe { SetForegroundWindow(hwnd).as_bool() };
|
unsafe { SetForegroundWindow(hwnd).as_bool() };
|
||||||
@ -678,7 +682,7 @@ impl WindowsDragDropHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
impl IDropTarget_Impl for WindowsDragDropHandler {
|
impl IDropTarget_Impl for WindowsDragDropHandler_Impl {
|
||||||
fn DragEnter(
|
fn DragEnter(
|
||||||
&self,
|
&self,
|
||||||
pdataobj: Option<&IDataObject>,
|
pdataobj: Option<&IDataObject>,
|
||||||
@ -956,7 +960,7 @@ unsafe extern "system" fn wnd_proc(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn try_get_window_inner(hwnd: HWND) -> Option<Rc<WindowsWindowStatePtr>> {
|
pub(crate) fn try_get_window_inner(hwnd: HWND) -> Option<Rc<WindowsWindowStatePtr>> {
|
||||||
if hwnd == HWND(0) {
|
if hwnd.is_invalid() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1058,7 +1062,7 @@ mod windows_renderer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub(super) fn windows_renderer(hwnd: HWND, transparent: bool) -> anyhow::Result<BladeRenderer> {
|
pub(super) fn windows_renderer(hwnd: HWND, transparent: bool) -> anyhow::Result<BladeRenderer> {
|
||||||
let raw = RawWindow { hwnd: hwnd.0 };
|
let raw = RawWindow { hwnd };
|
||||||
let gpu: Arc<gpu::Context> = Arc::new(
|
let gpu: Arc<gpu::Context> = Arc::new(
|
||||||
unsafe {
|
unsafe {
|
||||||
gpu::Context::init_windowed(
|
gpu::Context::init_windowed(
|
||||||
@ -1081,15 +1085,15 @@ mod windows_renderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct RawWindow {
|
struct RawWindow {
|
||||||
hwnd: isize,
|
hwnd: HWND,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl rwh::HasWindowHandle for RawWindow {
|
impl rwh::HasWindowHandle for RawWindow {
|
||||||
fn window_handle(&self) -> Result<rwh::WindowHandle<'_>, rwh::HandleError> {
|
fn window_handle(&self) -> Result<rwh::WindowHandle<'_>, rwh::HandleError> {
|
||||||
Ok(unsafe {
|
Ok(unsafe {
|
||||||
let hwnd = NonZeroIsize::new_unchecked(self.hwnd);
|
let hwnd = NonZeroIsize::new_unchecked(self.hwnd.0 as isize);
|
||||||
let mut handle = rwh::Win32WindowHandle::new(hwnd);
|
let mut handle = rwh::Win32WindowHandle::new(hwnd);
|
||||||
let hinstance = get_window_long(HWND(self.hwnd), GWLP_HINSTANCE);
|
let hinstance = get_window_long(self.hwnd, GWLP_HINSTANCE);
|
||||||
handle.hinstance = NonZeroIsize::new(hinstance);
|
handle.hinstance = NonZeroIsize::new(hinstance);
|
||||||
rwh::WindowHandle::borrow_raw(handle.into())
|
rwh::WindowHandle::borrow_raw(handle.into())
|
||||||
})
|
})
|
||||||
|
47
crates/gpui/src/platform/windows/wrapper.rs
Normal file
47
crates/gpui/src/platform/windows/wrapper.rs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
use std::ops::Deref;
|
||||||
|
|
||||||
|
use windows::Win32::{Foundation::HANDLE, UI::WindowsAndMessaging::HCURSOR};
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
pub(crate) struct SafeHandle {
|
||||||
|
raw: HANDLE,
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl Send for SafeHandle {}
|
||||||
|
unsafe impl Sync for SafeHandle {}
|
||||||
|
|
||||||
|
impl From<HANDLE> for SafeHandle {
|
||||||
|
fn from(value: HANDLE) -> Self {
|
||||||
|
SafeHandle { raw: value }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Deref for SafeHandle {
|
||||||
|
type Target = HANDLE;
|
||||||
|
|
||||||
|
fn deref(&self) -> &Self::Target {
|
||||||
|
&self.raw
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
pub(crate) struct SafeCursor {
|
||||||
|
raw: HCURSOR,
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl Send for SafeCursor {}
|
||||||
|
unsafe impl Sync for SafeCursor {}
|
||||||
|
|
||||||
|
impl From<HCURSOR> for SafeCursor {
|
||||||
|
fn from(value: HCURSOR) -> Self {
|
||||||
|
SafeCursor { raw: value }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Deref for SafeCursor {
|
||||||
|
type Target = HCURSOR;
|
||||||
|
|
||||||
|
fn deref(&self) -> &Self::Target {
|
||||||
|
&self.raw
|
||||||
|
}
|
||||||
|
}
|
@ -38,9 +38,9 @@ impl ProcessIdGetter {
|
|||||||
fn new(pty: &Pty) -> ProcessIdGetter {
|
fn new(pty: &Pty) -> ProcessIdGetter {
|
||||||
let child = pty.child_watcher();
|
let child = pty.child_watcher();
|
||||||
let handle = child.raw_handle();
|
let handle = child.raw_handle();
|
||||||
let fallback_pid = child
|
let fallback_pid = child.pid().unwrap_or_else(|| unsafe {
|
||||||
.pid()
|
NonZeroU32::new_unchecked(GetProcessId(HANDLE(handle as _)))
|
||||||
.unwrap_or_else(|| unsafe { NonZeroU32::new_unchecked(GetProcessId(HANDLE(handle))) });
|
});
|
||||||
|
|
||||||
ProcessIdGetter {
|
ProcessIdGetter {
|
||||||
handle: handle as i32,
|
handle: handle as i32,
|
||||||
|
Loading…
Reference in New Issue
Block a user