Display (Linux): fixes comments

This commit is contained in:
Carter Li committed 2026-11-05 10:23:37 +08:00
1 parent 4fa8e8cdac
commit cad01fd222
2 files changed
+8 -5

No files matched your search

@@ -387,7 +387,8 @@ bool ffdsMutterAvailable(void) {
}
// Enrich the displays detected from wl_output with the authoritative data reported by Mutter / Muffin.
// Returns true if the display configuration could be retrieved from D-Bus.
// Returns true when the D-Bus connection is up and DisplayConfig could be queried. The caller treats
// that as authoritative and skips monitors.xml, even if the reply names no primary monitor.
bool ffdsConnectMutter(FFDisplayServerResult* result) {
FF_DBUS_AUTO_DESTROY_DATA FFDBusData dbus = {};
const char* error = ffDBusLoadData(DBUS_BUS_SESSION, &dbus);
@@ -317,16 +317,18 @@ const char* ffdsConnectWayland(FFDisplayServerResult* result) {
data.ffwl_proxy_destroy(registry);
ffwl_display_disconnect(data.display);
bool primaryDetected = false;
bool displayConfigRead = false;
#if defined(FF_HAVE_DBUS) && defined(__linux__)
if (data.useMutter) {
// Mutter / Muffin reports the primary monitor and the raw EDID directly
primaryDetected = ffdsConnectMutter(result);
// A working D-Bus connection with a reachable DisplayConfig is authoritative.
// Don't second-guess it with monitors.xml even when the reply names no primary
// monitor (e.g. connector names that happen to match no wl_output).
displayConfigRead = ffdsConnectMutter(result);
}
#endif
// Fallback for compositors that do not expose the monitor configuration, or when it could not be read
if (!primaryDetected) {
if (!displayConfigRead) {
const char* fileName = ffStrbufEqualS(&result->wmProcessName, "gnome-shell")
? "monitors.xml"
: ffStrbufEqualS(&result->wmProcessName, "cinnamon")