Skip to content

Commit

Permalink
ignore phantom displays when searching for a display reference
Browse files Browse the repository at this point in the history
Fixes issue #412
  • Loading branch information
rockowitz committed May 6, 2024
1 parent 9e4148f commit 21a2be2
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/ddc/ddc_display_selection.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ ddc_test_display_ref_criteria(Display_Ref * dref, Display_Criteria * criteria) {
}


/** Finds the first display reference satisfying a set of display criteria.
* Phantom displays are ignored.
*
* @param criteria identifiers to check
* @return display reference if found, NULL if not
*/
static Display_Ref *
ddc_find_display_ref_by_criteria(Display_Criteria * criteria) {
Display_Ref * result = NULL;
Expand All @@ -170,16 +176,20 @@ ddc_find_display_ref_by_criteria(Display_Criteria * criteria) {
Display_Ref * drec = g_ptr_array_index(all_displays, ndx);
TRACED_ASSERT(memcmp(drec->marker, DISPLAY_REF_MARKER, 4) == 0);
if (ddc_test_display_ref_criteria(drec, criteria)) {
result = drec;
break;
// Ignore the match if it's a phantom display
if (drec->dispno != DISPNO_PHANTOM) {
result = drec;
break;
}
}
}
return result;
}


/** Searches the master display list for a display matching the
* specified #Display_Identifier, returning its #Display_Ref
* specified #Display_Identifier, returning its #Display_Ref.
* Phantom displays are ignored.
*
* @param did display identifier to search for
* @return #Display_Ref for the display, NULL if not found or
Expand Down Expand Up @@ -239,16 +249,16 @@ ddc_find_display_ref_by_display_identifier(Display_Identifier * did) {


/** Searches the detected displays for one matching the criteria in a
* #Display_Identifier.
* #Display_Identifier. Phantom displays are ignored.
*
* @param pdid pointer to a #Display_Identifier
* @param callopts standard call options
* @return pointer to #Display_Ref for the display, NULL if not found
*
* \todo
* If the criteria directly specify an access path
* (e.g. I2C bus number) and CALLOPT_FORCE specified, then create a
* temporary #Display_Ref, bypassing the list of detected monitors.
* If the criteria directly specify an access path (e.g. I2C bus number) and
* CALLOPT_FORCE is specified, then create a temporary #Display_Ref,
* bypassing the list of detected monitors.
*/
Display_Ref *
get_display_ref_for_display_identifier(
Expand Down

0 comments on commit 21a2be2

Please sign in to comment.