Wayland: Cleanup

This commit is contained in:
Camilla Löwy 2024-04-08 18:50:08 +02:00
parent 51b6434ac4
commit 64906f8e64

View File

@ -1974,41 +1974,41 @@ static void dataDeviceHandleEnter(void* userData,
_glfw.wl.dragFocus = NULL;
}
for (unsigned int i = 0; i < _glfw.wl.offerCount; i++)
unsigned int i;
for (i = 0; i < _glfw.wl.offerCount; i++)
{
if (_glfw.wl.offers[i].offer == offer)
{
_GLFWwindow* window = NULL;
if (surface)
{
if (wl_proxy_get_tag((struct wl_proxy*) surface) == &_glfw.wl.tag)
window = wl_surface_get_user_data(surface);
break;
}
if (window && surface == window->wl.surface && _glfw.wl.offers[i].text_uri_list)
if (i == _glfw.wl.offerCount)
return;
if (surface && wl_proxy_get_tag((struct wl_proxy*) surface) == &_glfw.wl.tag)
{
_GLFWwindow* window = wl_surface_get_user_data(surface);
if (window->wl.surface == surface)
{
if (_glfw.wl.offers[i].text_uri_list)
{
_glfw.wl.dragOffer = offer;
_glfw.wl.dragFocus = window;
_glfw.wl.dragSerial = serial;
}
_glfw.wl.offers[i] = _glfw.wl.offers[_glfw.wl.offerCount - 1];
_glfw.wl.offerCount--;
break;
}
}
if (wl_proxy_get_tag((struct wl_proxy*) surface) != &_glfw.wl.tag)
return;
if (_glfw.wl.dragOffer)
wl_data_offer_accept(offer, serial, "text/uri-list");
else
}
}
}
if (!_glfw.wl.dragOffer)
{
wl_data_offer_accept(offer, serial, NULL);
wl_data_offer_destroy(offer);
}
_glfw.wl.offers[i] = _glfw.wl.offers[_glfw.wl.offerCount - 1];
_glfw.wl.offerCount--;
}
static void dataDeviceHandleLeave(void* userData,