1
0
forked from drath/libratbag

resolution: add support for min/max resolutions

https://github.com/libratbag/libratbag/issues/180

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2017-06-20 15:44:45 +10:00
committed by Benjamin Tissoires
parent dbc0672061
commit 2fd939f514
2 changed files with 7 additions and 0 deletions

View File

@@ -51,6 +51,8 @@ The **org.freedesktop.ratbag1.Resolution** interface provides:
- XResolution -> uint for the x resolution assigned to this entry
- YResolution -> uint for the y resolution assigned to this entry
- ReportRate -> uint for the report rate in Hz assigned to this entry
- Maximum -> uint for the maximum possible resolution
- Minimum -> uint for the minimum possible resolution
- Methods:
- SetResolution(uint, uint) -> x/y resolution to assign
- SetReportRate(uint) -> uint for the report rate to assign

View File

@@ -42,6 +42,7 @@ struct ratbagd_resolution {
char *path;
unsigned int xres, yres;
unsigned int rate;
unsigned int maxres, minres;
};
static int ratbagd_resolution_set_report_rate(sd_bus_message *m,
@@ -158,6 +159,8 @@ const sd_bus_vtable ratbagd_resolution_vtable[] = {
SD_BUS_PROPERTY("XResolution", "u", NULL, offsetof(struct ratbagd_resolution, xres), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("YResolution", "u", NULL, offsetof(struct ratbagd_resolution, yres), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("ReportRate", "u", NULL, offsetof(struct ratbagd_resolution, rate), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("Maximum", "u", NULL, offsetof(struct ratbagd_resolution, maxres), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("Minimum", "u", NULL, offsetof(struct ratbagd_resolution, minres), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_METHOD("SetReportRate", "u", "u", ratbagd_resolution_set_report_rate, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("SetResolution", "uu", "u", ratbagd_resolution_set_resolution, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("SetDefault", "", "u", ratbagd_resolution_set_default, SD_BUS_VTABLE_UNPRIVILEGED),
@@ -189,6 +192,8 @@ int ratbagd_resolution_new(struct ratbagd_resolution **out,
resolution->xres = ratbag_resolution_get_dpi_x(lib_resolution);
resolution->yres = ratbag_resolution_get_dpi_y(lib_resolution);
resolution->rate = ratbag_resolution_get_report_rate(lib_resolution);
resolution->maxres = ratbag_resolution_get_dpi_maximum(lib_resolution);
resolution->minres = ratbag_resolution_get_dpi_minimum(lib_resolution);
sprintf(profile_buffer, "p%u", ratbagd_profile_get_index(profile));
sprintf(resolution_buffer, "r%u", index);