Have mimes_count be always accurate

This commit is contained in:
Kovid Goyal 2026-02-08 14:10:32 +05:30
parent c19ec465cb
commit f3cda7e828
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 5 additions and 1 deletions

4
glfw/wl_window.c vendored
View file

@ -2452,6 +2452,10 @@ static void handle_primary_selection_offer(void *data UNUSED, struct zwp_primary
// Helper function to update drop state from callback results
static void
update_drop_state(_GLFWWaylandDataOffer *d, _GLFWwindow* window UNUSED, size_t mime_count) {
for (size_t i = mime_count; i < d->mimes_count; i++) {
if (d->mimes[i]) { free((void*)d->mimes[i]); d->mimes[i] = NULL; }
}
d->mimes_count = mime_count;
bool accepted = mime_count > 0;
bool acceptance_changed = (accepted != d->drag_accepted);
// The first MIME in the sorted list is the preferred one for drop

View file

@ -693,7 +693,7 @@ read_drop_data(GLFWwindow *window, GLFWDropEvent *ev) {
global_state.drop_dest.num_left--;
if (!global_state.drop_dest.num_left) {
WINDOW_CALLBACK(on_drop, "OOii", global_state.drop_dest.data, Py_False,
global_state.callback_os_window->last_drag_event.x, global_state.callback_os_window->last_drag_event.y);
global_state.callback_os_window->last_drag_event.x, global_state.callback_os_window->last_drag_event.y);
finish(true);
}
} else if (ret > 0) {