Statistics
| Branch: | Revision:

root / ui / vnc-jobs-sync.c @ bd023f95

History | View | Annotate | Download (2.1 kB)

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