Wayland: Cleanup
diff --git a/src/wl_window.c b/src/wl_window.c
index 7ace6b4..96f8039 100644
--- a/src/wl_window.c
+++ b/src/wl_window.c
@@ -1974,41 +1974,41 @@
_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)
+ break;
+ }
+
+ 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)
{
- _GLFWwindow* window = NULL;
-
- if (surface)
- {
- if (wl_proxy_get_tag((struct wl_proxy*) surface) == &_glfw.wl.tag)
- window = wl_surface_get_user_data(surface);
- }
-
- if (window && surface == window->wl.surface && _glfw.wl.offers[i].text_uri_list)
+ 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;
+ wl_data_offer_accept(offer, serial, "text/uri-list");
+ }
}
}
- 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,