On Thu, 12 May 2011 12:07:22 +0200
Arthur Huillet <arthur.huil...@free.fr> wrote:
> Next in line: add both options to the F8 menu, and factorize the code with the
> "request ALR" feature.
Patch doing all this is attached.
--
Greetings,
A. Huillet
>From 710b8ae4c95fcce917ffe544a819f8bdd258f8be Mon Sep 17 00:00:00 2001
From: Arthur Huillet <arthur.huil...@free.fr>
Date: Thu, 12 May 2011 14:42:17 +0200
Subject: [PATCH 2/2] vncviewer: expose ALR delay and ALR JPEG options in
popup menu.
---
vnc_unixsrc/vncviewer/argsresources.c | 2 +
vnc_unixsrc/vncviewer/desktop.c | 16 ++++++-
vnc_unixsrc/vncviewer/popup.c | 74 ++++++++++++++++++++++++++++++++-
vnc_unixsrc/vncviewer/rfbproto.c | 28 +------------
4 files changed, 89 insertions(+), 31 deletions(-)
diff --git a/vnc_unixsrc/vncviewer/argsresources.c b/vnc_unixsrc/vncviewer/argsresources.c
index 731c2c2..9adf3e1 100644
--- a/vnc_unixsrc/vncviewer/argsresources.c
+++ b/vnc_unixsrc/vncviewer/argsresources.c
@@ -152,6 +152,8 @@ char *fallback_resources[] = {
"*enableJPEG.label: Enable JPEG Compression",
"*enableZlib.label: Enable Zlib Compression",
+ "*enableALRJPEG.label: Use JPEG Compression for ALR",
+ "*alrLabel.label: Automatic Lossless Refresh (ALR) delay",
"*popup.title: TurboVNC popup",
"*popup*background: grey",
diff --git a/vnc_unixsrc/vncviewer/desktop.c b/vnc_unixsrc/vncviewer/desktop.c
index c23c4f7..02a28ff 100644
--- a/vnc_unixsrc/vncviewer/desktop.c
+++ b/vnc_unixsrc/vncviewer/desktop.c
@@ -345,18 +345,28 @@ LosslessRefresh(Widget w, XEvent *ev, String *params, Cardinal *num_params)
String encodings = appData.encodingsString;
int compressLevel = appData.compressLevel;
int qual = appData.qualityLevel;
+ int subsampLevel = appData.subsampLevel;
Bool enableJPEG = appData.enableJPEG;
- appData.qualityLevel = -1;
- appData.enableJPEG = False;
+
+ if (appData.automaticRefreshJPEG) {
+ appData.qualityLevel = 95;
+ appData.enableJPEG = True;
+ appData.subsampLevel = TVNC_1X;
+ } else {
+ appData.qualityLevel = -1;
+ appData.enableJPEG = False;
+ }
+
appData.encodingsString = "tight copyrect";
appData.compressLevel = 1;
SetFormatAndEncodings();
SendFramebufferUpdateRequest(0, 0, si.framebufferWidth,
- si.framebufferHeight, False);
+ si.framebufferHeight, False);
appData.qualityLevel = qual;
appData.enableJPEG = enableJPEG;
appData.encodingsString = encodings;
appData.compressLevel = compressLevel;
+ appData.subsampLevel = subsampLevel;
SetFormatAndEncodings();
}
diff --git a/vnc_unixsrc/vncviewer/popup.c b/vnc_unixsrc/vncviewer/popup.c
index 128b823..0713571 100644
--- a/vnc_unixsrc/vncviewer/popup.c
+++ b/vnc_unixsrc/vncviewer/popup.c
@@ -35,7 +35,7 @@
extern Bool HasEncoding(const char *);
Widget popup, fullScreenToggle, button4X, button2X, button1X, buttonGray,
- qualtext, qualslider, buttonZlib, buttonJPEG;
+ qualtext, qualslider, buttonZlib, buttonJPEG, alrtext, alrslider, buttonALRJPEG;
void
@@ -76,6 +76,18 @@ UpdateQual(void)
XtVaSetValues(buttonJPEG, XtNstate, 1, NULL);
else
XtVaSetValues(buttonJPEG, XtNstate, 0, NULL);
+
+ if (appData.automaticRefreshJPEG)
+ XtVaSetValues(buttonALRJPEG, XtNstate, 1, NULL);
+ else
+ XtVaSetValues(buttonALRJPEG, XtNstate, 0, NULL);
+
+ if (appData.automaticLosslessRefresh == 0.0) {
+ sprintf(text, "NO");
+ } else {
+ sprintf(text, "%.2f s", appData.automaticLosslessRefresh);
+ }
+ XtVaSetValues(alrtext, XtNlabel, text, NULL);
if(appData.subsampLevel==TVNC_1X)
{
@@ -154,6 +166,36 @@ qualJumpProc(Widget w, XtPointer client, XtPointer p)
UpdateQual();
}
+void
+alrScrollProc(Widget w, XtPointer client, XtPointer p)
+{
+ float size, val; int qual; long pos=(long)p;
+ XtVaGetValues(w, XtNshown, &size, XtNtopOfThumb, &val, 0);
+ if(pos<0) val-=.1; else val+=.1;
+ if (val < 0.1)
+ val = 0.0;
+ if (val > 5.0)
+ val = 5.0;
+ XawScrollbarSetThumb(w, val, 0.);
+ appData.automaticLosslessRefresh=val;
+ printf("ALR set to %f\n", val);
+ UpdateQual();
+}
+
+
+void
+alrJumpProc(Widget w, XtPointer client, XtPointer p)
+{
+ float val=*(float *)p;
+ val *= 5;
+ if (val < 0.1)
+ val = 0.0;
+ if (val > 5.0)
+ val = 5.0;
+ appData.automaticLosslessRefresh = val;
+ printf("ALR scroll set to %f\n", appData.automaticLosslessRefresh);
+ UpdateQual();
+}
void
buttonZlibProc(Widget w, XtPointer client, XtPointer p)
@@ -176,6 +218,15 @@ buttonJPEGProc(Widget w, XtPointer client, XtPointer p)
UpdateQual();
}
+void
+buttonALRJPEGProc(Widget w, XtPointer client, XtPointer p)
+{
+ if((long)p==1) {
+ appData.automaticRefreshJPEG=True;
+ }
+ else appData.automaticRefreshJPEG=False;
+ UpdateQual();
+}
void
buttonGrayProc(Widget w, XtPointer client, XtPointer p)
@@ -313,4 +364,25 @@ CreatePopup()
NULL);
XtAddCallback(buttonZlib, XtNcallback, buttonZlibProc, NULL);
+ label = XtCreateManagedWidget("alrLabel", labelWidgetClass, buttonForm, NULL, 0);
+ XtVaSetValues(label, XtNfromVert, buttonZlib, XtNleft, XawChainLeft, XtNright,
+ XawChainRight, NULL);
+
+ alrslider = XtCreateManagedWidget("qualBar", scrollbarWidgetClass, buttonForm,
+ NULL, 0);
+ XtVaSetValues(alrslider, XtNfromVert, label, XtNleft, XawChainLeft, NULL);
+ XtAddCallback(alrslider, XtNscrollProc, alrScrollProc, NULL) ;
+ XtAddCallback(alrslider, XtNjumpProc, alrJumpProc, NULL) ;
+
+ alrtext = XtCreateManagedWidget("alrText", labelWidgetClass, buttonForm,
+ NULL, 0);
+ XtVaSetValues(alrtext, XtNfromVert, label, XtNfromHoriz, alrslider, XtNright,
+ XawChainRight, NULL);
+
+ buttonALRJPEG = XtCreateManagedWidget("enableALRJPEG", toggleWidgetClass, buttonForm,
+ NULL, 0);
+ XtVaSetValues(buttonALRJPEG, XtNfromVert, alrslider, XtNleft, XawChainLeft,
+ NULL);
+ XtAddCallback(buttonALRJPEG, XtNcallback, buttonALRJPEGProc, NULL);
+
}
diff --git a/vnc_unixsrc/vncviewer/rfbproto.c b/vnc_unixsrc/vncviewer/rfbproto.c
index b2096a9..7f8ebb1 100644
--- a/vnc_unixsrc/vncviewer/rfbproto.c
+++ b/vnc_unixsrc/vncviewer/rfbproto.c
@@ -1861,33 +1861,7 @@ ReadCompactLen (void)
static void alr_timeout(XtPointer dummy, XtIntervalId *timer)
{
- printf("Doing ALR\n");
- String encodings = appData.encodingsString;
- int compressLevel = appData.compressLevel;
- int qual = appData.qualityLevel;
- int subsampLevel = appData.subsampLevel;
- Bool enableJPEG = appData.enableJPEG;
-
- if (appData.automaticRefreshJPEG) {
- appData.qualityLevel = 95;
- appData.enableJPEG = True;
- appData.subsampLevel = TVNC_1X;
- } else {
- appData.enableJPEG = False;
- }
-
- appData.encodingsString = "tight copyrect";
- appData.compressLevel = 1;
- SetFormatAndEncodings();
- SendFramebufferUpdateRequest(0, 0, si.framebufferWidth,
- si.framebufferHeight, False);
- appData.qualityLevel = qual;
- appData.enableJPEG = enableJPEG;
- appData.encodingsString = encodings;
- appData.compressLevel = compressLevel;
- appData.subsampLevel = subsampLevel;
-
- SetFormatAndEncodings();
+ LosslessRefresh(NULL, NULL, NULL, NULL);
alr_timeout_id = 0;
}
--
1.7.5.1
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
VirtualGL-Devel mailing list
VirtualGL-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtualgl-devel