Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: remoting/webapp/crd/js/desktop_connected_view.js

Issue 1153923007: Add a menu option for the right-hand Ctrl -> Meta mapping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename Super to Meta. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/crd/js/desktop_connected_view.js
diff --git a/remoting/webapp/crd/js/desktop_connected_view.js b/remoting/webapp/crd/js/desktop_connected_view.js
index 9f7b56ae2c6356eeae78bf9b24a8e69692dcd098..a066284dad75d65eb16e68b3b753f038e5703456 100644
--- a/remoting/webapp/crd/js/desktop_connected_view.js
+++ b/remoting/webapp/crd/js/desktop_connected_view.js
@@ -106,6 +106,15 @@ remoting.DesktopConnectedView.prototype.getResizeToClient = function() {
return false;
};
+/**
+ * @return {boolean} True if the right-hand Ctrl key should be remapped to the
+ * Meta (Windows, Command) key.
+ */
+remoting.DesktopConnectedView.prototype.getMapRightCtrl = function() {
+ var currentMapping = this.host_.options.remapKeys;
+ return currentMapping.search('0x0700e4>0x0700e7') !== -1;
+};
+
remoting.DesktopConnectedView.prototype.toggleStats = function() {
this.stats_.toggle();
};
@@ -235,6 +244,29 @@ remoting.DesktopConnectedView.prototype.onFullScreenChanged_ = function (
};
/**
+ * Set whether or not the right-hand Ctrl key should send the Meta (Windows,
+ * Command) key-code.
+ *
+ * @param {boolean} enable True to enable the mapping; false to disable.
+ */
+remoting.DesktopConnectedView.prototype.setMapRightCtrl = function(enable) {
+ if (enable === this.getMapRightCtrl()) {
+ return;
+ }
+ var currentMapping = this.host_.options.remapKeys;
+ if (enable) {
+ var separator = (currentMapping === '') ? '' : ',';
+ currentMapping += (separator + '0x0700e4>0x0700e7');
Wez 2015/06/01 19:47:57 This code's made complex by the need to support th
Jamie 2015/06/01 19:59:51 Storing it as a map would make it less complex, so
Wez 2015/06/01 20:01:36 Right - my point is that your current code is copi
Jamie 2015/06/01 22:27:02 I've simplified the implementation as you suggest.
Wez 2015/06/02 17:32:56 I'm fine with landing this simple version of the p
+ } else {
+ // Remove the right-ctrl mapping and either a leading or trailing comma (but
+ // not both) if there is one.
+ currentMapping = currentMapping.replace(/0x0700e4>0x0700e7,/, '');
kelvinp 2015/06/01 18:57:14 Not in this CL, but i think it would be more natur
Wez 2015/06/01 19:47:57 +1
+ currentMapping = currentMapping.replace(/,{0,1}0x0700e4>0x0700e7/, '');
+ }
+ this.setRemapKeys(currentMapping);
+};
+
+/**
* Sends a Ctrl-Alt-Del sequence to the remoting client.
*
* @return {void} Nothing.

Powered by Google App Engine
This is Rietveld 408576698