Skip to content

Commit

Permalink
fix(windows): fix file drop handler (#1122)
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Dec 14, 2023
1 parent 6525783 commit 30a85f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changes/windows-drag-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": "patch"
---

On Windows, fix file drop handler.
8 changes: 4 additions & 4 deletions src/webview2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ impl InnerWebView {
) -> Result<Self> {
let _ = unsafe { CoInitializeEx(None, COINIT_APARTMENTTHREADED) };

let file_drop_controller = attributes
.file_drop_handler
.take()
.map(|handler| FileDropController::new(hwnd, handler));
let file_drop_handler = attributes.file_drop_handler.take();

let env = Self::create_environment(&web_context, pl_attrs.clone(), &attributes)?;
let controller = Self::create_controller(hwnd, &env, attributes.incognito)?;
let webview = Self::init_webview(hwnd, attributes, &env, &controller, pl_attrs)?;

let file_drop_controller =
file_drop_handler.map(|handler| FileDropController::new(hwnd, handler));

Ok(Self {
hwnd,
controller,
Expand Down

0 comments on commit 30a85f3

Please sign in to comment.