Skip to content

glue: store windows in std::vector to preserve creation order - #34

Merged
igagis-bot merged 2 commits into
mainfrom
issue-27-store-windows-in-vector
Nov 25, 2026
Merged

igagis-bot merged 2 commits into
mainfrom
issue-27-store-windows-in-vector

Conversation

@igagis-bot

Copy link
Copy Markdown
Contributor

Summary

Fixes #27.

Replaces the per-window storage in the glue adaptations:

  • linux/xorg, linux/wayland, windows, sdl: std::map<window_id, shared_ref<app_window>> → std::vector<std::pair<window_id, shared_ref<app_window>>>
  • macos: std::set<shared_ref<app_window>> → std::vector<shared_ref<app_window>> (no window id lookup exists on macos, and std::set also did not preserve creation order)

application::get_windows() now returns the windows in the order they were opened, stable even when new windows are inserted and old ones deleted. The number of windows is expected to be small (2-3), so linear lookup by window_id via the new find_window() helper is still fast.

The operator</operator== members on macos app_window that existed only for std::set are removed; macos lookups now compare raw pointers explicitly.

Verification

  • All buildable ruisapp targets compile (opengl/opengles/vulkan × sdl/xorg/wayland)
  • check-format-ruisapp-* targets pass
  • clang-tidy (ruisapp config) passes on all modified translation units in all 8 build configurations
  • Full test suite passes

Replace std::map (and std::set on macos) used to store application
windows in the glue adaptations with std::vector<std::pair<window_id,
shared_ref<app_window>>> (std::vector<shared_ref<app_window>> on
macos, where no window id lookup exists). This way
application::get_windows() returns the windows in the order they were
opened, which is stable even when new windows are inserted and old
ones deleted. The number of windows is expected to be small (2-3),
so linear lookup by window_id via find_window() is still fast.

Fixes #27.
Comment thread src/ruisapp/glue/sdl/application.cxx Resolved
Comment thread src/ruisapp/glue/linux/xorg/glue.cxx Resolved
@igagis-bot
igagis-bot merged commit e9ab9b8 into main Nov 25, 2026
42 checks passed
@igagis-bot
igagis-bot deleted the issue-27-store-windows-in-vector branch November 25, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

no std::map for storing windows

2 participants