- while (sscanf(walk, "%ux%u+%u+%u", &width, &height, &x, &y) == 4) {
- DLOG("Parsed output as width = %u, height = %u at (%u, %u)\n",
- width, height, x, y);
+ int chars_consumed;
+ while (sscanf(walk, "%ux%u+%u+%u%n", &width, &height, &x, &y, &chars_consumed) == 4) {
+ walk += chars_consumed;
+ bool primary = false;
+ if (*walk == 'P') {
+ primary = true;
+ walk++;
+ }
+ if (*walk == ',')
+ walk++; /* Skip delimiter */
+ DLOG("Parsed output as width = %u, height = %u at (%u, %u)%s\n",
+ width, height, x, y, primary ? " (primary)" : "");
+