mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 21:32:13 +03:00
Revert "deps: update to wgpu 0.19"
This reverts commitb4c5dc746d
. This reverts commit3214610f16
. This reverts commit3ec1cfba73
. This reverts commit47590bbedc
. This reverts commitea88dca296
. This reverts commitc269230b74
. This reverts commit1484e2a673
. This reverts commit6fd45c1223
. This reverts commit9acc2ae6c5
. refs: https://github.com/wez/wezterm/issues/4825 refs: https://github.com/wez/wezterm/issues/4826
This commit is contained in:
parent
7c452d312d
commit
bf07f6de0f
115
Cargo.lock
generated
115
Cargo.lock
generated
@ -648,12 +648,6 @@ version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "cfg_aliases"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
|
||||
|
||||
[[package]]
|
||||
name = "cgl"
|
||||
version = "0.3.2"
|
||||
@ -946,35 +940,10 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "com"
|
||||
version = "0.6.0"
|
||||
name = "com-rs"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e17887fd17353b65b1b2ef1c526c83e26cd72e74f598a8dc1bee13a48f3d9f6"
|
||||
dependencies = [
|
||||
"com_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "com_macros"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d375883580a668c7481ea6631fc1a8863e33cc335bf56bfad8d7e6d4b04b13a5"
|
||||
dependencies = [
|
||||
"com_macros_support",
|
||||
"proc-macro2",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "com_macros_support"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad899a1087a9296d5644792d7cb72b8e34c1bec8e7d4fbc002230169a6e8710c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642"
|
||||
|
||||
[[package]]
|
||||
name = "concurrent-queue"
|
||||
@ -1307,9 +1276,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "d3d12"
|
||||
version = "0.19.0"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307"
|
||||
checksum = "e16e44ab292b1dddfdaf7be62cfd8877df52f2f3fde5858d95bab606be259f20"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"libloading 0.8.1",
|
||||
@ -1712,7 +1681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "279d3efcc55e19917fff7ab3ddd6c14afb6a90881a0078465196fe2f99d08c56"
|
||||
dependencies = [
|
||||
"bit_field",
|
||||
"flume",
|
||||
"flume 0.10.14",
|
||||
"half 2.3.1",
|
||||
"lebe",
|
||||
"miniz_oxide 0.7.1",
|
||||
@ -1867,6 +1836,18 @@ dependencies = [
|
||||
"spin 0.9.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flume"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"nanorand",
|
||||
"spin 0.9.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
@ -2284,10 +2265,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gpu-allocator"
|
||||
version = "0.25.0"
|
||||
version = "0.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f56f6318968d03c18e1bcf4857ff88c61157e9da8e47c5f29055d60e1228884"
|
||||
checksum = "40fe17c8a05d60c38c0a4e5a3c802f2f1ceb66b76c67d96ffb34bef0475a7fad"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"log",
|
||||
"presser",
|
||||
"thiserror",
|
||||
@ -2416,14 +2398,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "hassle-rs"
|
||||
version = "0.11.0"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890"
|
||||
checksum = "1397650ee315e8891a0df210707f0fc61771b0cc518c3023896064c5407cb3b0"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"com",
|
||||
"bitflags 1.3.2",
|
||||
"com-rs",
|
||||
"libc",
|
||||
"libloading 0.8.1",
|
||||
"libloading 0.7.4",
|
||||
"thiserror",
|
||||
"widestring",
|
||||
"winapi",
|
||||
@ -3415,7 +3397,7 @@ dependencies = [
|
||||
"fancy-regex",
|
||||
"filedescriptor",
|
||||
"finl_unicode",
|
||||
"flume",
|
||||
"flume 0.10.14",
|
||||
"hostname",
|
||||
"k9 0.11.6",
|
||||
"lazy_static",
|
||||
@ -3470,9 +3452,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "naga"
|
||||
version = "0.19.0"
|
||||
version = "0.14.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8878eb410fc90853da3908aebfe61d73d26d4437ef850b70050461f939509899"
|
||||
checksum = "ae585df4b6514cf8842ac0f1ab4992edc975892704835b549cf818dc0191249e"
|
||||
dependencies = [
|
||||
"bit-set",
|
||||
"bitflags 2.4.2",
|
||||
@ -4296,7 +4278,7 @@ dependencies = [
|
||||
"async-executor",
|
||||
"async-io 1.13.0",
|
||||
"async-task",
|
||||
"flume",
|
||||
"flume 0.10.14",
|
||||
"lazy_static",
|
||||
"thiserror",
|
||||
]
|
||||
@ -4411,9 +4393,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "raw-window-handle"
|
||||
version = "0.6.0"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544"
|
||||
checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9"
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
@ -5171,11 +5153,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "spirv"
|
||||
version = "0.3.0+sdk-1.3.268.0"
|
||||
version = "0.2.0+1.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844"
|
||||
checksum = "246bfa38fe3db3f1dfc8ca5a2cdeb7348c78be2112740cc0ec8ef18b6d94f830"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"bitflags 1.3.2",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -6197,9 +6180,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.67"
|
||||
version = "0.3.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed"
|
||||
checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
@ -6652,13 +6635,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu"
|
||||
version = "0.19.0"
|
||||
version = "0.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0b71d2ded29e2161db50ab731d6cb42c037bd7ab94864a98fa66ff36b4721a8"
|
||||
checksum = "30e7d227c9f961f2061c26f4cb0fbd4df0ef37e056edd0931783599d6c94ef24"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"cfg-if",
|
||||
"cfg_aliases",
|
||||
"flume 0.11.0",
|
||||
"js-sys",
|
||||
"log",
|
||||
"naga",
|
||||
@ -6677,19 +6660,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-core"
|
||||
version = "0.19.0"
|
||||
version = "0.18.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b15e451d4060ada0d99a64df44e4d590213496da7c4f245572d51071e8e30ed"
|
||||
checksum = "ef91c1d62d1e9e81c79e600131a258edf75c9531cbdbde09c44a011a47312726"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bit-vec",
|
||||
"bitflags 2.4.2",
|
||||
"cfg_aliases",
|
||||
"codespan-reporting",
|
||||
"indexmap 2.1.0",
|
||||
"log",
|
||||
"naga",
|
||||
"once_cell",
|
||||
"parking_lot 0.12.1",
|
||||
"profiling",
|
||||
"raw-window-handle",
|
||||
@ -6703,9 +6683,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-hal"
|
||||
version = "0.19.0"
|
||||
version = "0.18.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "11f259ceb56727fb097da108d92f8a5cbdb5b74a77f9e396bd43626f67299d61"
|
||||
checksum = "b84ecc802da3eb67b4cf3dd9ea6fe45bbb47ef13e6c49c5c3240868a9cc6cdd9"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"arrayvec",
|
||||
@ -6713,7 +6693,6 @@ dependencies = [
|
||||
"bit-set",
|
||||
"bitflags 2.4.2",
|
||||
"block",
|
||||
"cfg_aliases",
|
||||
"core-graphics-types",
|
||||
"d3d12",
|
||||
"glow",
|
||||
@ -6747,9 +6726,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-types"
|
||||
version = "0.19.0"
|
||||
version = "0.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "895fcbeb772bfb049eb80b2d6e47f6c9af235284e9703c96fc0218a42ffd5af2"
|
||||
checksum = "0d5ed5f0edf0de351fe311c53304986315ce866f394a2e6df0c4b3c70774bcdd"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"js-sys",
|
||||
|
@ -105,7 +105,7 @@ wezterm-open-url = { path = "../wezterm-open-url" }
|
||||
wezterm-ssh = { path = "../wezterm-ssh" }
|
||||
wezterm-term = { path = "../term", features=["use_serde"] }
|
||||
wezterm-toast-notification = { path = "../wezterm-toast-notification" }
|
||||
wgpu = "0.19"
|
||||
wgpu = "0.18"
|
||||
window = { path = "../window" }
|
||||
window-funcs = { path = "../lua-api-crates/window-funcs" }
|
||||
|
||||
|
@ -88,7 +88,6 @@ pub fn register(lua: &Lua) -> anyhow::Result<()> {
|
||||
});
|
||||
let gpus: Vec<GpuInfo> = instance
|
||||
.enumerate_adapters(backends)
|
||||
.into_iter()
|
||||
.map(|adapter| {
|
||||
let info = adapter.get_info();
|
||||
crate::termwindow::webgpu::adapter_info_to_gpu_info(info)
|
||||
|
@ -6,8 +6,7 @@ use std::sync::Arc;
|
||||
use wgpu::util::DeviceExt;
|
||||
use window::bitmaps::Texture2d;
|
||||
use window::raw_window_handle::{
|
||||
DisplayHandle, HandleError, HasDisplayHandle, HasWindowHandle, RawDisplayHandle,
|
||||
RawWindowHandle, WindowHandle,
|
||||
HasRawDisplayHandle, HasRawWindowHandle, RawDisplayHandle, RawWindowHandle,
|
||||
};
|
||||
use window::{BitmapImage, Dimensions, Rect, Window};
|
||||
|
||||
@ -24,7 +23,7 @@ pub struct ShaderUniform {
|
||||
pub struct WebGpuState {
|
||||
pub adapter_info: wgpu::AdapterInfo,
|
||||
pub downlevel_caps: wgpu::DownlevelCapabilities,
|
||||
pub surface: wgpu::Surface<'static>,
|
||||
pub surface: wgpu::Surface,
|
||||
pub device: wgpu::Device,
|
||||
pub queue: Arc<wgpu::Queue>,
|
||||
pub config: RefCell<wgpu::SurfaceConfiguration>,
|
||||
@ -45,21 +44,21 @@ pub struct RawHandlePair {
|
||||
impl RawHandlePair {
|
||||
fn new(window: &Window) -> Self {
|
||||
Self {
|
||||
window: window.window_handle().expect("window handle").as_raw(),
|
||||
display: window.display_handle().expect("display handle").as_raw(),
|
||||
window: window.raw_window_handle(),
|
||||
display: window.raw_display_handle(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl HasWindowHandle for RawHandlePair {
|
||||
fn window_handle(&self) -> Result<WindowHandle, HandleError> {
|
||||
unsafe { Ok(WindowHandle::borrow_raw(self.window)) }
|
||||
unsafe impl HasRawWindowHandle for RawHandlePair {
|
||||
fn raw_window_handle(&self) -> RawWindowHandle {
|
||||
self.window
|
||||
}
|
||||
}
|
||||
|
||||
impl HasDisplayHandle for RawHandlePair {
|
||||
fn display_handle(&self) -> Result<DisplayHandle, HandleError> {
|
||||
unsafe { Ok(DisplayHandle::borrow_raw(self.display)) }
|
||||
unsafe impl HasRawDisplayHandle for RawHandlePair {
|
||||
fn raw_display_handle(&self) -> RawDisplayHandle {
|
||||
self.display
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,7 +194,6 @@ fn compute_compatibility_list(
|
||||
) -> Vec<String> {
|
||||
instance
|
||||
.enumerate_adapters(backends)
|
||||
.into_iter()
|
||||
.map(|a| {
|
||||
let info = adapter_info_to_gpu_info(a.get_info());
|
||||
let compatible = a.is_surface_supported(&surface);
|
||||
@ -228,9 +226,7 @@ impl WebGpuState {
|
||||
backends,
|
||||
..Default::default()
|
||||
});
|
||||
let surface = unsafe {
|
||||
instance.create_surface_unsafe(wgpu::SurfaceTargetUnsafe::from_window(&handle)?)?
|
||||
};
|
||||
let surface = unsafe { instance.create_surface(&handle)? };
|
||||
|
||||
let mut adapter: Option<wgpu::Adapter> = None;
|
||||
|
||||
@ -320,10 +316,10 @@ impl WebGpuState {
|
||||
let (device, queue) = adapter
|
||||
.request_device(
|
||||
&wgpu::DeviceDescriptor {
|
||||
required_features: wgpu::Features::empty(),
|
||||
features: wgpu::Features::empty(),
|
||||
// WebGL doesn't support all of wgpu's features, so if
|
||||
// we're building for the web we'll have to disable some.
|
||||
required_limits: if cfg!(target_arch = "wasm32") {
|
||||
limits: if cfg!(target_arch = "wasm32") {
|
||||
wgpu::Limits::downlevel_webgl2_defaults()
|
||||
} else {
|
||||
wgpu::Limits::downlevel_defaults()
|
||||
@ -378,7 +374,6 @@ impl WebGpuState {
|
||||
wgpu::CompositeAlphaMode::Auto
|
||||
},
|
||||
view_formats,
|
||||
desired_maximum_frame_latency: 2,
|
||||
};
|
||||
surface.configure(&device, &config);
|
||||
|
||||
@ -533,7 +528,7 @@ impl WebGpuState {
|
||||
#[cfg(windows)]
|
||||
RawWindowHandle::Win32(h) => {
|
||||
let mut rect = unsafe { std::mem::zeroed() };
|
||||
unsafe { winapi::um::winuser::GetClientRect(h.hwnd.get() as _, &mut rect) };
|
||||
unsafe { winapi::um::winuser::GetClientRect(h.hwnd as _, &mut rect) };
|
||||
dims.pixel_width = (rect.right - rect.left) as usize;
|
||||
dims.pixel_height = (rect.bottom - rect.top) as usize;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ line_drawing = "0.8"
|
||||
log = "0.4"
|
||||
metrics = { version="0.17", features=["std"]}
|
||||
promise = { path = "../promise" }
|
||||
raw-window-handle = "0.6"
|
||||
raw-window-handle = "0.5"
|
||||
resize = "0.5"
|
||||
serde = {version="1.0", features = ["rc", "derive"]}
|
||||
tiny-skia = "0.11"
|
||||
|
@ -38,14 +38,13 @@ use objc::runtime::{Class, Object, Protocol, Sel};
|
||||
use objc::*;
|
||||
use promise::Future;
|
||||
use raw_window_handle::{
|
||||
AppKitDisplayHandle, AppKitWindowHandle, DisplayHandle, HandleError, HasDisplayHandle,
|
||||
HasWindowHandle, RawDisplayHandle, RawWindowHandle, WindowHandle,
|
||||
AppKitDisplayHandle, AppKitWindowHandle, HasRawDisplayHandle, HasRawWindowHandle,
|
||||
RawDisplayHandle, RawWindowHandle,
|
||||
};
|
||||
use std::any::Any;
|
||||
use std::cell::RefCell;
|
||||
use std::ffi::c_void;
|
||||
use std::path::PathBuf;
|
||||
use std::ptr::NonNull;
|
||||
use std::rc::Rc;
|
||||
use std::str::FromStr;
|
||||
use std::time::Instant;
|
||||
@ -650,21 +649,18 @@ impl Window {
|
||||
}
|
||||
}
|
||||
|
||||
impl HasDisplayHandle for Window {
|
||||
fn display_handle(&self) -> Result<DisplayHandle, HandleError> {
|
||||
unsafe {
|
||||
Ok(DisplayHandle::borrow_raw(RawDisplayHandle::AppKit(
|
||||
AppKitDisplayHandle::new(),
|
||||
)))
|
||||
}
|
||||
unsafe impl HasRawDisplayHandle for Window {
|
||||
fn raw_display_handle(&self) -> RawDisplayHandle {
|
||||
RawDisplayHandle::AppKit(AppKitDisplayHandle::empty())
|
||||
}
|
||||
}
|
||||
|
||||
impl HasWindowHandle for Window {
|
||||
fn window_handle(&self) -> Result<WindowHandle, HandleError> {
|
||||
let mut handle =
|
||||
AppKitWindowHandle::new(NonNull::new(self.ns_view as *mut _).expect("non-null"));
|
||||
unsafe { Ok(WindowHandle::borrow_raw(RawWindowHandle::AppKit(handle))) }
|
||||
unsafe impl HasRawWindowHandle for Window {
|
||||
fn raw_window_handle(&self) -> RawWindowHandle {
|
||||
let mut handle = AppKitWindowHandle::empty();
|
||||
handle.ns_window = self.ns_window as *mut _;
|
||||
handle.ns_view = self.ns_view as *mut _;
|
||||
RawWindowHandle::AppKit(handle)
|
||||
}
|
||||
}
|
||||
|
||||
@ -823,13 +819,18 @@ impl WindowOps for Window {
|
||||
_config: &ConfigHandle,
|
||||
window_state: WindowState,
|
||||
) -> anyhow::Result<Option<Parameters>> {
|
||||
let raw = self.raw_window_handle();
|
||||
|
||||
// We implement this method primarily to provide Notch-avoidance for
|
||||
// systems with a notch.
|
||||
// We only need this for non-native full screen mode.
|
||||
|
||||
let native_full_screen = {
|
||||
let style_mask = unsafe { NSWindow::styleMask(self.ns_window) };
|
||||
style_mask.contains(NSWindowStyleMask::NSFullScreenWindowMask)
|
||||
let native_full_screen = match raw {
|
||||
RawWindowHandle::AppKit(raw) => {
|
||||
let style_mask = unsafe { NSWindow::styleMask(raw.ns_window as *mut Object) };
|
||||
style_mask.contains(NSWindowStyleMask::NSFullScreenWindowMask)
|
||||
}
|
||||
_ => false,
|
||||
};
|
||||
|
||||
let border_dimensions =
|
||||
|
@ -17,8 +17,8 @@ use config::ConfigHandle;
|
||||
use filedescriptor::FileDescriptor;
|
||||
use promise::{Future, Promise};
|
||||
use raw_window_handle::{
|
||||
DisplayHandle, HandleError, HasDisplayHandle, HasWindowHandle, RawDisplayHandle,
|
||||
RawWindowHandle, WaylandDisplayHandle, WaylandWindowHandle, WindowHandle,
|
||||
HasRawDisplayHandle, HasRawWindowHandle, RawDisplayHandle, RawWindowHandle,
|
||||
WaylandDisplayHandle, WaylandWindowHandle,
|
||||
};
|
||||
use smithay_client_toolkit as toolkit;
|
||||
use std::any::Any;
|
||||
@ -27,7 +27,6 @@ use std::convert::TryInto;
|
||||
use std::io::Read;
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::path::PathBuf;
|
||||
use std::ptr::NonNull;
|
||||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::{Duration, Instant};
|
||||
@ -395,22 +394,20 @@ impl WaylandWindow {
|
||||
}
|
||||
}
|
||||
|
||||
impl HasDisplayHandle for WaylandWindowInner {
|
||||
fn display_handle(&self) -> Result<DisplayHandle, HandleError> {
|
||||
unsafe impl HasRawDisplayHandle for WaylandWindowInner {
|
||||
fn raw_display_handle(&self) -> RawDisplayHandle {
|
||||
let mut handle = WaylandDisplayHandle::empty();
|
||||
let conn = WaylandConnection::get().unwrap().wayland();
|
||||
let handle = WaylandDisplayHandle::new(
|
||||
NonNull::new(conn.display.borrow().c_ptr() as _).expect("non-null"),
|
||||
);
|
||||
unsafe { Ok(DisplayHandle::borrow_raw(RawDisplayHandle::Wayland(handle))) }
|
||||
handle.display = conn.display.borrow().c_ptr() as _;
|
||||
RawDisplayHandle::Wayland(handle)
|
||||
}
|
||||
}
|
||||
|
||||
impl HasWindowHandle for WaylandWindowInner {
|
||||
fn window_handle(&self) -> Result<WindowHandle, HandleError> {
|
||||
let handle = WaylandWindowHandle::new(
|
||||
NonNull::new(self.surface.as_ref().c_ptr() as _).expect("non-null"),
|
||||
);
|
||||
unsafe { Ok(WindowHandle::borrow_raw(RawWindowHandle::Wayland(handle))) }
|
||||
unsafe impl HasRawWindowHandle for WaylandWindowInner {
|
||||
fn raw_window_handle(&self) -> RawWindowHandle {
|
||||
let mut handle = WaylandWindowHandle::empty();
|
||||
handle.surface = self.surface.as_ref().c_ptr() as *mut _;
|
||||
RawWindowHandle::Wayland(handle)
|
||||
}
|
||||
}
|
||||
|
||||
@ -847,18 +844,17 @@ impl WaylandWindowInner {
|
||||
}
|
||||
}
|
||||
|
||||
impl HasDisplayHandle for WaylandWindow {
|
||||
fn display_handle(&self) -> Result<DisplayHandle, HandleError> {
|
||||
unsafe impl HasRawDisplayHandle for WaylandWindow {
|
||||
fn raw_display_handle(&self) -> RawDisplayHandle {
|
||||
let mut handle = WaylandDisplayHandle::empty();
|
||||
let conn = WaylandConnection::get().unwrap().wayland();
|
||||
let handle = WaylandDisplayHandle::new(
|
||||
NonNull::new(conn.display.borrow().c_ptr() as _).expect("non-null"),
|
||||
);
|
||||
unsafe { Ok(DisplayHandle::borrow_raw(RawDisplayHandle::Wayland(handle))) }
|
||||
handle.display = conn.display.borrow().c_ptr() as _;
|
||||
RawDisplayHandle::Wayland(handle)
|
||||
}
|
||||
}
|
||||
|
||||
impl HasWindowHandle for WaylandWindow {
|
||||
fn window_handle(&self) -> Result<WindowHandle, HandleError> {
|
||||
unsafe impl HasRawWindowHandle for WaylandWindow {
|
||||
fn raw_window_handle(&self) -> RawWindowHandle {
|
||||
let conn = Connection::get().expect("raw_window_handle only callable on main thread");
|
||||
let handle = conn
|
||||
.wayland()
|
||||
@ -866,8 +862,7 @@ impl HasWindowHandle for WaylandWindow {
|
||||
.expect("window handle invalid!?");
|
||||
|
||||
let inner = handle.borrow();
|
||||
let handle = inner.window_handle()?;
|
||||
unsafe { Ok(WindowHandle::borrow_raw(handle.as_raw())) }
|
||||
inner.raw_window_handle()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,8 @@ use config::{ConfigHandle, ImePreeditRendering, SystemBackdrop};
|
||||
use lazy_static::lazy_static;
|
||||
use promise::Future;
|
||||
use raw_window_handle::{
|
||||
DisplayHandle, HandleError, HasDisplayHandle, HasWindowHandle, RawDisplayHandle,
|
||||
RawWindowHandle, Win32WindowHandle, WindowHandle, WindowsDisplayHandle,
|
||||
HasRawDisplayHandle, HasRawWindowHandle, RawDisplayHandle, RawWindowHandle, Win32WindowHandle,
|
||||
WindowsDisplayHandle,
|
||||
};
|
||||
use shared_library::shared_library;
|
||||
use std::any::Any;
|
||||
@ -23,7 +23,6 @@ use std::collections::HashMap;
|
||||
use std::convert::TryInto;
|
||||
use std::ffi::OsString;
|
||||
use std::io::{self, Error as IoError};
|
||||
use std::num::NonZeroIsize;
|
||||
use std::os::windows::ffi::OsStringExt;
|
||||
use std::path::PathBuf;
|
||||
use std::ptr::{null, null_mut};
|
||||
@ -195,22 +194,18 @@ fn callback_behavior() -> glium::debug::DebugCallbackBehavior {
|
||||
}
|
||||
}
|
||||
|
||||
impl HasDisplayHandle for WindowInner {
|
||||
fn display_handle(&self) -> Result<DisplayHandle, HandleError> {
|
||||
unsafe {
|
||||
Ok(DisplayHandle::borrow_raw(RawDisplayHandle::Windows(
|
||||
WindowsDisplayHandle::new(),
|
||||
)))
|
||||
}
|
||||
unsafe impl HasRawDisplayHandle for WindowInner {
|
||||
fn raw_display_handle(&self) -> RawDisplayHandle {
|
||||
RawDisplayHandle::Windows(WindowsDisplayHandle::empty())
|
||||
}
|
||||
}
|
||||
|
||||
impl HasWindowHandle for WindowInner {
|
||||
fn window_handle(&self) -> Result<WindowHandle, HandleError> {
|
||||
let mut handle =
|
||||
Win32WindowHandle::new(NonZeroIsize::new(self.hwnd.0 as _).expect("non-zero"));
|
||||
handle.hinstance = NonZeroIsize::new(unsafe { GetModuleHandleW(null()) } as _);
|
||||
unsafe { Ok(WindowHandle::borrow_raw(RawWindowHandle::Win32(handle))) }
|
||||
unsafe impl HasRawWindowHandle for WindowInner {
|
||||
fn raw_window_handle(&self) -> RawWindowHandle {
|
||||
let mut handle = Win32WindowHandle::empty();
|
||||
handle.hwnd = self.hwnd.0 as *mut _;
|
||||
handle.hinstance = unsafe { GetModuleHandleW(null()) } as _;
|
||||
RawWindowHandle::Win32(handle)
|
||||
}
|
||||
}
|
||||
|
||||
@ -718,24 +713,19 @@ impl WindowInner {
|
||||
}
|
||||
}
|
||||
|
||||
impl HasDisplayHandle for Window {
|
||||
fn display_handle(&self) -> Result<DisplayHandle, HandleError> {
|
||||
unsafe {
|
||||
Ok(DisplayHandle::borrow_raw(RawDisplayHandle::Windows(
|
||||
WindowsDisplayHandle::new(),
|
||||
)))
|
||||
}
|
||||
unsafe impl HasRawDisplayHandle for Window {
|
||||
fn raw_display_handle(&self) -> RawDisplayHandle {
|
||||
RawDisplayHandle::Windows(WindowsDisplayHandle::empty())
|
||||
}
|
||||
}
|
||||
|
||||
impl HasWindowHandle for Window {
|
||||
fn window_handle(&self) -> Result<WindowHandle, HandleError> {
|
||||
unsafe impl HasRawWindowHandle for Window {
|
||||
fn raw_window_handle(&self) -> RawWindowHandle {
|
||||
let conn = Connection::get().expect("raw_window_handle only callable on main thread");
|
||||
let handle = conn.get_window(self.0).expect("window handle invalid!?");
|
||||
|
||||
let inner = handle.borrow();
|
||||
let handle = inner.window_handle()?;
|
||||
unsafe { Ok(WindowHandle::borrow_raw(handle.as_raw())) }
|
||||
inner.raw_window_handle()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,13 +13,11 @@ use async_trait::async_trait;
|
||||
use config::ConfigHandle;
|
||||
use promise::{Future, Promise};
|
||||
use raw_window_handle::{
|
||||
DisplayHandle, HandleError, HasDisplayHandle, HasWindowHandle, RawDisplayHandle,
|
||||
RawWindowHandle, WindowHandle, XcbDisplayHandle, XcbWindowHandle,
|
||||
HasRawDisplayHandle, HasRawWindowHandle, RawDisplayHandle, RawWindowHandle, XcbDisplayHandle,
|
||||
XcbWindowHandle,
|
||||
};
|
||||
use std::any::Any;
|
||||
use std::convert::TryInto;
|
||||
use std::num::NonZeroU32;
|
||||
use std::ptr::NonNull;
|
||||
use std::rc::{Rc, Weak};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use wezterm_font::FontConfiguration;
|
||||
@ -105,24 +103,24 @@ impl Drop for XWindowInner {
|
||||
}
|
||||
}
|
||||
|
||||
impl HasDisplayHandle for XWindowInner {
|
||||
fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError> {
|
||||
unsafe impl HasRawDisplayHandle for XWindowInner {
|
||||
fn raw_display_handle(&self) -> RawDisplayHandle {
|
||||
let mut handle = XcbDisplayHandle::empty();
|
||||
if let Some(conn) = self.conn.upgrade() {
|
||||
let handle =
|
||||
XcbDisplayHandle::new(NonNull::new(conn.conn.get_raw_conn() as _), conn.screen_num);
|
||||
unsafe { Ok(DisplayHandle::borrow_raw(RawDisplayHandle::Xcb(handle))) }
|
||||
} else {
|
||||
Err(HandleError::Unavailable)
|
||||
handle.connection = conn.conn.get_raw_conn() as _;
|
||||
handle.screen = conn.screen_num;
|
||||
}
|
||||
|
||||
RawDisplayHandle::Xcb(handle)
|
||||
}
|
||||
}
|
||||
|
||||
impl HasWindowHandle for XWindowInner {
|
||||
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError> {
|
||||
let mut handle =
|
||||
XcbWindowHandle::new(NonZeroU32::new(self.window_id.resource_id()).expect("non-zero"));
|
||||
handle.visual_id = NonZeroU32::new(self.conn.upgrade().unwrap().visual.visual_id());
|
||||
unsafe { Ok(WindowHandle::borrow_raw(RawWindowHandle::Xcb(handle))) }
|
||||
unsafe impl HasRawWindowHandle for XWindowInner {
|
||||
fn raw_window_handle(&self) -> RawWindowHandle {
|
||||
let mut handle = XcbWindowHandle::empty();
|
||||
handle.window = self.window_id.resource_id();
|
||||
handle.visual_id = self.conn.upgrade().unwrap().visual.visual_id();
|
||||
RawWindowHandle::Xcb(handle)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1567,28 +1565,29 @@ impl XWindowInner {
|
||||
}
|
||||
}
|
||||
|
||||
impl HasDisplayHandle for XWindow {
|
||||
fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError> {
|
||||
unsafe impl HasRawDisplayHandle for XWindow {
|
||||
fn raw_display_handle(&self) -> RawDisplayHandle {
|
||||
let conn = Connection::get()
|
||||
.expect("display_handle only callable on main thread")
|
||||
.expect("raw_window_handle only callable on main thread")
|
||||
.x11();
|
||||
let handle = XcbDisplayHandle::new(NonNull::new(conn.get_raw_conn() as _), conn.screen_num);
|
||||
let mut handle = XcbDisplayHandle::empty();
|
||||
handle.connection = conn.get_raw_conn() as _;
|
||||
handle.screen = conn.screen_num;
|
||||
|
||||
unsafe { Ok(DisplayHandle::borrow_raw(RawDisplayHandle::Xcb(handle))) }
|
||||
RawDisplayHandle::Xcb(handle)
|
||||
}
|
||||
}
|
||||
|
||||
impl HasWindowHandle for XWindow {
|
||||
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError> {
|
||||
let conn = Connection::get().expect("window_handle only callable on main thread");
|
||||
unsafe impl HasRawWindowHandle for XWindow {
|
||||
fn raw_window_handle(&self) -> RawWindowHandle {
|
||||
let conn = Connection::get().expect("raw_window_handle only callable on main thread");
|
||||
let handle = conn
|
||||
.x11()
|
||||
.window_by_id(self.0)
|
||||
.expect("window handle invalid!?");
|
||||
|
||||
let inner = handle.lock().unwrap();
|
||||
let handle = inner.window_handle()?;
|
||||
unsafe { Ok(WindowHandle::borrow_raw(handle.as_raw())) }
|
||||
inner.raw_window_handle()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ use async_trait::async_trait;
|
||||
use config::ConfigHandle;
|
||||
use promise::*;
|
||||
use raw_window_handle::{
|
||||
DisplayHandle, HandleError, HasDisplayHandle, HasWindowHandle, WindowHandle,
|
||||
HasRawDisplayHandle, HasRawWindowHandle, RawDisplayHandle, RawWindowHandle,
|
||||
};
|
||||
use std::any::Any;
|
||||
use std::rc::Rc;
|
||||
@ -202,22 +202,22 @@ impl Window {
|
||||
}
|
||||
}
|
||||
|
||||
impl HasDisplayHandle for Window {
|
||||
fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError> {
|
||||
unsafe impl HasRawDisplayHandle for Window {
|
||||
fn raw_display_handle(&self) -> RawDisplayHandle {
|
||||
match self {
|
||||
Self::X11(x) => x.display_handle(),
|
||||
Self::X11(x) => x.raw_display_handle(),
|
||||
#[cfg(feature = "wayland")]
|
||||
Self::Wayland(w) => w.display_handle(),
|
||||
Self::Wayland(w) => w.raw_display_handle(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl HasWindowHandle for Window {
|
||||
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError> {
|
||||
unsafe impl HasRawWindowHandle for Window {
|
||||
fn raw_window_handle(&self) -> RawWindowHandle {
|
||||
match self {
|
||||
Self::X11(x) => x.window_handle(),
|
||||
Self::X11(x) => x.raw_window_handle(),
|
||||
#[cfg(feature = "wayland")]
|
||||
Self::Wayland(w) => w.window_handle(),
|
||||
Self::Wayland(w) => w.raw_window_handle(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user