[feat] remember remote display resolutions across connections

This commit is contained in:
dijunkun
2026-11-11 14:14:00 +08:00
parent 17b4db25fb
commit a862bf6b35
15 changed files with 414 additions and 67 deletions
+15 -1
View File
@@ -52,6 +52,20 @@ struct DisplayResolutionChange {
bool accepted = false;
};
// Persist the native identity, never the display's position in a session.
struct DisplayResolutionPreference {
std::string display_key;
DisplayResolution resolution;
};
inline bool ValidDisplayResolutionPreference(
const DisplayResolutionPreference &preference) {
return !preference.display_key.empty() &&
preference.display_key.size() <= 1024 &&
preference.display_key.find('\0') == std::string::npos &&
ValidDisplayResolution(preference.resolution);
}
inline bool SupportsDisplayResolution(const DisplayResolutionInfo &display,
const DisplayResolutionChange &change) {
return display.display_id == change.display_id &&
@@ -62,4 +76,4 @@ inline bool SupportsDisplayResolution(const DisplayResolutionInfo &display,
} // namespace crossdesk
#endif
#endif