- /* potential FALL THROUGH */
-
- case SST_NEEDS_UPDATE:
- outputf("RFB send: sending header");
- /* Send a header */
- state->frame_bytes = fb->curmode.xres * fb->curmode.yres * 3; /* XXX */
- hdr.msgtype = 0;
- hdr.nrects = htons(1);
- hdr.xpos = htons(0);
- hdr.ypos = htons(0);
- hdr.width = htons(fb->curmode.xres);
- hdr.height = htons(fb->curmode.yres);
- hdr.enctype = htonl(0);
- tcp_write(pcb, &hdr, sizeof(hdr), 0);
- tcp_output(pcb);
+ /* FALL THROUGH to SST_HEADER */
+
+ case SST_HEADER:
+
+ /* Calculate the width and height for this chunk, remembering
+ * that if SCREEN_CHUNKS_[XY] do not evenly divide the width and
+ * height, we may need to have shorter chunks at the edge of
+ * the screen. */
+
+ state->chunk_width = fb->curmode.xres / SCREEN_CHUNKS_X;
+ if (fb->curmode.xres % SCREEN_CHUNKS_X != 0)
+ state->chunk_width += 1;
+ state->chunk_xpos = state->chunk_width * state->chunk_xnum;
+ totaldim = state->chunk_width * (state->chunk_xnum + 1);
+ if (totaldim > fb->curmode.xres) {
+ state->chunk_width -= (totaldim - fb->curmode.xres);
+ }