vnc.c (c12aeb860c63ba83190f962e2f0a1c5fe18ad3a6) vnc.c (d39fa6d86d07646e3481e5c3e45a984bff590642)
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 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy

--- 422 unchanged lines hidden (view full) ---

431
432static void vnc_dpy_update(DisplayChangeListener *dcl,
433 DisplayState *ds,
434 int x, int y, int w, int h)
435{
436 int i;
437 VncDisplay *vd = container_of(dcl, VncDisplay, dcl);
438 struct VncSurface *s = &vd->guest;
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 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy

--- 422 unchanged lines hidden (view full) ---

431
432static void vnc_dpy_update(DisplayChangeListener *dcl,
433 DisplayState *ds,
434 int x, int y, int w, int h)
435{
436 int i;
437 VncDisplay *vd = container_of(dcl, VncDisplay, dcl);
438 struct VncSurface *s = &vd->guest;
439 int width = ds_get_width(ds);
440 int height = ds_get_height(ds);
439 int width = surface_width(vd->ds);
440 int height = surface_height(vd->ds);
441
442 h += y;
443
444 /* round x down to ensure the loop only spans one 16-pixel block per,
445 iteration. otherwise, if (x % 16) != 0, the last iteration may span
446 two 16-pixel blocks but we only mark the first as dirty
447 */
448 w += (x % 16);

--- 65 unchanged lines hidden (view full) ---

514{
515 memmove(buf->buffer, buf->buffer + len,
516 (buf->offset - len));
517 buf->offset -= len;
518}
519
520static void vnc_desktop_resize(VncState *vs)
521{
441
442 h += y;
443
444 /* round x down to ensure the loop only spans one 16-pixel block per,
445 iteration. otherwise, if (x % 16) != 0, the last iteration may span
446 two 16-pixel blocks but we only mark the first as dirty
447 */
448 w += (x % 16);

--- 65 unchanged lines hidden (view full) ---

514{
515 memmove(buf->buffer, buf->buffer + len,
516 (buf->offset - len));
517 buf->offset -= len;
518}
519
520static void vnc_desktop_resize(VncState *vs)
521{
522 DisplayState *ds = vs->ds;
522 DisplaySurface *ds = vs->vd->ds;
523
524 if (vs->csock == -1 || !vnc_has_feature(vs, VNC_FEATURE_RESIZE)) {
525 return;
526 }
523
524 if (vs->csock == -1 || !vnc_has_feature(vs, VNC_FEATURE_RESIZE)) {
525 return;
526 }
527 if (vs->client_width == ds_get_width(ds) &&
528 vs->client_height == ds_get_height(ds)) {
527 if (vs->client_width == surface_width(ds) &&
528 vs->client_height == surface_height(ds)) {
529 return;
530 }
529 return;
530 }
531 vs->client_width = ds_get_width(ds);
532 vs->client_height = ds_get_height(ds);
531 vs->client_width = surface_width(ds);
532 vs->client_height = surface_height(ds);
533 vnc_lock_output(vs);
534 vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
535 vnc_write_u8(vs, 0);
536 vnc_write_u16(vs, 1); /* number of rects */
537 vnc_framebuffer_update(vs, 0, 0, vs->client_width, vs->client_height,
538 VNC_ENCODING_DESKTOPRESIZE);
539 vnc_unlock_output(vs);
540 vnc_flush(vs);

--- 29 unchanged lines hidden (view full) ---

570
571 ptr = (uint8_t *)pixman_image_get_data(vd->server);
572 ptr += y * vnc_server_fb_stride(vd);
573 ptr += x * VNC_SERVER_FB_BYTES;
574 return ptr;
575}
576
577static void vnc_dpy_switch(DisplayChangeListener *dcl,
533 vnc_lock_output(vs);
534 vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
535 vnc_write_u8(vs, 0);
536 vnc_write_u16(vs, 1); /* number of rects */
537 vnc_framebuffer_update(vs, 0, 0, vs->client_width, vs->client_height,
538 VNC_ENCODING_DESKTOPRESIZE);
539 vnc_unlock_output(vs);
540 vnc_flush(vs);

--- 29 unchanged lines hidden (view full) ---

570
571 ptr = (uint8_t *)pixman_image_get_data(vd->server);
572 ptr += y * vnc_server_fb_stride(vd);
573 ptr += x * VNC_SERVER_FB_BYTES;
574 return ptr;
575}
576
577static void vnc_dpy_switch(DisplayChangeListener *dcl,
578 DisplayState *ds,
578 DisplayState *dontuse,
579 DisplaySurface *surface)
580{
581 VncDisplay *vd = container_of(dcl, VncDisplay, dcl);
582 VncState *vs;
583
584 vnc_abort_display_jobs(vd);
585
586 /* server surface */
587 qemu_pixman_image_unref(vd->server);
579 DisplaySurface *surface)
580{
581 VncDisplay *vd = container_of(dcl, VncDisplay, dcl);
582 VncState *vs;
583
584 vnc_abort_display_jobs(vd);
585
586 /* server surface */
587 qemu_pixman_image_unref(vd->server);
588 vd->ds = surface;
588 vd->server = pixman_image_create_bits(VNC_SERVER_FB_FORMAT,
589 vd->server = pixman_image_create_bits(VNC_SERVER_FB_FORMAT,
589 ds_get_width(ds),
590 ds_get_height(ds),
590 surface_width(vd->ds),
591 surface_height(vd->ds),
591 NULL, 0);
592
593 /* guest surface */
594#if 0 /* FIXME */
595 if (ds_get_bytes_per_pixel(ds) != vd->guest.ds->pf.bytes_per_pixel)
596 console_color_init(ds);
597#endif
598 qemu_pixman_image_unref(vd->guest.fb);
592 NULL, 0);
593
594 /* guest surface */
595#if 0 /* FIXME */
596 if (ds_get_bytes_per_pixel(ds) != vd->guest.ds->pf.bytes_per_pixel)
597 console_color_init(ds);
598#endif
599 qemu_pixman_image_unref(vd->guest.fb);
599 vd->guest.fb = pixman_image_ref(ds->surface->image);
600 vd->guest.format = ds->surface->format;
600 vd->guest.fb = pixman_image_ref(surface->image);
601 vd->guest.format = surface->format;
601 memset(vd->guest.dirty, 0xFF, sizeof(vd->guest.dirty));
602
603 QTAILQ_FOREACH(vs, &vd->clients, next) {
604 vnc_colordepth(vs);
605 vnc_desktop_resize(vs);
606 if (vs->vd->cursor) {
607 vnc_cursor_define(vs);
608 }

--- 125 unchanged lines hidden (view full) ---

734 vnc_framebuffer_update(vs, dst_x, dst_y, w, h, VNC_ENCODING_COPYRECT);
735 vnc_write_u16(vs, src_x);
736 vnc_write_u16(vs, src_y);
737 vnc_unlock_output(vs);
738 vnc_flush(vs);
739}
740
741static void vnc_dpy_copy(DisplayChangeListener *dcl,
602 memset(vd->guest.dirty, 0xFF, sizeof(vd->guest.dirty));
603
604 QTAILQ_FOREACH(vs, &vd->clients, next) {
605 vnc_colordepth(vs);
606 vnc_desktop_resize(vs);
607 if (vs->vd->cursor) {
608 vnc_cursor_define(vs);
609 }

--- 125 unchanged lines hidden (view full) ---

735 vnc_framebuffer_update(vs, dst_x, dst_y, w, h, VNC_ENCODING_COPYRECT);
736 vnc_write_u16(vs, src_x);
737 vnc_write_u16(vs, src_y);
738 vnc_unlock_output(vs);
739 vnc_flush(vs);
740}
741
742static void vnc_dpy_copy(DisplayChangeListener *dcl,
742 DisplayState *ds,
743 DisplayState *dontuse,
743 int src_x, int src_y,
744 int dst_x, int dst_y, int w, int h)
745{
746 VncDisplay *vd = container_of(dcl, VncDisplay, dcl);
747 VncState *vs, *vn;
748 uint8_t *src_row;
749 uint8_t *dst_row;
750 int i, x, y, pitch, inc, w_lim, s;

--- 57 unchanged lines hidden (view full) ---

808 QTAILQ_FOREACH(vs, &vd->clients, next) {
809 if (vnc_has_feature(vs, VNC_FEATURE_COPYRECT)) {
810 vnc_copy(vs, src_x, src_y, dst_x, dst_y, w, h);
811 }
812 }
813}
814
815static void vnc_mouse_set(DisplayChangeListener *dcl,
744 int src_x, int src_y,
745 int dst_x, int dst_y, int w, int h)
746{
747 VncDisplay *vd = container_of(dcl, VncDisplay, dcl);
748 VncState *vs, *vn;
749 uint8_t *src_row;
750 uint8_t *dst_row;
751 int i, x, y, pitch, inc, w_lim, s;

--- 57 unchanged lines hidden (view full) ---

809 QTAILQ_FOREACH(vs, &vd->clients, next) {
810 if (vnc_has_feature(vs, VNC_FEATURE_COPYRECT)) {
811 vnc_copy(vs, src_x, src_y, dst_x, dst_y, w, h);
812 }
813 }
814}
815
816static void vnc_mouse_set(DisplayChangeListener *dcl,
816 DisplayState *ds,
817 DisplayState *dontuse,
817 int x, int y, int visible)
818{
819 /* can we ask the client(s) to move the pointer ??? */
820}
821
822static int vnc_cursor_define(VncState *vs)
823{
824 QEMUCursor *c = vs->vd->cursor;

--- 11 unchanged lines hidden (view full) ---

836 vnc_write(vs, vs->vd->cursor_mask, vs->vd->cursor_msize);
837 vnc_unlock_output(vs);
838 return 0;
839 }
840 return -1;
841}
842
843static void vnc_dpy_cursor_define(DisplayChangeListener *dcl,
818 int x, int y, int visible)
819{
820 /* can we ask the client(s) to move the pointer ??? */
821}
822
823static int vnc_cursor_define(VncState *vs)
824{
825 QEMUCursor *c = vs->vd->cursor;

--- 11 unchanged lines hidden (view full) ---

837 vnc_write(vs, vs->vd->cursor_mask, vs->vd->cursor_msize);
838 vnc_unlock_output(vs);
839 return 0;
840 }
841 return -1;
842}
843
844static void vnc_dpy_cursor_define(DisplayChangeListener *dcl,
844 DisplayState *ds,
845 DisplayState *dontuse,
845 QEMUCursor *c)
846{
847 VncDisplay *vd = vnc_display;
848 VncState *vs;
849
850 cursor_put(vd->cursor);
851 g_free(vd->cursor_mask);
852

--- 605 unchanged lines hidden (view full) ---

1458 int absolute = kbd_mouse_is_absolute();
1459
1460 if (vnc_has_feature(vs, VNC_FEATURE_POINTER_TYPE_CHANGE) && vs->absolute != absolute) {
1461 vnc_lock_output(vs);
1462 vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
1463 vnc_write_u8(vs, 0);
1464 vnc_write_u16(vs, 1);
1465 vnc_framebuffer_update(vs, absolute, 0,
846 QEMUCursor *c)
847{
848 VncDisplay *vd = vnc_display;
849 VncState *vs;
850
851 cursor_put(vd->cursor);
852 g_free(vd->cursor_mask);
853

--- 605 unchanged lines hidden (view full) ---

1459 int absolute = kbd_mouse_is_absolute();
1460
1461 if (vnc_has_feature(vs, VNC_FEATURE_POINTER_TYPE_CHANGE) && vs->absolute != absolute) {
1462 vnc_lock_output(vs);
1463 vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
1464 vnc_write_u8(vs, 0);
1465 vnc_write_u16(vs, 1);
1466 vnc_framebuffer_update(vs, absolute, 0,
1466 ds_get_width(vs->ds), ds_get_height(vs->ds),
1467 surface_width(vs->vd->ds),
1468 surface_height(vs->vd->ds),
1467 VNC_ENCODING_POINTER_TYPE_CHANGE);
1468 vnc_unlock_output(vs);
1469 vnc_flush(vs);
1470 }
1471 vs->absolute = absolute;
1472}
1473
1474static void pointer_event(VncState *vs, int button_mask, int x, int y)
1475{
1476 int buttons = 0;
1477 int dz = 0;
1469 VNC_ENCODING_POINTER_TYPE_CHANGE);
1470 vnc_unlock_output(vs);
1471 vnc_flush(vs);
1472 }
1473 vs->absolute = absolute;
1474}
1475
1476static void pointer_event(VncState *vs, int button_mask, int x, int y)
1477{
1478 int buttons = 0;
1479 int dz = 0;
1480 int width = surface_width(vs->vd->ds);
1481 int height = surface_height(vs->vd->ds);
1478
1479 if (button_mask & 0x01)
1480 buttons |= MOUSE_EVENT_LBUTTON;
1481 if (button_mask & 0x02)
1482 buttons |= MOUSE_EVENT_MBUTTON;
1483 if (button_mask & 0x04)
1484 buttons |= MOUSE_EVENT_RBUTTON;
1485 if (button_mask & 0x08)
1486 dz = -1;
1487 if (button_mask & 0x10)
1488 dz = 1;
1489
1490 if (vs->absolute) {
1482
1483 if (button_mask & 0x01)
1484 buttons |= MOUSE_EVENT_LBUTTON;
1485 if (button_mask & 0x02)
1486 buttons |= MOUSE_EVENT_MBUTTON;
1487 if (button_mask & 0x04)
1488 buttons |= MOUSE_EVENT_RBUTTON;
1489 if (button_mask & 0x08)
1490 dz = -1;
1491 if (button_mask & 0x10)
1492 dz = 1;
1493
1494 if (vs->absolute) {
1491 kbd_mouse_event(ds_get_width(vs->ds) > 1 ?
1492 x * 0x7FFF / (ds_get_width(vs->ds) - 1) : 0x4000,
1493 ds_get_height(vs->ds) > 1 ?
1494 y * 0x7FFF / (ds_get_height(vs->ds) - 1) : 0x4000,
1495 kbd_mouse_event(width > 1 ? x * 0x7FFF / (width - 1) : 0x4000,
1496 height > 1 ? y * 0x7FFF / (height - 1) : 0x4000,
1495 dz, buttons);
1496 } else if (vnc_has_feature(vs, VNC_FEATURE_POINTER_TYPE_CHANGE)) {
1497 x -= 0x7FFF;
1498 y -= 0x7FFF;
1499
1500 kbd_mouse_event(x, y, dz, buttons);
1501 } else {
1502 if (vs->last_x != -1)

--- 273 unchanged lines hidden (view full) ---

1776 do_key_event(vs, down, keycode, sym);
1777}
1778
1779static void framebuffer_update_request(VncState *vs, int incremental,
1780 int x_position, int y_position,
1781 int w, int h)
1782{
1783 int i;
1497 dz, buttons);
1498 } else if (vnc_has_feature(vs, VNC_FEATURE_POINTER_TYPE_CHANGE)) {
1499 x -= 0x7FFF;
1500 y -= 0x7FFF;
1501
1502 kbd_mouse_event(x, y, dz, buttons);
1503 } else {
1504 if (vs->last_x != -1)

--- 273 unchanged lines hidden (view full) ---

1778 do_key_event(vs, down, keycode, sym);
1779}
1780
1781static void framebuffer_update_request(VncState *vs, int incremental,
1782 int x_position, int y_position,
1783 int w, int h)
1784{
1785 int i;
1784 const size_t width = ds_get_width(vs->ds) / 16;
1786 const size_t width = surface_width(vs->vd->ds) / 16;
1787 const size_t height = surface_height(vs->vd->ds);
1785
1788
1786 if (y_position > ds_get_height(vs->ds))
1787 y_position = ds_get_height(vs->ds);
1788 if (y_position + h >= ds_get_height(vs->ds))
1789 h = ds_get_height(vs->ds) - y_position;
1789 if (y_position > height) {
1790 y_position = height;
1791 }
1792 if (y_position + h >= height) {
1793 h = height - y_position;
1794 }
1790
1791 vs->need_update = 1;
1792 if (!incremental) {
1793 vs->force_update = 1;
1794 for (i = 0; i < h; i++) {
1795 bitmap_set(vs->dirty[y_position + i], 0, width);
1796 bitmap_clear(vs->dirty[y_position + i], width,
1797 VNC_DIRTY_BITS - width);
1798 }
1799 }
1800}
1801
1802static void send_ext_key_event_ack(VncState *vs)
1803{
1804 vnc_lock_output(vs);
1805 vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
1806 vnc_write_u8(vs, 0);
1807 vnc_write_u16(vs, 1);
1795
1796 vs->need_update = 1;
1797 if (!incremental) {
1798 vs->force_update = 1;
1799 for (i = 0; i < h; i++) {
1800 bitmap_set(vs->dirty[y_position + i], 0, width);
1801 bitmap_clear(vs->dirty[y_position + i], width,
1802 VNC_DIRTY_BITS - width);
1803 }
1804 }
1805}
1806
1807static void send_ext_key_event_ack(VncState *vs)
1808{
1809 vnc_lock_output(vs);
1810 vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
1811 vnc_write_u8(vs, 0);
1812 vnc_write_u16(vs, 1);
1808 vnc_framebuffer_update(vs, 0, 0, ds_get_width(vs->ds), ds_get_height(vs->ds),
1813 vnc_framebuffer_update(vs, 0, 0,
1814 surface_width(vs->vd->ds),
1815 surface_height(vs->vd->ds),
1809 VNC_ENCODING_EXT_KEY_EVENT);
1810 vnc_unlock_output(vs);
1811 vnc_flush(vs);
1812}
1813
1814static void send_ext_audio_ack(VncState *vs)
1815{
1816 vnc_lock_output(vs);
1817 vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
1818 vnc_write_u8(vs, 0);
1819 vnc_write_u16(vs, 1);
1816 VNC_ENCODING_EXT_KEY_EVENT);
1817 vnc_unlock_output(vs);
1818 vnc_flush(vs);
1819}
1820
1821static void send_ext_audio_ack(VncState *vs)
1822{
1823 vnc_lock_output(vs);
1824 vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
1825 vnc_write_u8(vs, 0);
1826 vnc_write_u16(vs, 1);
1820 vnc_framebuffer_update(vs, 0, 0, ds_get_width(vs->ds), ds_get_height(vs->ds),
1827 vnc_framebuffer_update(vs, 0, 0,
1828 surface_width(vs->vd->ds),
1829 surface_height(vs->vd->ds),
1821 VNC_ENCODING_AUDIO);
1822 vnc_unlock_output(vs);
1823 vnc_flush(vs);
1824}
1825
1826static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
1827{
1828 int i;

--- 156 unchanged lines hidden (view full) ---

1985static void vnc_colordepth(VncState *vs)
1986{
1987 if (vnc_has_feature(vs, VNC_FEATURE_WMVI)) {
1988 /* Sending a WMVi message to notify the client*/
1989 vnc_lock_output(vs);
1990 vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
1991 vnc_write_u8(vs, 0);
1992 vnc_write_u16(vs, 1); /* number of rects */
1830 VNC_ENCODING_AUDIO);
1831 vnc_unlock_output(vs);
1832 vnc_flush(vs);
1833}
1834
1835static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
1836{
1837 int i;

--- 156 unchanged lines hidden (view full) ---

1994static void vnc_colordepth(VncState *vs)
1995{
1996 if (vnc_has_feature(vs, VNC_FEATURE_WMVI)) {
1997 /* Sending a WMVi message to notify the client*/
1998 vnc_lock_output(vs);
1999 vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
2000 vnc_write_u8(vs, 0);
2001 vnc_write_u16(vs, 1); /* number of rects */
1993 vnc_framebuffer_update(vs, 0, 0, ds_get_width(vs->ds),
1994 ds_get_height(vs->ds), VNC_ENCODING_WMVi);
2002 vnc_framebuffer_update(vs, 0, 0,
2003 surface_width(vs->vd->ds),
2004 surface_height(vs->vd->ds),
2005 VNC_ENCODING_WMVi);
1995 pixel_format_message(vs);
1996 vnc_unlock_output(vs);
1997 vnc_flush(vs);
1998 } else {
1999 set_pixel_conversion(vs);
2000 }
2001}
2002

--- 199 unchanged lines hidden (view full) ---

2202 if (mode == VNC_SHARE_MODE_EXCLUSIVE) {
2203 vnc_disconnect_start(vs);
2204 return 0;
2205 }
2206 break;
2207 }
2208 vnc_set_share_mode(vs, mode);
2209
2006 pixel_format_message(vs);
2007 vnc_unlock_output(vs);
2008 vnc_flush(vs);
2009 } else {
2010 set_pixel_conversion(vs);
2011 }
2012}
2013

--- 199 unchanged lines hidden (view full) ---

2213 if (mode == VNC_SHARE_MODE_EXCLUSIVE) {
2214 vnc_disconnect_start(vs);
2215 return 0;
2216 }
2217 break;
2218 }
2219 vnc_set_share_mode(vs, mode);
2220
2210 vs->client_width = ds_get_width(vs->ds);
2211 vs->client_height = ds_get_height(vs->ds);
2221 vs->client_width = surface_width(vs->vd->ds);
2222 vs->client_height = surface_height(vs->vd->ds);
2212 vnc_write_u16(vs, vs->client_width);
2213 vnc_write_u16(vs, vs->client_height);
2214
2215 pixel_format_message(vs);
2216
2217 if (qemu_name)
2218 size = snprintf(buf, sizeof(buf), "QEMU (%s)", qemu_name);
2219 else

--- 461 unchanged lines hidden (view full) ---

2681 qemu_mod_timer(vd->timer, qemu_get_clock_ms(rt_clock) + vd->timer_interval);
2682}
2683
2684static void vnc_init_timer(VncDisplay *vd)
2685{
2686 vd->timer_interval = VNC_REFRESH_INTERVAL_BASE;
2687 if (vd->timer == NULL && !QTAILQ_EMPTY(&vd->clients)) {
2688 vd->timer = qemu_new_timer_ms(rt_clock, vnc_refresh, vd);
2223 vnc_write_u16(vs, vs->client_width);
2224 vnc_write_u16(vs, vs->client_height);
2225
2226 pixel_format_message(vs);
2227
2228 if (qemu_name)
2229 size = snprintf(buf, sizeof(buf), "QEMU (%s)", qemu_name);
2230 else

--- 461 unchanged lines hidden (view full) ---

2692 qemu_mod_timer(vd->timer, qemu_get_clock_ms(rt_clock) + vd->timer_interval);
2693}
2694
2695static void vnc_init_timer(VncDisplay *vd)
2696{
2697 vd->timer_interval = VNC_REFRESH_INTERVAL_BASE;
2698 if (vd->timer == NULL && !QTAILQ_EMPTY(&vd->clients)) {
2699 vd->timer = qemu_new_timer_ms(rt_clock, vnc_refresh, vd);
2689 vnc_dpy_switch(&vd->dcl, vd->ds, vd->ds->surface);
2700 vga_hw_update();
2690 vnc_refresh(vd);
2691 }
2692}
2693
2694static void vnc_remove_timer(VncDisplay *vd)
2695{
2696 if (vd->timer != NULL && QTAILQ_EMPTY(&vd->clients)) {
2697 qemu_del_timer(vd->timer);

--- 53 unchanged lines hidden (view full) ---

2751 }
2752}
2753
2754void vnc_init_state(VncState *vs)
2755{
2756 vs->initialized = true;
2757 VncDisplay *vd = vs->vd;
2758
2701 vnc_refresh(vd);
2702 }
2703}
2704
2705static void vnc_remove_timer(VncDisplay *vd)
2706{
2707 if (vd->timer != NULL && QTAILQ_EMPTY(&vd->clients)) {
2708 qemu_del_timer(vd->timer);

--- 53 unchanged lines hidden (view full) ---

2762 }
2763}
2764
2765void vnc_init_state(VncState *vs)
2766{
2767 vs->initialized = true;
2768 VncDisplay *vd = vs->vd;
2769
2759 vs->ds = vd->ds;
2760 vs->last_x = -1;
2761 vs->last_y = -1;
2762
2763 vs->as.freq = 44100;
2764 vs->as.nchannels = 2;
2765 vs->as.fmt = AUD_FMT_S16;
2766 vs->as.endianness = 0;
2767

--- 70 unchanged lines hidden (view full) ---

2838 vs->dcl.idle = 1;
2839 vnc_display = vs;
2840
2841 vs->lsock = -1;
2842#ifdef CONFIG_VNC_WS
2843 vs->lwebsock = -1;
2844#endif
2845
2770 vs->last_x = -1;
2771 vs->last_y = -1;
2772
2773 vs->as.freq = 44100;
2774 vs->as.nchannels = 2;
2775 vs->as.fmt = AUD_FMT_S16;
2776 vs->as.endianness = 0;
2777

--- 70 unchanged lines hidden (view full) ---

2848 vs->dcl.idle = 1;
2849 vnc_display = vs;
2850
2851 vs->lsock = -1;
2852#ifdef CONFIG_VNC_WS
2853 vs->lwebsock = -1;
2854#endif
2855
2846 vs->ds = ds;
2847 QTAILQ_INIT(&vs->clients);
2848 vs->expires = TIME_MAX;
2849
2850 if (keyboard_layout)
2851 vs->kbd_layout = init_keyboard_layout(name2keysym, keyboard_layout);
2852 else
2853 vs->kbd_layout = init_keyboard_layout(name2keysym, "en-us");
2854

--- 419 unchanged lines hidden ---
2856 QTAILQ_INIT(&vs->clients);
2857 vs->expires = TIME_MAX;
2858
2859 if (keyboard_layout)
2860 vs->kbd_layout = init_keyboard_layout(name2keysym, keyboard_layout);
2861 else
2862 vs->kbd_layout = init_keyboard_layout(name2keysym, "en-us");
2863

--- 419 unchanged lines hidden ---