Skip to content

DisplayServer (Linux): wait for delayed Wayland output events#2451

Draft
Suze021 wants to merge 1 commit into
fastfetch-cli:devfrom
Suze021:fix/wayland-missing-displays
Draft

DisplayServer (Linux): wait for delayed Wayland output events#2451
Suze021 wants to merge 1 commit into
fastfetch-cli:devfrom
Suze021:fix/wayland-missing-displays

Conversation

@Suze021

@Suze021 Suze021 commented Jul 13, 2026

Copy link
Copy Markdown

Summary

Wait for Wayland output completion events when a compositor delivers the final output state after the first roundtrip callback. This prevents an output proxy from being destroyed before its delayed mode data arrives.

Related issue (required for new logos for new distros)

Fixes #2074

Changes

  • Track done events for both wl_output and kde_output_device_v2.
  • Retry Wayland roundtrips until the output is complete.
  • Bound retries with the configured processingTimeout and avoid a busy loop.

Screenshots

Not applicable; this changes display detection only.

Testing

  • Reproduced with a local Wayland server advertising three outputs and delaying the primary output state by 20 ms. Before this change, only two outputs were returned; afterward, all three are returned.
  • Verified both the generic wl_output and KDE kde_output_device_v2 paths.
  • Built successfully with and without Wayland support.
  • Passed all six CTest tests in both standard and Wayland-enabled builds.

Checklist

  • I have tested my changes locally.

@codacy-production

codacy-production Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 9 complexity

Metric Results
Complexity 9

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@Suze021 Suze021 force-pushed the fix/wayland-missing-displays branch from 4a10e01 to 7434c83 Compare July 13, 2026 22:06
@Suze021 Suze021 force-pushed the fix/wayland-missing-displays branch from 7434c83 to 3a46e47 Compare July 13, 2026 22:09

const char* ffWaylandWaitForDone(WaylandDisplay* display) {
WaylandData* wldata = display->parent;
double deadline = ffTimeGetTick() + instance.config.general.processingTimeout;

@CarterLi CarterLi Jul 14, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

processingTimeout is a signed integer. -1 means it should block infinitely, which should be handled independently.

In addition, ffTimeGetTick() returns integer too. Not sure why you use double here

Comment on lines +230 to +235
if (wldata->ffwl_display_roundtrip(wldata->display) < 0) {
return "Failed to roundtrip Wayland output information";
}
if (!display->done) {
ffTimeSleep(1);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This both wastes time (keep posting sync events) and adds latency.

I'd use wl_display_dispatch_timeout here, which blocks until receiving an event. The problem is that wl_display_dispatch_timeout is relatively new. However, as users who stuck at an old distro, they may not care about using the newest fastfetch either, so it won't be a serious problem.

CarterLi added a commit to CarterLi/fastfetch that referenced this pull request Jul 14, 2026
@CarterLi

Copy link
Copy Markdown
Member

Posted a fix. Please test!

There are other places missing WaitForDone. Not sure if I need to fix them.

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.

[BUG] Fastfetch doesn't show two monitors

2 participants