From 579130ecb4f9f315ae52190af42f0ea46aeaa4a2 Mon Sep 17 00:00:00 2001 From: Adrien Prokopowicz <6529475+prokopyl@users.noreply.github.com> Date: Thu, 23 May 2024 01:54:39 +0200 Subject: [PATCH 1/3] Fix usage of spare_capacity_mut which isn't available in MSRV 1.59 (#190) --- src/win/drop_target.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/win/drop_target.rs b/src/win/drop_target.rs index 0ec0f8c..aa42259 100644 --- a/src/win/drop_target.rs +++ b/src/win/drop_target.rs @@ -148,15 +148,9 @@ impl DropTarget { for i in 0..item_count { let characters = DragQueryFileW(hdrop, i, null_mut(), 0); let buffer_size = characters as usize + 1; - let mut buffer = Vec::::with_capacity(buffer_size); - - DragQueryFileW( - hdrop, - i, - buffer.spare_capacity_mut().as_mut_ptr().cast(), - buffer_size as u32, - ); - buffer.set_len(buffer_size); + let mut buffer = vec![0u16; buffer_size]; + + DragQueryFileW(hdrop, i, buffer.as_mut_ptr().cast(), buffer_size as u32); paths.push(OsString::from_wide(&buffer[..characters as usize]).into()) } From 36db2a197e0767c02a8a622bc014997a1a2fc426 Mon Sep 17 00:00:00 2001 From: Micah Johnston Date: Tue, 29 Oct 2024 09:11:05 -0500 Subject: [PATCH 2/3] fix clippy lint for missing transmute annotations (#196) --- src/gl/win.rs | 3 +++ src/gl/x11.rs | 2 ++ src/win/drop_target.rs | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src/gl/win.rs b/src/gl/win.rs index 655a807..7e4289c 100644 --- a/src/gl/win.rs +++ b/src/gl/win.rs @@ -160,6 +160,7 @@ impl GlContext { let symbol = CString::new("wglCreateContextAttribsARB").unwrap(); let addr = wglGetProcAddress(symbol.as_ptr()); if !addr.is_null() { + #[allow(clippy::missing_transmute_annotations)] Some(std::mem::transmute(addr)) } else { None @@ -171,6 +172,7 @@ impl GlContext { let symbol = CString::new("wglChoosePixelFormatARB").unwrap(); let addr = wglGetProcAddress(symbol.as_ptr()); if !addr.is_null() { + #[allow(clippy::missing_transmute_annotations)] Some(std::mem::transmute(addr)) } else { None @@ -182,6 +184,7 @@ impl GlContext { let symbol = CString::new("wglSwapIntervalEXT").unwrap(); let addr = wglGetProcAddress(symbol.as_ptr()); if !addr.is_null() { + #[allow(clippy::missing_transmute_annotations)] Some(std::mem::transmute(addr)) } else { None diff --git a/src/gl/x11.rs b/src/gl/x11.rs index d449801..b7aaca4 100644 --- a/src/gl/x11.rs +++ b/src/gl/x11.rs @@ -91,6 +91,7 @@ impl GlContext { if addr.is_null() { return Err(GlError::CreationFailed(CreationFailedError::GetProcAddressFailed)); } else { + #[allow(clippy::missing_transmute_annotations)] std::mem::transmute(addr) } }; @@ -101,6 +102,7 @@ impl GlContext { if addr.is_null() { return Err(GlError::CreationFailed(CreationFailedError::GetProcAddressFailed)); } else { + #[allow(clippy::missing_transmute_annotations)] std::mem::transmute(addr) } }; diff --git a/src/win/drop_target.rs b/src/win/drop_target.rs index aa42259..be19f79 100644 --- a/src/win/drop_target.rs +++ b/src/win/drop_target.rs @@ -47,6 +47,8 @@ const DROP_PTR: unsafe extern "system" fn( pt: POINTL, pdwEffect: *mut DWORD, ) -> HRESULT = DropTarget::drop; + +#[allow(clippy::missing_transmute_annotations)] const DROP_TARGET_VTBL: IDropTargetVtbl = IDropTargetVtbl { parent: IUnknownVtbl { QueryInterface: DropTarget::query_interface, From cd4df61f5578479af1b93de2946dd2b515ddcc77 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 29 Oct 2024 16:14:58 +0200 Subject: [PATCH 3/3] remove mouse coalescing (#195) Co-authored-by: Micah Johnston --- src/macos/view.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/macos/view.rs b/src/macos/view.rs index 8b765b4..5d014f3 100644 --- a/src/macos/view.rs +++ b/src/macos/view.rs @@ -347,8 +347,6 @@ extern "C" fn view_will_move_to_window(this: &Object, _self: Sel, new_window: id let tracking_areas: *mut Object = msg_send![this, trackingAreas]; let tracking_area_count = NSArray::count(tracking_areas); - let _: () = msg_send![class!(NSEvent), setMouseCoalescingEnabled: NO]; - if new_window == nil { if tracking_area_count != 0 { let tracking_area = NSArray::objectAtIndex(tracking_areas, 0);