[X2Go-Commits] [x2gokdriveclient] 01/01: add command line argument --selection (both|none|server|client) to specify selection mode.

git-admin at x2go.org git-admin at x2go.org
Fri Aug 21 17:44:58 CEST 2020


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2gokdriveclient.

commit f3cb60377fff7395b3259befd31d7c7d8fc33e82
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date:   Fri Aug 21 10:44:47 2020 -0500

    add command line argument --selection (both|none|server|client) to specify selection mode.
---
 client.cpp       | 24 ++++++++++++++++++++++++
 client.h         |  4 ++++
 debian/changelog |  1 +
 xcbclip.cpp      | 18 ++++++++++++++++++
 4 files changed, 47 insertions(+)

diff --git a/client.cpp b/client.cpp
index a2178e6..612519b 100644
--- a/client.cpp
+++ b/client.cpp
@@ -553,6 +553,30 @@ void Client::connectToServer()
             multidisp=true;
             dispNumber=args[++i].toUInt()-1;
         }
+        if(args[i]=="--selection")
+        {
+            QString smode=args[++i];
+            if(smode=="both")
+            {
+                clipMode=CLIP_BOTH;
+            }
+            else if(smode=="none")
+            {
+                clipMode=CLIP_NONE;
+            }
+            else if(smode=="client")
+            {
+                clipMode=CLIP_CLIENT;
+            }
+            else if(smode=="server")
+            {
+                clipMode=CLIP_SERVER;
+            }
+            else
+            {
+                qDebug()<<"Unsupported selections mode:"<<smode;
+            }
+        }
 
         if(args[i].indexOf("option")!=-1)
         {
diff --git a/client.h b/client.h
index fdb3f72..b706a4f 100644
--- a/client.h
+++ b/client.h
@@ -68,6 +68,7 @@
 
 enum SelectionMime{STRING,UTF_STRING,PIXMAP};
 enum SelectionType{PRIMARY,CLIPBOARD};
+enum ClipboardMode{CLIP_BOTH, CLIP_SERVER, CLIP_CLIENT, CLIP_NONE};
 
 
 #include <QMainWindow>
@@ -152,6 +153,7 @@ public:
     bool isDisplayPointer(QMouseEvent* event);
     void addToSelectionOutput(OutputChunk* chunk);
     bool serverSupportsExtSelection(){return serverExtSelection;}
+    ClipboardMode clipboardMode(){return clipMode;}
     void sendOutputSelChunk();
 
 
@@ -266,6 +268,8 @@ private:
     bool compressed;
     //////////
 
+    ClipboardMode clipMode=CLIP_BOTH; //clipboard mode: both, server, client or none
+
     uint32_t deletedFramesSize=0;
     uint32_t deletedCursorsSize=0;
 
diff --git a/debian/changelog b/debian/changelog
index f18db7a..d3231a3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -22,5 +22,6 @@ x2gokdriveclient (0.0.0.1-0x2go1) UNRELEASED; urgency=medium
     - identify screen, when user hovering the action in the multiple monitors menu.
     - not use QClipboard class on Linux. It has problems mit INCR properties. Using XCB API instead.
     - add xcb and xcb-fixes to deps.
+    - add command line argument --selection (both|none|server|client) to specify selection mode.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Tue, 04 Jun 2019 11:10:43 +0200
diff --git a/xcbclip.cpp b/xcbclip.cpp
index 6722ae4..e62d311 100644
--- a/xcbclip.cpp
+++ b/xcbclip.cpp
@@ -251,6 +251,15 @@ void XCBClip::checkEvents()
         }
         else
         {
+            switch(parent->clipboardMode())
+            {
+                case CLIP_SERVER:
+                case CLIP_NONE:
+                    qDebug()<<"Client selection is disabled";
+                    return;
+                default:
+                    break;
+            }
             //cancel all previous incr reading
             incrementalSize=incrementalSizeRead=0;
             incrAtom=0;
@@ -602,6 +611,15 @@ void XCBClip::setInputSelectionData(SelectionType selection, SelectionMime mime,
 
 void XCBClip::own_selection(SelectionType selection)
 {
+    switch(parent->clipboardMode())
+    {
+        case CLIP_CLIENT:
+        case CLIP_NONE:
+            qDebug()<<"Server selection is disabled";
+            return;
+        default:
+            break;
+    }
     xcb_atom_t sel=XCB_ATOM_PRIMARY;
     if(selection!=PRIMARY)
     {

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdriveclient.git


More information about the x2go-commits mailing list