summaryrefslogtreecommitdiff
path: root/src/window_win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window_win32.c')
-rw-r--r--src/window_win32.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/window_win32.c b/src/window_win32.c
index bf9ad87..e28d3d4 100644
--- a/src/window_win32.c
+++ b/src/window_win32.c
@@ -1316,15 +1316,19 @@ static void win32_handle_message(struct stl_window_win32 *w32, MSG *Message)
#ifdef STELA_DRAG_AND_DROP
case WM_DROPFILES: {
HDROP Drop = (HDROP)Message->wParam;
- str path = AL_STR_EMPTY;
- u32 count = DragQueryFileA(Drop, 0xffffffff, NULL, 0);
+ wstr buf = AL_WSTR_EMPTY;
+ u32 count = DragQueryFileW(Drop, 0xffffffff, NULL, 0);
for (u32 i = 0; i < count; i++) {
- path.length = DragQueryFileA(Drop, i, NULL, 0);
- path.alloc = al_str_reserve(&path, path.length + 1);
- DragQueryFileA(Drop, i, path.data, path.alloc);
- stl_window_send_drag_and_drop_event(&w32->w, &path);
+ buf.length = DragQueryFileW(Drop, i, NULL, 0);
+ buf.alloc = al_wstr_reserve(&buf, buf.length + 1);
+ DragQueryFileW(Drop, i, buf.data, buf.alloc);
+ str path = AL_STR_EMPTY;
+ if (al_str_from_wstr(&path, &buf)) {
+ stl_window_send_drag_and_drop_event(&w32->w, &path);
+ al_str_free(&path);
+ }
}
- al_str_free(&path);
+ al_wstr_free(&buf);
DragFinish(Drop);
break;
}