Hello,

the attached patch adds a "View only" toggle button to the popup menu of the
VNC viewer.

Comments welcome.

Thanks
-- 
Greetings, 
A. Huillet
>From 80f587ae43a97f32efb78b766fb85194062e2296 Mon Sep 17 00:00:00 2001
From: Arthur Huillet <arthur.huil...@free.fr>
Date: Wed, 1 Feb 2012 16:01:08 +0100
Subject: [PATCH] unix vncviewer: Add "View only" button to the popup menu.

---
 vnc_unixsrc/vncviewer/argsresources.c |    6 ++++++
 vnc_unixsrc/vncviewer/popup.c         |   20 +++++++++++++++++---
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/vnc_unixsrc/vncviewer/argsresources.c b/vnc_unixsrc/vncviewer/argsresources.c
index 81c027d..dd08de0 100644
--- a/vnc_unixsrc/vncviewer/argsresources.c
+++ b/vnc_unixsrc/vncviewer/argsresources.c
@@ -148,6 +148,8 @@ char *fallback_resources[] = {
   "*subsamp4X.label: 4X",
   "*subsamp2X.label: 2X",
   "*subsamp1X.label: None",
+  
+  "*ViewOnly.label: View only",
 
   "*enableJPEG.label: Enable JPEG Compression",
 
@@ -233,6 +235,10 @@ char *fallback_resources[] = {
   "*popup*button15.label: Protocol: Lossless Tight + Zlib (WAN)",
   "*popup*button15.translations: #override\\n\
      <Btn1Down>,<Btn1Up>: QualLosslessWAN()",
+  
+  "*popup*button16.label: View only",
+  "*popup*button16.translations: #override\\n\
+     <Btn1Down>,<Btn1Up>: QualLosslessWAN()",
 
   NULL
 };
diff --git a/vnc_unixsrc/vncviewer/popup.c b/vnc_unixsrc/vncviewer/popup.c
index 128b823..deb9c3d 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, buttonViewOnly;
 
 
 void
@@ -176,8 +176,16 @@ buttonJPEGProc(Widget w, XtPointer client, XtPointer p)
   UpdateQual();
 }
 
-
 void
+buttonViewOnlyProc(Widget w, XtPointer client, XtPointer p)
+{
+  if((long)p==1) {
+    appData.viewOnly=True;
+  }
+  else appData.viewOnly=False;
+}
+
+	void
 buttonGrayProc(Widget w, XtPointer client, XtPointer p)
 {
   if((long)p==1) appData.subsampLevel=TVNC_GRAY;
@@ -259,9 +267,15 @@ CreatePopup()
     prevButton = button;
   }
 
+  buttonViewOnly = XtCreateManagedWidget("ViewOnly", toggleWidgetClass, buttonForm,
+    NULL, 0);
+  XtVaSetValues(buttonViewOnly, XtNfromVert, prevButton, XtNleft, XawChainLeft,
+    XtNstate, appData.viewOnly);
+  XtAddCallback(buttonViewOnly, XtNcallback, buttonViewOnlyProc, NULL);
+
   buttonJPEG = XtCreateManagedWidget("enableJPEG", toggleWidgetClass, buttonForm,
     NULL, 0);
-  XtVaSetValues(buttonJPEG, XtNfromVert, prevButton, XtNleft, XawChainLeft,
+  XtVaSetValues(buttonJPEG, XtNfromVert, buttonViewOnly, XtNleft, XawChainLeft,
     NULL);
   XtAddCallback(buttonJPEG, XtNcallback, buttonJPEGProc, NULL);
 
-- 
1.7.9

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
VirtualGL-Devel mailing list
VirtualGL-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtualgl-devel

Reply via email to