mirror of
https://github.com/wez/wezterm.git
synced 2024-11-23 06:54:45 +03:00
maybe fixup build for wgpu 0.19 on macos and windows
This commit is contained in:
parent
6938701cd3
commit
6fd45c1223
@ -38,8 +38,8 @@ use objc::runtime::{Class, Object, Protocol, Sel};
|
|||||||
use objc::*;
|
use objc::*;
|
||||||
use promise::Future;
|
use promise::Future;
|
||||||
use raw_window_handle::{
|
use raw_window_handle::{
|
||||||
AppKitDisplayHandle, AppKitWindowHandle, HasRawDisplayHandle, HasRawWindowHandle,
|
AppKitDisplayHandle, AppKitWindowHandle, DisplayHandle, HandleError, HasDisplayHandle,
|
||||||
RawDisplayHandle, RawWindowHandle,
|
HasWindowHandle, RawDisplayHandle, RawWindowHandle, WindowHandle,
|
||||||
};
|
};
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
@ -649,18 +649,21 @@ impl Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl HasRawDisplayHandle for Window {
|
impl HasDisplayHandle for Window {
|
||||||
fn raw_display_handle(&self) -> RawDisplayHandle {
|
fn display_handle(&self) -> Result<DisplayHandle, HandleError> {
|
||||||
RawDisplayHandle::AppKit(AppKitDisplayHandle::empty())
|
unsafe {
|
||||||
|
Ok(DisplayHandle::from_raw(RawDisplayHandle::AppKit(
|
||||||
|
AppKitDisplayHandle::new(),
|
||||||
|
)))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl HasRawWindowHandle for Window {
|
impl HasWindowHandle for Window {
|
||||||
fn raw_window_handle(&self) -> RawWindowHandle {
|
fn window_handle(&self) -> Result<WindowHandle, HandleError> {
|
||||||
let mut handle = AppKitWindowHandle::empty();
|
let mut handle =
|
||||||
handle.ns_window = self.ns_window as *mut _;
|
AppKitWindowHandle::new(NonNull::new(self.ns_view as *mut _).expect("non-null"));
|
||||||
handle.ns_view = self.ns_view as *mut _;
|
unsafe { Ok(WindowHandle::from_raw(RawWindowHandle::AppKit(handle))) }
|
||||||
RawWindowHandle::AppKit(handle)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ use config::{ConfigHandle, ImePreeditRendering, SystemBackdrop};
|
|||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use promise::Future;
|
use promise::Future;
|
||||||
use raw_window_handle::{
|
use raw_window_handle::{
|
||||||
HasRawDisplayHandle, HasRawWindowHandle, RawDisplayHandle, RawWindowHandle, Win32WindowHandle,
|
DisplayHandle, HandleError, RawDisplayHandle, RawWindowHandle, Win32WindowHandle, WindowHandle,
|
||||||
WindowsDisplayHandle,
|
WindowsDisplayHandle,
|
||||||
};
|
};
|
||||||
use shared_library::shared_library;
|
use shared_library::shared_library;
|
||||||
@ -23,6 +23,7 @@ use std::collections::HashMap;
|
|||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use std::io::{self, Error as IoError};
|
use std::io::{self, Error as IoError};
|
||||||
|
use std::num::NonZeroIsize;
|
||||||
use std::os::windows::ffi::OsStringExt;
|
use std::os::windows::ffi::OsStringExt;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::ptr::{null, null_mut};
|
use std::ptr::{null, null_mut};
|
||||||
@ -194,18 +195,22 @@ fn callback_behavior() -> glium::debug::DebugCallbackBehavior {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl HasRawDisplayHandle for WindowInner {
|
impl HasDisplayHandle for WindowInner {
|
||||||
fn raw_display_handle(&self) -> RawDisplayHandle {
|
fn display_handle(&self) -> Result<DisplayHandle, HandleError> {
|
||||||
RawDisplayHandle::Windows(WindowsDisplayHandle::empty())
|
unsafe {
|
||||||
|
Ok(DisplayHandle::from_raw(RawDisplayHandle::Windows(
|
||||||
|
WindowsDisplayHandle::new(),
|
||||||
|
)))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl HasRawWindowHandle for WindowInner {
|
impl HasWindowHandle for WindowInner {
|
||||||
fn raw_window_handle(&self) -> RawWindowHandle {
|
fn window_handle(&self) -> Result<WindowHandle, HandleError> {
|
||||||
let mut handle = Win32WindowHandle::empty();
|
let mut handle =
|
||||||
handle.hwnd = self.hwnd.0 as *mut _;
|
Win32WindowHandle::new(NonZeroIsize::new(self.hwnd.0 as _).expect("non-zero"));
|
||||||
handle.hinstance = unsafe { GetModuleHandleW(null()) } as _;
|
handle.hinstance = NonZeroIsize::new(unsafe { GetModuleHandleW(null()) } as _);
|
||||||
RawWindowHandle::Win32(handle)
|
unsafe { Ok(WindowHandle::from_raw(RawWindowHandle::Win32(handle))) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -713,14 +718,18 @@ impl WindowInner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl HasRawDisplayHandle for Window {
|
impl HasDisplayHandle for Window {
|
||||||
fn raw_display_handle(&self) -> RawDisplayHandle {
|
fn display_handle(&self) -> Result<DisplayHandle, HandleError> {
|
||||||
RawDisplayHandle::Windows(WindowsDisplayHandle::empty())
|
unsafe {
|
||||||
|
Ok(DisplayHandle::from_raw(RawDisplayHandle::Windows(
|
||||||
|
WindowsDisplayHandle::new(),
|
||||||
|
)))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl HasRawWindowHandle for Window {
|
impl HasWindowHandle for Window {
|
||||||
fn raw_window_handle(&self) -> RawWindowHandle {
|
fn window_handle(&self) -> Result<WindowHandle, HandleError> {
|
||||||
let conn = Connection::get().expect("raw_window_handle only callable on main thread");
|
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 handle = conn.get_window(self.0).expect("window handle invalid!?");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user