Skip to content

Commit

Permalink
windows: only emit DragEnter if enter_is_valid
Browse files Browse the repository at this point in the history
  • Loading branch information
valadaptive committed Jan 10, 2025
1 parent fe7132e commit 7d016a6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/platform_impl/windows/drop_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,13 @@ impl FileDropHandler {
let position = PhysicalPosition::new(pt.x as f64, pt.y as f64);
let mut paths = Vec::new();
let hdrop = unsafe { Self::iterate_filenames(pDataObj, |path| paths.push(path)) };
drop_handler.send_event(Event::WindowEvent {
window_id: WindowId::from_raw(drop_handler.window as usize),
event: DragEnter { paths, position },
});
drop_handler.enter_is_valid = hdrop.is_some();
if drop_handler.enter_is_valid {
drop_handler.send_event(Event::WindowEvent {
window_id: WindowId::from_raw(drop_handler.window as usize),
event: DragEnter { paths, position },
});
}
drop_handler.cursor_effect =
if drop_handler.enter_is_valid { DROPEFFECT_COPY } else { DROPEFFECT_NONE };
unsafe {
Expand Down

0 comments on commit 7d016a6

Please sign in to comment.