1
0
Fork 0

DropTargetVtbl instance is const now

This commit is contained in:
Jussi Viiri 2023-06-10 21:52:44 +03:00
parent 92d7560f4b
commit e47f25facd

View file

@ -793,7 +793,6 @@ pub fn copy_to_clipboard(data: &str) {
#[repr(C)] #[repr(C)]
pub struct DropTarget { pub struct DropTarget {
base: IDropTarget, base: IDropTarget,
vtbl: Arc<IDropTargetVtbl>,
window_state: *mut WindowState, window_state: *mut WindowState,
@ -803,23 +802,22 @@ pub struct DropTarget {
drop_data: DropData, 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 { impl DropTarget {
fn new(window_state: *mut WindowState) -> Self { 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 { Self {
base: IDropTarget { lpVtbl: Arc::as_ptr(&vtbl) }, base: IDropTarget { lpVtbl: &DROP_TARGET_VTBL },
vtbl,
window_state, window_state,