Jacek Caban (@jacek) commented about dlls/winewayland.drv/wayland_output.c:
+ /* Update mode if it's already in list, otherwise find the insertion point + * to maintain the sorted order. */ + wl_list_for_each(mode, &output->mode_list, link) + { + int cmp = wayland_output_mode_cmp(mode, width, height, refresh); + if (cmp == 0) /* mode == new */ + { + if (current) output->current_mode = mode; + return; + } + else if (cmp == 1) /* mode > new */ + { + insert_after_link = mode->link.prev; + break; + } + } We have wine/rbtree.h for such collections, you may use it to store modes instead of implementing it here. Other than that, it looks good to me, thanks.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/2275#note_26767