From e47f25facdc45219b69edf3b7e297bbe23aa2491 Mon Sep 17 00:00:00 2001 From: Jussi Viiri Date: Sat, 10 Jun 2023 21:52:44 +0300 Subject: [PATCH] DropTargetVtbl instance is const now --- src/win/window.rs | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/win/window.rs b/src/win/window.rs index 04e998f..289ec65 100644 --- a/src/win/window.rs +++ b/src/win/window.rs @@ -793,7 +793,6 @@ pub fn copy_to_clipboard(data: &str) { #[repr(C)] pub struct DropTarget { base: IDropTarget, - vtbl: Arc, window_state: *mut WindowState, @@ -803,23 +802,22 @@ pub struct DropTarget { drop_data: DropData, } +const DROP_TARGET_VTBL: IDropTargetVtbl = IDropTargetVtbl { + parent: IUnknownVtbl { + QueryInterface: DropTarget::query_interface, + AddRef: DropTarget::add_ref, + Release: DropTarget::release, + }, + DragEnter: DropTarget::drag_enter, + DragOver: DropTarget::drag_over, + DragLeave: DropTarget::drag_leave, + Drop: DropTarget::drop, +}; + impl DropTarget { fn new(window_state: *mut WindowState) -> Self { - let vtbl = Arc::new(IDropTargetVtbl { - parent: IUnknownVtbl { - QueryInterface: Self::query_interface, - AddRef: Self::add_ref, - Release: Self::release, - }, - DragEnter: Self::drag_enter, - DragOver: Self::drag_over, - DragLeave: Self::drag_leave, - Drop: Self::drop, - }); - Self { - base: IDropTarget { lpVtbl: Arc::as_ptr(&vtbl) }, - vtbl, + base: IDropTarget { lpVtbl: &DROP_TARGET_VTBL }, window_state,