display: Sort resolutions by width first

We used to sort by area, but really, that is more confusing than
helpful. Instead, sort by width then height.

Fixes: #1237
This commit is contained in:
Benjamin Berg 2021-01-21 17:31:28 +01:00
parent 44b7e37fb4
commit feb762dde9

View file

@ -208,11 +208,12 @@ sort_modes_by_area_desc (CcDisplayMode *a, CcDisplayMode *b)
cc_display_mode_get_resolution (a, &wa, &ha); cc_display_mode_get_resolution (a, &wa, &ha);
cc_display_mode_get_resolution (b, &wb, &hb); cc_display_mode_get_resolution (b, &wb, &hb);
/* Prefer wide screen if the size is equal */ /* Sort first by width, then height.
res = wb*hb - wa*ha; * We used to sort by area, but that can be confusing. */
if (res == 0) res = wb - wa;
return wb - wa; if (res)
return res; return res;
return hb - ha;
} }
static gint static gint