[mutter/wip/carlosg/fix-tablet-mapper-lookup-41] input-mapper: Reverse sort order of display score comparator




commit ad787c3cf7a9874e0a0dbd48cfc0de39cc997334
Author: Jason Gerecke <killertofu gmail com>
Date:   Fri Jul 16 12:00:03 2021 -0700

    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 64ff1f20f81749b3b00ace5a8b73487747a8ed3d)

 src/backends/meta-input-mapper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/backends/meta-input-mapper.c b/src/backends/meta-input-mapper.c
index ffbe2dd373..c0a32a3820 100644
--- a/src/backends/meta-input-mapper.c
+++ b/src/backends/meta-input-mapper.c
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]