Re: Default heuristics for variable-format displays

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

 



On 09-09-15 12:06:54, Adam Jackson wrote:
 ...
> def mode_dpi_cmp(x, y):
> 	return cmp(abs(x.dpi - 96), abs(y.dpi - 96))
 ...

The names x and y suggest coordinates to me.  I'd have read the code 
right the first time if the names had been a and b.

> def best_mode(modes, dpi_known = True):
> 	l = filter(lambda x: x.refresh >= 72, modes)


If the sort is stable, how about sorting by highest refresh rate first? 
That way an 85 Hz refresh (if available) would be preferred over a 75 
Hz refresh rate.  (I expect the 72 Hz is to separate out LCDs which 
usually have a fixed rate of about 60 Hz.)

        l = filter(lambda a: a.refresh >= 72, modes).sorted(
            key=lambda a: -a.refresh )

(BTW, use key instead of cmp in the other cases as well.)

> 	if l == []:
> 		l = modes
> 	if dpi_known:
> 		l.sort(cmp=mode_dpi_cmp)
> 	else:
> 		l.sort(cmp=mode_size_cmp)
> 	return l[0]
 ...

In any case, thank you for working on it (my bz is 522155 "RFE choose
sensible resolution during boot").

-- 
____________________________________________________________________
TonyN.:'                       <mailto:tonynelson@xxxxxxxxxxxxxxxxx>
      '                              <http://www.georgeanelson.com/>

-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux