mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
Allow for zero number of dpi values to be set
At least in the DBus API we can't just say "doesn't exist", so let's allow for a zero-sized list. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
committed by
Benjamin Tissoires
parent
3e0c803a37
commit
74a5551a8d
@@ -278,6 +278,9 @@ org.freedesktop.ratbag1.Resolution
|
||||
the :js:attr:`Resolution` property. This list is always sorted
|
||||
ascending, the lowest resolution is the first item in the list.
|
||||
|
||||
This list may be empty if the device does not support reading and/or
|
||||
writing to resolutions.
|
||||
|
||||
.. js:attribute:: ReportRate
|
||||
|
||||
:type: u
|
||||
|
||||
@@ -1131,6 +1131,9 @@ ratbag_resolution_get_dpi_list(struct ratbag_resolution *resolution,
|
||||
|
||||
assert(nres > 0);
|
||||
|
||||
if (resolution->ndpis == 0)
|
||||
return 0;
|
||||
|
||||
memcpy(resolutions, resolution->dpis,
|
||||
sizeof(unsigned int) * min(nres, resolution->ndpis));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user