create TextConsole together with the CharDeviceState
[qemu/aliguori.git] / ui / vnc-jobs-sync.c
blob49b77afcc9489d7030b24723aa6483bf6e628e1b
1 /*
2 * QEMU VNC display driver
4 * Copyright (C) 2006 Anthony Liguori <anthony@codemonkey.ws>
5 * Copyright (C) 2006 Fabrice Bellard
6 * Copyright (C) 2009 Red Hat, Inc
7 * Copyright (C) 2010 Corentin Chary <corentin.chary@gmail.com>
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 * THE SOFTWARE.
28 #include "vnc.h"
29 #include "vnc-jobs.h"
31 void vnc_jobs_clear(VncState *vs)
35 void vnc_jobs_join(VncState *vs)
39 VncJob *vnc_job_new(VncState *vs)
41 vs->job.vs = vs;
42 vs->job.rectangles = 0;
44 vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
45 vnc_write_u8(vs, 0);
46 vs->job.saved_offset = vs->output.offset;
47 vnc_write_u16(vs, 0);
48 return &vs->job;
51 void vnc_job_push(VncJob *job)
53 VncState *vs = job->vs;
55 vs->output.buffer[job->saved_offset] = (job->rectangles >> 8) & 0xFF;
56 vs->output.buffer[job->saved_offset + 1] = job->rectangles & 0xFF;
57 vnc_flush(job->vs);
60 int vnc_job_add_rect(VncJob *job, int x, int y, int w, int h)
62 int n;
64 n = vnc_send_framebuffer_update(job->vs, x, y, w, h);
65 if (n >= 0)
66 job->rectangles += n;
67 return n;
70 bool vnc_has_job(VncState *vs)
72 return false;