From 73e602939402995253bad4ba4059904853cf9d43 Mon Sep 17 00:00:00 2001 From: Malcolm Scott Date: Sat, 28 Sep 2013 19:25:52 +0100 Subject: [PATCH] Implement XVP extension UI --- images/power.png | Bin 0 -> 390 bytes include/base.css | 10 +++++++ include/ui.js | 76 +++++++++++++++++++++++++++++++++++++++++++++++ vnc.html | 14 ++++++++- 4 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 images/power.png diff --git a/images/power.png b/images/power.png new file mode 100644 index 0000000000000000000000000000000000000000..f68fd0813c02a625f3fb5097353b7825f287939f GIT binary patch literal 390 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1|*NXY)uAIY)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP)r;MP5p&nmUBLf4Yu&0Y-h{y4#VS!wS40wF6uK&wz zeJ1b0dp`q-xCQJ1W&L*#{jK6yZ}@>J>(2+?q>Rf`4Fzff;%=K%nq(i6F}{53M#?;U zLBZzq!>RXNprLZ*hUsB!Gewso}{}^ zyS5zqsqt+q$3eS=bG3syL}aJxswlO({ZMz^<8@I+aHiGz+=bUm8NM^#j@;<7{?FO# zrb}1(?6I-+nz%_ndc~vpE9T2SE8eKOh+S~6fqC~wzI*9n-{OAGRx&S`su`qNAN+(V z&&XBkX?|VBYQH4q-F|DjwzF)~vb(lB%jUA~j<{R9onkH8Tw^2Zl+T|DXQ^pge?vdW h@Q(gJk3Tz4NXMlvaGP>8%>o!=44$rjF6*2UngBV_o1g#y literal 0 HcmV?d00001 diff --git a/include/base.css b/include/base.css index 0578619e..228032ba 100644 --- a/include/base.css +++ b/include/base.css @@ -191,6 +191,16 @@ html { border-radius:10px; } +#noVNC_xvp { + display:none; + margin-top:73px; + right:30px; + position:fixed; +} +#noVNC_xvp.top:after { + right:125px; +} + #noVNC_clipboard { display:none; margin-top:73px; diff --git a/include/ui.js b/include/ui.js index b933d312..ce81b23b 100644 --- a/include/ui.js +++ b/include/ui.js @@ -84,6 +84,7 @@ start: function(callback) { UI.rfb = RFB({'target': $D('noVNC_canvas'), 'onUpdateState': UI.updateState, + 'onXvpInit': UI.updateXvpVisualState, 'onClipboard': UI.clipReceive, 'onDesktopName': UI.updateDocumentTitle}); UI.updateVisualState(); @@ -159,8 +160,12 @@ addMouseHandlers: function() { $D("keyboardinput").onblur = UI.keyInputBlur; $D("sendCtrlAltDelButton").onclick = UI.sendCtrlAltDel; + $D("xvpShutdownButton").onclick = UI.xvpShutdown; + $D("xvpRebootButton").onclick = UI.xvpReboot; + $D("xvpResetButton").onclick = UI.xvpReset; $D("noVNC_status").onclick = UI.togglePopupStatusPanel; $D("noVNC_popup_status_panel").onclick = UI.togglePopupStatusPanel; + $D("xvpButton").onclick = UI.toggleXvpPanel; $D("clipboardButton").onclick = UI.toggleClipboardPanel; $D("settingsButton").onclick = UI.toggleSettingsPanel; $D("connectButton").onclick = UI.toggleConnectPanel; @@ -277,6 +282,39 @@ togglePopupStatusPanel: function() { } }, +// Show the XVP panel +toggleXvpPanel: function() { + // Close the description panel + $D('noVNC_description').style.display = "none"; + // Close settings if open + if (UI.settingsOpen === true) { + UI.settingsApply(); + UI.closeSettingsMenu(); + } + // Close connection settings if open + if (UI.connSettingsOpen === true) { + UI.toggleConnectPanel(); + } + // Close popup status panel if open + if (UI.popupStatusOpen === true) { + UI.togglePopupStatusPanel(); + } + // Close clipboard panel if open + if (UI.clipboardOpen === true) { + UI.toggleClipboardPanel(); + } + // Toggle XVP panel + if (UI.xvpOpen === true) { + $D('noVNC_xvp').style.display = "none"; + $D('xvpButton').className = "noVNC_status_button"; + UI.xvpOpen = false; + } else { + $D('noVNC_xvp').style.display = "block"; + $D('xvpButton').className = "noVNC_status_button_selected"; + UI.xvpOpen = true; + } +}, + // Show the clipboard panel toggleClipboardPanel: function() { // Close the description panel @@ -294,6 +332,10 @@ toggleClipboardPanel: function() { if (UI.popupStatusOpen === true) { UI.togglePopupStatusPanel(); } + // Close XVP panel if open + if (UI.xvpOpen === true) { + UI.toggleXvpPanel(); + } // Toggle Clipboard Panel if (UI.clipboardOpen === true) { $D('noVNC_clipboard').style.display = "none"; @@ -324,6 +366,10 @@ toggleConnectPanel: function() { if (UI.popupStatusOpen === true) { UI.togglePopupStatusPanel(); } + // Close XVP panel if open + if (UI.xvpOpen === true) { + UI.toggleXvpPanel(); + } // Toggle Connection Panel if (UI.connSettingsOpen === true) { @@ -388,6 +434,10 @@ openSettingsMenu: function() { if (UI.popupStatusOpen === true) { UI.togglePopupStatusPanel(); } + // Close XVP panel if open + if (UI.xvpOpen === true) { + UI.toggleXvpPanel(); + } $D('noVNC_settings').style.display = "block"; $D('settingsButton').className = "noVNC_status_button_selected"; UI.settingsOpen = true; @@ -441,6 +491,18 @@ sendCtrlAltDel: function() { UI.rfb.sendCtrlAltDel(); }, +xvpShutdown: function() { + UI.rfb.xvpShutdown(); +}, + +xvpReboot: function() { + UI.rfb.xvpReboot(); +}, + +xvpReset: function() { + UI.rfb.xvpReset(); +}, + setMouseButton: function(num) { var b, blist = [0, 1,2,4], button; @@ -538,6 +600,7 @@ updateVisualState: function() { $D('clipboardButton').style.display = "none"; $D('showKeyboard').style.display = "none"; $D('sendCtrlAltDelButton').style.display = "none"; + UI.updateXvpVisualState(0); } // State change disables viewport dragging. // It is enabled (toggled) by direct click on the button @@ -560,6 +623,19 @@ updateVisualState: function() { //Util.Debug("<< updateVisualState"); }, +// Disable/enable XVP button +updateXvpVisualState: function(ver) { + if (ver >= 1) { + $D('xvpButton').style.display = 'inline'; + } else { + $D('xvpButton').style.display = 'none'; + // Close XVP panel if open + if (UI.xvpOpen === true) { + UI.toggleXvpPanel(); + } + } +}, + // Display the desktop name in the document title updateDocumentTitle: function(rfb, name) { diff --git a/vnc.html b/vnc.html index 66b70259..f7536335 100644 --- a/vnc.html +++ b/vnc.html @@ -72,12 +72,15 @@
Loading
- +e
+ @@ -121,6 +124,15 @@ value="Clear">
+ +
+ + + + + +
+