mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-12-20 14:39:09 +08:00
[fix] clean display names by removing non-alphanumeric characters
This commit is contained in:
@@ -226,13 +226,17 @@ int ScreenCapturerSckImpl::Init(const int fps, cb_desktop_data cb) {
|
||||
CGRect bounds = CGDisplayBounds(display_id);
|
||||
bool is_primary = CGDisplayIsMain(display_id);
|
||||
|
||||
std::string name;
|
||||
name = GetDisplayName(display_id);
|
||||
std::string name = GetDisplayName(display_id);
|
||||
|
||||
if (name.empty()) {
|
||||
name = "Display " + std::to_string(unnamed_count++);
|
||||
name = "Display" + std::to_string(unnamed_count++);
|
||||
}
|
||||
|
||||
// clean display name, remove non-alphanumeric characters
|
||||
name.erase(
|
||||
std::remove_if(name.begin(), name.end(), [](unsigned char c) { return !std::isalnum(c); }),
|
||||
name.end());
|
||||
|
||||
DisplayInfo info((void *)(uintptr_t)display_id, name, is_primary,
|
||||
static_cast<int>(bounds.origin.x), static_cast<int>(bounds.origin.y),
|
||||
static_cast<int>(bounds.origin.x + bounds.size.width),
|
||||
|
||||
Reference in New Issue
Block a user