wayland: Don't retrieve the drag offer strings with every pointer motion event
Querying the drag offer with every pointer movement would require refactoring to work with the portal implementation, however, there is little point, as the event layer just discards the file name. Remove the existing code and note that a new implementation is needed if the name ever starts to be passed though. In the event that this is reimplemented, it should cache the filenames, as otherwise, this could potentially hammer the DBus interface hundreds or even thousands of times per second.main
parent
bac7eeaaae
commit
9964e5c5b0
|
@ -1902,26 +1902,14 @@ static void data_device_handle_motion(void *data, struct wl_data_device *wl_data
|
||||||
SDL_WaylandDataDevice *data_device = data;
|
SDL_WaylandDataDevice *data_device = data;
|
||||||
|
|
||||||
if (data_device->drag_offer != NULL && data_device->dnd_window) {
|
if (data_device->drag_offer != NULL && data_device->dnd_window) {
|
||||||
/* TODO: SDL Support more mime types */
|
const float dx = (float)wl_fixed_to_double(x);
|
||||||
size_t length;
|
const float dy = (float)wl_fixed_to_double(y);
|
||||||
void *buffer = Wayland_data_offer_receive(data_device->drag_offer,
|
|
||||||
FILE_MIME, &length);
|
/* XXX: Send the filename here if the event system ever starts passing it though.
|
||||||
if (buffer) {
|
* Any future implementation should cache the filenames, as otherwise this could
|
||||||
char *saveptr = NULL;
|
* hammer the DBus interface hundreds or even thousands of times per second.
|
||||||
char *token = SDL_strtok_r((char *)buffer, "\r\n", &saveptr);
|
*/
|
||||||
while (token != NULL) {
|
SDL_SendDropPosition(data_device->dnd_window, NULL, dx, dy);
|
||||||
char *fn = Wayland_URIToLocal(token);
|
|
||||||
if (fn) {
|
|
||||||
double dx;
|
|
||||||
double dy;
|
|
||||||
dx = wl_fixed_to_double(x);
|
|
||||||
dy = wl_fixed_to_double(y);
|
|
||||||
SDL_SendDropPosition(data_device->dnd_window, fn, (float)dx, (float)dy);
|
|
||||||
}
|
|
||||||
token = SDL_strtok_r(NULL, "\r\n", &saveptr);
|
|
||||||
}
|
|
||||||
SDL_free(buffer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue