<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><br><div><div class="h5"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><div><br>
> } else if (strcmp(interface, "wl_shm") == 0) {<br>
> shm = wl_display_bind(display, id, &wl_shm_interface);<br>
> } else if (strcmp(interface, "screenshooter") == 0) {<br>
> @@ -144,6 +171,8 @@ int main(int argc, char *argv[])<br>
> struct wl_display *display;<br>
> struct wl_buffer *buffer;<br>
> void *data = NULL;<br>
> + struct ss_output *ss_output;<br>
> + int ss_area_width = 0, ss_area_height = 0, num_outputs = 0;<br>
><br>
> display = wl_display_connect(NULL);<br>
> if (display == NULL) {<br>
> @@ -151,6 +180,7 @@ int main(int argc, char *argv[])<br>
> return -1;<br>
> }<br>
><br>
> + wl_list_init(&output_list);<br>
> wl_display_add_global_listener(display, handle_global, &screenshooter);<br>
> wl_display_iterate(display, WL_DISPLAY_READABLE);<br>
> wl_display_roundtrip(display);<br>
> @@ -159,11 +189,32 @@ int main(int argc, char *argv[])<br>
> return -1;<br>
> }<br>
><br>
> - buffer = create_shm_buffer(output_width, output_height, &data);<br>
> - screenshooter_shoot(screenshooter, output, buffer);<br>
> + wl_list_for_each(ss_output, &output_list, link) {<br>
> +<br>
> + if (!num_outputs) {<br>
> + ss_area_width = ss_output->width + ss_output->offset_x;<br>
> + ss_area_height = ss_output->height + ss_output->offset_y;<br>
> + }<br>
<br>
</div></div>I'd just set ss_area_width/height to 0 initially.<br></blockquote></div></div><div><br>num_outputs must be initialised since it checks !num_outputs on the first pass.<br>Unless there is another way to do this, we need to set num_outputs to begin with.<br>
</div><div class="im"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><br>
<br>
> + else {<br>
> + ss_area_width = MAX(ss_area_width, ss_output->offset_x + ss_output->width);<br>
> + ss_area_height = MAX(ss_area_height, ss_output->offset_y + ss_output->height);<br>
> + }<br>
> + num_outputs++;<br>
> + }<br></div></blockquote></div></div></blockquote></div><br><br>
To be clear here, !num_outputs means the first output. If there is only a single output,<br>
the else condition will never be reached.<br>