mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
rcxml: improve parse calibrationMatrix
This commit is contained in:
parent
0e7c726be5
commit
91e3dc10e4
1 changed files with 5 additions and 5 deletions
|
|
@ -617,13 +617,13 @@ fill_libinput_category(char *nodename, char *content)
|
||||||
current_libinput_category->have_calibration_matrix = true;
|
current_libinput_category->have_calibration_matrix = true;
|
||||||
float *mat = current_libinput_category->calibration_matrix;
|
float *mat = current_libinput_category->calibration_matrix;
|
||||||
gchar **elements = g_strsplit(content, " ", -1);
|
gchar **elements = g_strsplit(content, " ", -1);
|
||||||
guint length = g_strv_length(elements);
|
for (guint i = 0; elements[i]; ++i) {
|
||||||
for (guint i = 0; i < length; ++i) {
|
|
||||||
char *end_str = NULL;
|
char *end_str = NULL;
|
||||||
mat[i] = strtof(elements[i], &end_str);
|
mat[i] = strtof(elements[i], &end_str);
|
||||||
if (i == 6 || errno == ERANGE || !end_str) {
|
if (errno == ERANGE || *end_str != '\0' || i == 6 || *elements[i] == '\0') {
|
||||||
wlr_log(WLR_ERROR,
|
wlr_log(WLR_ERROR, "invalid calibration matrix element"
|
||||||
"bad calibration matrix value, expect six floats");
|
" %s (index %d), expect six floats",
|
||||||
|
elements[i], i);
|
||||||
current_libinput_category->have_calibration_matrix = false;
|
current_libinput_category->have_calibration_matrix = false;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue