chore: Bump Rust version to 1.88 (#33439)
Goodies in this version: - if-let chains 🎉 - Better compiler perf for Zed (https://github.com/rust-lang/rust/pull/138522) For more, see: https://releases.rs/docs/1.88.0/ Release Notes: - N/A --------- Co-authored-by: Junkui Zhang <364772080@qq.com>
This commit is contained in:
parent
b079871428
commit
985dcf7523
31 changed files with 112 additions and 303 deletions
|
@ -29,14 +29,14 @@ pub unsafe fn new_renderer(
|
|||
}
|
||||
|
||||
impl rwh::HasWindowHandle for RawWindow {
|
||||
fn window_handle(&self) -> Result<rwh::WindowHandle, rwh::HandleError> {
|
||||
fn window_handle(&self) -> Result<rwh::WindowHandle<'_>, rwh::HandleError> {
|
||||
let view = NonNull::new(self.view).unwrap();
|
||||
let handle = rwh::AppKitWindowHandle::new(view);
|
||||
Ok(unsafe { rwh::WindowHandle::borrow_raw(handle.into()) })
|
||||
}
|
||||
}
|
||||
impl rwh::HasDisplayHandle for RawWindow {
|
||||
fn display_handle(&self) -> Result<rwh::DisplayHandle, rwh::HandleError> {
|
||||
fn display_handle(&self) -> Result<rwh::DisplayHandle<'_>, rwh::HandleError> {
|
||||
let handle = rwh::AppKitDisplayHandle::new();
|
||||
Ok(unsafe { rwh::DisplayHandle::borrow_raw(handle.into()) })
|
||||
}
|
||||
|
|
|
@ -252,11 +252,11 @@ impl Drop for WaylandWindow {
|
|||
}
|
||||
|
||||
impl WaylandWindow {
|
||||
fn borrow(&self) -> Ref<WaylandWindowState> {
|
||||
fn borrow(&self) -> Ref<'_, WaylandWindowState> {
|
||||
self.0.state.borrow()
|
||||
}
|
||||
|
||||
fn borrow_mut(&self) -> RefMut<WaylandWindowState> {
|
||||
fn borrow_mut(&self) -> RefMut<'_, WaylandWindowState> {
|
||||
self.0.state.borrow_mut()
|
||||
}
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ pub(crate) struct X11WindowStatePtr {
|
|||
}
|
||||
|
||||
impl rwh::HasWindowHandle for RawWindow {
|
||||
fn window_handle(&self) -> Result<rwh::WindowHandle, rwh::HandleError> {
|
||||
fn window_handle(&self) -> Result<rwh::WindowHandle<'_>, rwh::HandleError> {
|
||||
let Some(non_zero) = NonZeroU32::new(self.window_id) else {
|
||||
log::error!("RawWindow.window_id zero when getting window handle.");
|
||||
return Err(rwh::HandleError::Unavailable);
|
||||
|
@ -299,7 +299,7 @@ impl rwh::HasWindowHandle for RawWindow {
|
|||
}
|
||||
}
|
||||
impl rwh::HasDisplayHandle for RawWindow {
|
||||
fn display_handle(&self) -> Result<rwh::DisplayHandle, rwh::HandleError> {
|
||||
fn display_handle(&self) -> Result<rwh::DisplayHandle<'_>, rwh::HandleError> {
|
||||
let Some(non_zero) = NonNull::new(self.connection) else {
|
||||
log::error!("Null RawWindow.connection when getting display handle.");
|
||||
return Err(rwh::HandleError::Unavailable);
|
||||
|
@ -310,12 +310,12 @@ impl rwh::HasDisplayHandle for RawWindow {
|
|||
}
|
||||
|
||||
impl rwh::HasWindowHandle for X11Window {
|
||||
fn window_handle(&self) -> Result<rwh::WindowHandle, rwh::HandleError> {
|
||||
fn window_handle(&self) -> Result<rwh::WindowHandle<'_>, rwh::HandleError> {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
impl rwh::HasDisplayHandle for X11Window {
|
||||
fn display_handle(&self) -> Result<rwh::DisplayHandle, rwh::HandleError> {
|
||||
fn display_handle(&self) -> Result<rwh::DisplayHandle<'_>, rwh::HandleError> {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
@ -679,26 +679,6 @@ impl X11WindowState {
|
|||
}
|
||||
}
|
||||
|
||||
/// A handle to an X11 window which destroys it on Drop.
|
||||
pub struct X11WindowHandle {
|
||||
id: xproto::Window,
|
||||
xcb: Rc<XCBConnection>,
|
||||
}
|
||||
|
||||
impl Drop for X11WindowHandle {
|
||||
fn drop(&mut self) {
|
||||
maybe!({
|
||||
check_reply(
|
||||
|| "X11 DestroyWindow failed while dropping X11WindowHandle.",
|
||||
self.xcb.destroy_window(self.id),
|
||||
)?;
|
||||
xcb_flush(&self.xcb);
|
||||
anyhow::Ok(())
|
||||
})
|
||||
.log_err();
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct X11Window(pub X11WindowStatePtr);
|
||||
|
||||
impl Drop for X11Window {
|
||||
|
|
|
@ -1074,8 +1074,10 @@ fn handle_nc_mouse_up_msg(
|
|||
}
|
||||
|
||||
let last_pressed = state_ptr.state.borrow_mut().nc_button_pressed.take();
|
||||
if button == MouseButton::Left && last_pressed.is_some() {
|
||||
let handled = match (wparam.0 as u32, last_pressed.unwrap()) {
|
||||
if button == MouseButton::Left
|
||||
&& let Some(last_pressed) = last_pressed
|
||||
{
|
||||
let handled = match (wparam.0 as u32, last_pressed) {
|
||||
(HTMINBUTTON, HTMINBUTTON) => {
|
||||
unsafe { ShowWindowAsync(handle, SW_MINIMIZE).ok().log_err() };
|
||||
true
|
||||
|
|
|
@ -1250,11 +1250,13 @@ fn set_window_composition_attribute(hwnd: HWND, color: Option<Color>, state: u32
|
|||
type SetWindowCompositionAttributeType =
|
||||
unsafe extern "system" fn(HWND, *mut WINDOWCOMPOSITIONATTRIBDATA) -> BOOL;
|
||||
let module_name = PCSTR::from_raw(c"user32.dll".as_ptr() as *const u8);
|
||||
let user32 = GetModuleHandleA(module_name);
|
||||
if user32.is_ok() {
|
||||
if let Some(user32) = GetModuleHandleA(module_name)
|
||||
.context("Unable to get user32.dll handle")
|
||||
.log_err()
|
||||
{
|
||||
let func_name = PCSTR::from_raw(c"SetWindowCompositionAttribute".as_ptr() as *const u8);
|
||||
let set_window_composition_attribute: SetWindowCompositionAttributeType =
|
||||
std::mem::transmute(GetProcAddress(user32.unwrap(), func_name));
|
||||
std::mem::transmute(GetProcAddress(user32, func_name));
|
||||
let mut color = color.unwrap_or_default();
|
||||
let is_acrylic = state == 4;
|
||||
if is_acrylic && color.3 == 0 {
|
||||
|
@ -1275,10 +1277,6 @@ fn set_window_composition_attribute(hwnd: HWND, color: Option<Color>, state: u32
|
|||
cb_data: std::mem::size_of::<AccentPolicy>(),
|
||||
};
|
||||
let _ = set_window_composition_attribute(hwnd, &mut data as *mut _ as _);
|
||||
} else {
|
||||
let _ = user32
|
||||
.inspect_err(|e| log::error!("Error getting module: {e}"))
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue