1
0
forked from drath/libratbag

G300: set DPIs as a fixed list

Set the list of DPIs directly instead of use the _from_range call.

The G300 has few and coarse resolution options. Using the
exponential'ish range is not a good fit for devices with so
few dpis.

The logitech G300 can set:
250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2250, 2500

but piper would offer:
250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750,
800, 850, 900, 950, 1000, 1100, 1200, 1300, 1400, 1500,
1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500

We overpromise by offering more finegrainded options than the
mouse can do and end up with three times as many options than
we should.
This commit is contained in:
Thomas Hindoe Paaboel Andersen
2017-10-24 14:49:17 +02:00
committed by Thomas H. P. Andersen
parent 9c75a7cc7e
commit 7555cf1607

View File

@@ -386,6 +386,8 @@ logitech_g300_read_profile(struct ratbag_profile *profile)
ratbag_profile_for_each_resolution(profile, resolution) {
struct logitech_g300_resolution *res =
&report->dpi_levels[resolution->index];
unsigned int dpis[10] = { 250, 500, 750, 1000, 1250, 1500, 1750,
2000, 2250, 2500 };
resolution->dpi_x = res->dpi * 250;
resolution->dpi_y = res->dpi * 250;
@@ -393,9 +395,8 @@ logitech_g300_read_profile(struct ratbag_profile *profile)
resolution->is_default = res->is_default;
resolution->is_active = res->is_default;
ratbag_resolution_set_dpi_list_from_range(resolution,
LOGITECH_G300_DPI_MIN,
LOGITECH_G300_DPI_MAX);
ratbag_resolution_set_dpi_list(resolution, dpis,
ARRAY_LENGTH(dpis));
ratbag_resolution_set_report_rate_list(resolution, &hz, 1);
}