Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/windows/win_api_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ namespace display_device {
reinterpret_cast<LPARAM>(&enum_data)
);

if (!enum_data.m_width) {
if (!enum_data.m_width.has_value()) {
DD_LOG(debug) << "Failed to get monitor info for " << display_name << "!";
return std::nullopt;
}
Expand Down
14 changes: 7 additions & 7 deletions src/windows/win_api_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace display_device::win_utils {
// that is just BS (maybe copy-pasta mistake), because some cases were found where the flag is not set and the union
// is still being used.

if (index) {
if (index.has_value()) {
path.sourceInfo.sourceModeInfoIdx = *index;
} else {
path.sourceInfo.sourceModeInfoIdx = DISPLAYCONFIG_PATH_SOURCE_MODE_IDX_INVALID;
Expand All @@ -117,7 +117,7 @@ namespace display_device::win_utils {
// that is just BS (maybe copy-pasta mistake), because some cases were found where the flag is not set and the union
// is still being used.

if (index) {
if (index.has_value()) {
path.targetInfo.targetModeInfoIdx = *index;
} else {
path.targetInfo.targetModeInfoIdx = DISPLAYCONFIG_PATH_TARGET_MODE_IDX_INVALID;
Expand All @@ -132,7 +132,7 @@ namespace display_device::win_utils {
// that is just BS (maybe copy-pasta mistake), because some cases were found where the flag is not set and the union
// is still being used.

if (index) {
if (index.has_value()) {
path.targetInfo.desktopModeInfoIdx = *index;
} else {
path.targetInfo.desktopModeInfoIdx = DISPLAYCONFIG_PATH_DESKTOP_IMAGE_IDX_INVALID;
Expand All @@ -147,15 +147,15 @@ namespace display_device::win_utils {
// that is just BS (maybe copy-pasta mistake), because some cases were found where the flag is not set and the union
// is still being used.

if (id) {
if (id.has_value()) {
path.sourceInfo.cloneGroupId = *id;
} else {
path.sourceInfo.cloneGroupId = DISPLAYCONFIG_PATH_CLONE_GROUP_INVALID;
}
}

const DISPLAYCONFIG_SOURCE_MODE *getSourceMode(const std::optional<UINT32> &index, const std::vector<DISPLAYCONFIG_MODE_INFO> &modes) {
if (!index) {
if (!index.has_value()) {
return nullptr;
}

Expand Down Expand Up @@ -322,7 +322,7 @@ namespace display_device::win_utils {
const auto &source_data {path_source_data_it->second};

const auto already_used_source_id {get_already_used_source_id_in_group(source_data.m_adapter_id)};
if (already_used_source_id) {
if (already_used_source_id.has_value()) {
// Some device in the group is already using the source id, and we belong to the same adapter.
// This means we must also use the path with matching source id.
auto path_index_it {source_data.m_source_id_to_path_index.find(*already_used_source_id)};
Expand All @@ -349,7 +349,7 @@ namespace display_device::win_utils {
}
}

if (!path_index_candidate) {
if (!path_index_candidate.has_value()) {
// Apparently nvidia GPU can only render 4 different sources at a time (according to Google).
// However, it seems to be true only for physical connections as we also have virtual displays.
//
Expand Down
2 changes: 1 addition & 1 deletion src/windows/win_display_device_primary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace display_device {
const auto source_index {win_utils::getSourceIndex(path, display_data->m_modes)};
auto source_mode {win_utils::getSourceMode(source_index, display_data->m_modes)};

if (!source_index || !source_mode) {
if (!source_index.has_value() || !source_mode) {
DD_LOG(error) << "Active device does not have a source mode: " << current_id << "!";
return false;
}
Expand Down
Loading