From f976b5500e6dceb19c39965b22cb1e4934a75a13 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 13 Oct 2017 13:07:17 +0200 Subject: [PATCH] Hide mouse object from RFB callers --- app/ui.js | 2 +- core/rfb.js | 10 +++++++++- docs/API.md | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/ui.js b/app/ui.js index b72088d6..c5cc7cbc 100644 --- a/app/ui.js +++ b/app/ui.js @@ -1657,7 +1657,7 @@ var UI = { setMouseButton: function(num) { var view_only = UI.rfb.get_view_only(); if (UI.rfb && !view_only) { - UI.rfb.get_mouse().set_touchButton(num); + UI.rfb.set_touchButton(num); } var blist = [0, 1,2,4]; diff --git a/core/rfb.js b/core/rfb.js index c41e9d8b..a329fcc6 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -1493,6 +1493,7 @@ make_properties(RFB, [ ['local_cursor', 'rw', 'bool'], // Request locally rendered cursor ['shared', 'rw', 'bool'], // Request shared mode ['view_only', 'rw', 'bool'], // Disable client mouse/keyboard + ['touchButton', 'rw', 'int'], // Button mask (1, 2, 4) for touch devices (0 means ignore clicks) ['scale', 'rw', 'float'], // Display area scale factor ['viewport', 'rw', 'bool'], // Use viewport clipping ['xvp_password_sep', 'rw', 'str'], // Separator for XVP password fields @@ -1549,6 +1550,14 @@ RFB.prototype.set_view_only = function (view_only) { } }; +RFB.prototype.set_touchButton = function (button) { + this._mouse.set_touchButton(button); +}; + +RFB.prototype.get_touchButton = function () { + return this._mouse.get_touchButton(); +}; + RFB.prototype.set_scale = function (scale) { this._display.set_scale(scale); }; @@ -1566,7 +1575,6 @@ RFB.prototype.get_viewport = function () { }; RFB.prototype.get_keyboard = function () { return this._keyboard; }; -RFB.prototype.get_mouse = function () { return this._mouse; }; // Class Methods RFB.messages = { diff --git a/docs/API.md b/docs/API.md index dd451999..959d137f 100644 --- a/docs/API.md +++ b/docs/API.md @@ -34,6 +34,7 @@ attribute mode is one of the following: | local_cursor | bool | RW | false | Request locally rendered cursor | shared | bool | RW | true | Request shared VNC mode | view_only | bool | RW | false | Disable client mouse/keyboard +| touchButton | int | RW | 1 | Button mask (1, 2, 4) for which click to send on touch devices. 0 means ignore clicks. | scale | float | RW | 1.0 | Display area scale factor | viewport | bool | RW | false | Use viewport clipping | xvp_password_sep | str | RW | '@' | Separator for XVP password fields