input-mapper: Reverse sort order of display score comparator

The `guess_candidates()` function scores each display that an input
device could be mapped to and then uses the `sort_by_score()` comparator
to find the best option. The function expects the list to be sorted from
best to worst, but the comparator currently sorts them in the opposite
order. This causes the function to end up returning the _worst_ match
rather than the the best. This commit reverses the sort order of the
comparator so that the best display can be returned as intended.

Closes: #1889

(Cherry-picked from commit 64ff1f20f8)
This commit is contained in:
Jason Gerecke 2021-07-16 12:00:03 -07:00 committed by Carlos Garnacho
parent 7f9defb444
commit ad787c3cf7

View File

@ -473,7 +473,7 @@ static int
sort_by_score (DeviceMatch *match1,
DeviceMatch *match2)
{
return (int) match1->score - match2->score;
return (int) match2->score - match1->score;
}
static void