[gtk-vnc-devel] [PATCH 1/7] Specify supported encodings in the same order as TightVNC
- From: Federico Mena Quintero <federico novell com>
- To: gtk-vnc-devel lists sourceforge net
- Subject: [gtk-vnc-devel] [PATCH 1/7] Specify supported encodings in the same order as TightVNC
- Date: Wed, 17 Dec 2008 23:56:30 -0000
Signed-off-by: Federico Mena Quintero <federico novell com>
---
ChangeLog | 6 +++++
src/vncdisplay.c | 59 +++++++++++++++++++++++++++++++++++++++--------------
2 files changed, 49 insertions(+), 16 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 345ade8..64355ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-11-18 Federico Mena Quintero <federico novell com>
+
+ * src/vncdisplay.c (vnc_coroutine): Specify the encodings in the
+ same order as TightVNC. In particular, this gives us COPY_RECT
+ and TIGHT above everything else.
+
2008-09-05 "Daniel P. Berrange <berrange redhat com>
* NEWS, configure.ac:
diff --git a/src/vncdisplay.c b/src/vncdisplay.c
index e71fe10..fa081a2 100644
--- a/src/vncdisplay.c
+++ b/src/vncdisplay.c
@@ -1263,24 +1263,34 @@ static void *vnc_coroutine(void *opaque)
VncDisplay *obj = VNC_DISPLAY(opaque);
VncDisplayPrivate *priv = obj->priv;
- /* this order is extremely important! */
- int32_t encodings[] = { GVNC_ENCODING_TIGHT_JPEG5,
+ /* For rectangle encodings, we use the same order as TightVNC's; see
+ * vnc_unixsrc/vncviewer/rfbproto.c:SetFormatAndEncodings()
+ */
+ /* FIXME: if we are on the same machine, make the first preferred encoding be RAW */
+ int32_t encodings[] = { GVNC_ENCODING_COPY_RECT,
GVNC_ENCODING_TIGHT,
- GVNC_ENCODING_EXT_KEY_EVENT,
- GVNC_ENCODING_DESKTOP_RESIZE,
- GVNC_ENCODING_WMVi,
- GVNC_ENCODING_RICH_CURSOR,
+ GVNC_ENCODING_HEXTILE,
+ /* GVNC_ENCODING_ZLIB, */ /* we don't implement this */
+ /* GVNC_ENCODING_CORRE, */ /* we don't implement this */
+ GVNC_ENCODING_RRE,
+ /* FIXME: we don't handle rfbEncodingCompressLevel0-9 (0xffffff00 to 0xffffff09) */
+ GVNC_ENCODING_TIGHT_JPEG5, /* if you change this to another level, change it below as well */
GVNC_ENCODING_XCURSOR,
+ GVNC_ENCODING_RICH_CURSOR,
+ /* GVNC_ENCODING_CURSOR_POS, */ /* we don't implement this */
+ /* GVNC_ENCODING_LAST_RECT, */ /* we don't implement this */
+ GVNC_ENCODING_DESKTOP_RESIZE,
+
+ /* TightVNC's encodings end above; the following are our own proposed encodings */
+ GVNC_ENCODING_EXT_KEY_EVENT,
GVNC_ENCODING_POINTER_CHANGE,
+ GVNC_ENCODING_WMVi,
GVNC_ENCODING_ZRLE,
- GVNC_ENCODING_HEXTILE,
- GVNC_ENCODING_RRE,
- GVNC_ENCODING_COPY_RECT,
GVNC_ENCODING_RAW };
- int32_t *encodingsp;
int n_encodings;
int ret;
struct signal_data s;
+ gboolean skip_jpeg;
if (priv->gvnc == NULL || gvnc_is_open(priv->gvnc)) {
g_idle_add(delayed_unref_object, obj);
@@ -1306,20 +1316,37 @@ static void *vnc_coroutine(void *opaque)
emit_signal_delayed(obj, VNC_INITIALIZED, &s);
- encodingsp = encodings;
n_encodings = G_N_ELEMENTS(encodings);
+ skip_jpeg = FALSE;
if (check_pixbuf_support("jpeg")) {
if (!priv->allow_lossy) {
- encodingsp++;
- n_encodings--;
+ skip_jpeg = TRUE;
}
} else {
- encodingsp += 2;
- n_encodings -= 2;
+ skip_jpeg = TRUE;
+ }
+
+ if (skip_jpeg) {
+ int jpeg_index;
+ int i;
+
+ /* Shift all the encodings up one slot to overwrite the JPEG one */
+
+ for (jpeg_index = 0; jpeg_index < n_encodings; jpeg_index++) {
+ if (encodings[jpeg_index] == GVNC_ENCODING_TIGHT_JPEG5)
+ break;
+ }
+
+ if (jpeg_index < n_encodings) {
+ for (i = jpeg_index; i < n_encodings - 1; i++)
+ encodings[i] = encodings[i + 1];
+
+ n_encodings--;
+ }
}
- if (!gvnc_set_encodings(priv->gvnc, n_encodings, encodingsp))
+ if (!gvnc_set_encodings(priv->gvnc, n_encodings, encodings))
goto cleanup;
if (!gvnc_framebuffer_update_request(priv->gvnc, 0, 0, 0, priv->fb.width, priv->fb.height))
--
1.5.6
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]