keep the PID file locked for the lifetime of the process
[qemu.git] / ui / vnc-jobs-sync.c
1 /*
2 * QEMU VNC display driver
3 *
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>
8 *
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:
15 *
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
18 *
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.
26 */
27
28 #include "vnc.h"
29 #include "vnc-jobs.h"
30
31 void vnc_jobs_clear(VncState *vs)
32 {
33 }
34
35 void vnc_jobs_join(VncState *vs)
36 {
37 }
38
39 VncJob *vnc_job_new(VncState *vs)
40 {
41 vs->job.vs = vs;
42 vs->job.rectangles = 0;
43
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;
49 }
50
51 void vnc_job_push(VncJob *job)
52 {
53 VncState *vs = job->vs;
54
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);
58 }
59
60 int vnc_job_add_rect(VncJob *job, int x, int y, int w, int h)
61 {
62 int n;
63
64 n = vnc_send_framebuffer_update(job->vs, x, y, w, h);
65 if (n >= 0)
66 job->rectangles += n;
67 return n;
68 }
69
70 bool vnc_has_job(VncState *vs)
71 {
72 return false;
73 }