Skip to content
Snippets Groups Projects
Commit c544b7d2 authored by Alexandros Frantzis's avatar Alexandros Frantzis
Browse files

winewayland.drv: Handle the wl_data_device::motion event.


Relay the event to the IDropTarget at the new drag-and-drop position,
and notify the Wayland compositor of any accepted format/mime type and
actions.

Signed-off-by: default avatarAlexandros Frantzis <alexandros.frantzis@collabora.com>
parent c2a7c9e9
No related branches found
No related tags found
No related merge requests found
......@@ -84,6 +84,7 @@ enum waylanddrv_client_dnd_event
{
CLIENT_DND_EVENT_ENTER,
CLIENT_DND_EVENT_LEAVE,
CLIENT_DND_EVENT_MOTION,
};
struct waylanddrv_client_dnd_params
......
......@@ -415,6 +415,42 @@ out:
static void data_device_motion(void *data, struct wl_data_device *wl_data_device,
uint32_t time, wl_fixed_t x_w, wl_fixed_t y_w)
{
struct waylanddrv_client_dnd_params params;
struct wayland_data_device *data_device = data;
struct wayland_data_offer *data_offer;
POINT point;
if (!data_device->dnd_wl_data_offer || !data_device->dnd_surface)
return;
data_offer = wl_data_offer_get_user_data(data_device->dnd_wl_data_offer);
data_device->dnd_x = wl_fixed_to_int(x_w);
data_device->dnd_y = wl_fixed_to_int(y_w);
wayland_surface_coords_to_screen(data_device->dnd_surface,
data_device->dnd_x, data_device->dnd_y,
(int *)&point.x, (int *)&point.y);
TRACE("surface=%p hwnd=%p source_actions=%x action=%x\n",
data_device->dnd_surface, data_device->dnd_surface->hwnd,
data_offer->source_actions, data_offer->action);
params.event = CLIENT_DND_EVENT_MOTION;
params.hwnd = HandleToULong(data_device->dnd_surface->hwnd);
params.point = point;
params.drop_effect = dnd_actions_to_drop_effect(data_offer->source_actions);
params.data_object = PtrToUint(data_offer);
if (WAYLANDDRV_CLIENT_CALL(dnd, &params, sizeof(params)) != 0)
return;
wl_data_offer_set_actions(data_device->dnd_wl_data_offer,
data_offer->source_actions,
data_offer->action);
wl_data_offer_accept(data_device->dnd_wl_data_offer,
data_device->dnd_enter_serial,
data_offer->accepted_mime_type);
}
static void data_device_drop(void *data, struct wl_data_device *wl_data_device)
......
......@@ -231,6 +231,26 @@ static NTSTATUS WINAPI waylanddrv_client_dnd_leave(void *params, ULONG size)
return STATUS_SUCCESS;
}
static NTSTATUS WINAPI waylanddrv_client_dnd_motion(void *params, ULONG size)
{
struct waylanddrv_client_dnd_params *p = params;
IDropTarget *drop_target;
DWORD drop_effect = p->drop_effect;
HRESULT hr;
drop_target = drop_target_from_window_point(ULongToHandle(p->hwnd), p->point);
if (!drop_target)
return STATUS_UNSUCCESSFUL;
hr = IDropTarget_DragOver(drop_target, MK_LBUTTON, *(POINTL*)&p->point,
&drop_effect);
IDropTarget_Release(drop_target);
if (FAILED(hr))
return STATUS_UNSUCCESSFUL;
return STATUS_SUCCESS;
}
NTSTATUS WINAPI waylanddrv_client_dnd(void *params, ULONG size)
{
struct waylanddrv_client_dnd_params *p = params;
......@@ -240,6 +260,8 @@ NTSTATUS WINAPI waylanddrv_client_dnd(void *params, ULONG size)
return waylanddrv_client_dnd_enter(params, size);
case CLIENT_DND_EVENT_LEAVE:
return waylanddrv_client_dnd_leave(params, size);
case CLIENT_DND_EVENT_MOTION:
return waylanddrv_client_dnd_motion(params, size);
}
return STATUS_UNSUCCESSFUL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment