From bdc877c53e59a806310fe26d7010edb108f61224 Mon Sep 17 00:00:00 2001 From: "zodiac@gmail.com" Date: Fri, 6 Aug 2010 22:15:35 +0000 Subject: [PATCH] Allow users to disable blinking cursor from context menu. git-svn-id: https://shellinabox.googlecode.com/svn/trunk@212 0da03de8-d603-11dd-86c2-0f8696b7b6f9 --- ChangeLog | 4 ++++ config.h | 2 +- configure | 2 +- configure.ac | 2 +- demo/vt100.js | 37 ++++++++++++++++++++++++----------- shellinabox/shell_in_a_box.js | 2 +- shellinabox/vt100.js | 37 ++++++++++++++++++++++++----------- shellinabox/vt100.jspp | 35 +++++++++++++++++++++++---------- 8 files changed, 85 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index fe29b31..3d476f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-08-06 Markus Gutschke + + * Allow users to disable the blinking cursor from the context menu. + 2010-07-08 Markus Gutschke * Added support for systems that have utmpx.h, but don't implement diff --git a/config.h b/config.h index f7c56ee..950cb99 100644 --- a/config.h +++ b/config.h @@ -153,7 +153,7 @@ #define STDC_HEADERS 1 /* Most recent revision number in the version control system */ -#define VCS_REVISION "210" +#define VCS_REVISION "212" /* Version number of package */ #define VERSION "2.10" diff --git a/configure b/configure index e6341db..c1fa825 100755 --- a/configure +++ b/configure @@ -2328,7 +2328,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -VCS_REVISION=210 +VCS_REVISION=212 cat >>confdefs.h <<_ACEOF diff --git a/configure.ac b/configure.ac index c3c6cbf..9c74568 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ(2.57) dnl This is the one location where the authoritative version number is stored AC_INIT(shellinabox, 2.10, markus@shellinabox.com) -VCS_REVISION=210 +VCS_REVISION=212 AC_SUBST(VCS_REVISION) AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}", [Most recent revision number in the version control system]) diff --git a/demo/vt100.js b/demo/vt100.js index 2d45b79..2aeb9f8 100644 --- a/demo/vt100.js +++ b/demo/vt100.js @@ -281,11 +281,12 @@ VT100.prototype.getUserSettings = function() { // Compute hash signature to identify the entries in the userCSS menu. // If the menu is unchanged from last time, default values can be // looked up in a cookie associated with this page. - this.signature = 1; + this.signature = 2; this.utfPreferred = true; this.visualBell = typeof suppressAllAudio != 'undefined' && suppressAllAudio; this.autoprint = true; + this.blinkingCursor = true; if (this.visualBell) { this.signature = Math.floor(16807*this.signature + 1) % ((1 << 31) - 1); @@ -315,6 +316,7 @@ VT100.prototype.getUserSettings = function() { this.utfPreferred = settings.charAt(0) != '0'; this.visualBell = settings.charAt(1) != '0'; this.autoprint = settings.charAt(2) != '0'; + this.blinkingCursor = settings.charAt(3) != '0'; if (typeof userCSSList != 'undefined') { for (var i = 0; i < userCSSList.length; ++i) { userCSSList[i][2] = settings.charAt(i + 3) != '0'; @@ -327,9 +329,10 @@ VT100.prototype.getUserSettings = function() { VT100.prototype.storeUserSettings = function() { var settings = 'shellInABox=' + this.signature + ':' + - (this.utfEnabled ? '1' : '0') + - (this.visualBell ? '1' : '0') + - (this.autoprint ? '1' : '0'); + (this.utfEnabled ? '1' : '0') + + (this.visualBell ? '1' : '0') + + (this.autoprint ? '1' : '0') + + (this.blinkingCursor ? '1' : '0'); if (typeof userCSSList != 'undefined') { for (var i = 0; i < userCSSList.length; ++i) { settings += userCSSList[i][2] ? '1' : '0'; @@ -1954,8 +1957,12 @@ VT100.prototype.toggleBell = function() { this.visualBell = !this.visualBell; }; +VT100.prototype.toggleCursorBlinking = function() { + this.blinkingCursor = !this.blinkingCursor; +}; + VT100.prototype.about = function() { - alert("VT100 Terminal Emulator " + "2.10 (revision 210)" + + alert("VT100 Terminal Emulator " + "2.10 (revision 212)" + "\nCopyright 2008-2010 by Markus Gutschke\n" + "For more information check http://shellinabox.com"); }; @@ -1985,9 +1992,12 @@ VT100.prototype.showContextMenu = function(x, y) { '
  • ' + (this.utfEnabled ? '' : '') + 'Unicode
  • ' + - '
  • ' + + '
  • ' + (this.visualBell ? '' : '') + 'Visual Bell
  • '+ + '
  • ' + + (this.blinkingCursor ? '' : '') + + 'Blinking Cursor
  • '+ (this.usercss.firstChild ? '
    ' + this.usercss.innerHTML + @@ -2015,7 +2025,8 @@ VT100.prototype.showContextMenu = function(x, y) { // Actions for default items var actions = [ this.copyLast, p, this.reset, - this.toggleUTF, this.toggleBell ]; + this.toggleUTF, this.toggleBell, + this.toggleCursorBlinking ]; // Actions for user CSS styles (if any) for (var i = 0; i < this.usercssActions.length; ++i) { @@ -2615,7 +2626,7 @@ VT100.prototype.keyUp = function(event) { VT100.prototype.animateCursor = function(inactive) { if (!this.cursorInterval) { - this.cursorInterval = setInterval( + this.cursorInterval = setInterval( function(vt100) { return function() { vt100.animateCursor(); @@ -2628,10 +2639,14 @@ VT100.prototype.animateCursor = function(inactive) { } if (inactive != undefined || this.cursor.className != 'inactive') { if (inactive) { - this.cursor.className = 'inactive'; + this.cursor.className = 'inactive'; } else { - this.cursor.className = this.cursor.className == 'bright' - ? 'dim' : 'bright'; + if (this.blinkingCursor) { + this.cursor.className = this.cursor.className == 'bright' + ? 'dim' : 'bright'; + } else { + this.cursor.className = 'bright'; + } } } }; diff --git a/shellinabox/shell_in_a_box.js b/shellinabox/shell_in_a_box.js index 94620f8..8e27d6f 100644 --- a/shellinabox/shell_in_a_box.js +++ b/shellinabox/shell_in_a_box.js @@ -358,7 +358,7 @@ ShellInABox.prototype.extendContextMenu = function(entries, actions) { }; ShellInABox.prototype.about = function() { - alert("Shell In A Box version " + "2.10 (revision 210)" + + alert("Shell In A Box version " + "2.10 (revision 212)" + "\nCopyright 2008-2010 by Markus Gutschke\n" + "For more information check http://shellinabox.com" + (typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ? diff --git a/shellinabox/vt100.js b/shellinabox/vt100.js index 2d45b79..2aeb9f8 100644 --- a/shellinabox/vt100.js +++ b/shellinabox/vt100.js @@ -281,11 +281,12 @@ VT100.prototype.getUserSettings = function() { // Compute hash signature to identify the entries in the userCSS menu. // If the menu is unchanged from last time, default values can be // looked up in a cookie associated with this page. - this.signature = 1; + this.signature = 2; this.utfPreferred = true; this.visualBell = typeof suppressAllAudio != 'undefined' && suppressAllAudio; this.autoprint = true; + this.blinkingCursor = true; if (this.visualBell) { this.signature = Math.floor(16807*this.signature + 1) % ((1 << 31) - 1); @@ -315,6 +316,7 @@ VT100.prototype.getUserSettings = function() { this.utfPreferred = settings.charAt(0) != '0'; this.visualBell = settings.charAt(1) != '0'; this.autoprint = settings.charAt(2) != '0'; + this.blinkingCursor = settings.charAt(3) != '0'; if (typeof userCSSList != 'undefined') { for (var i = 0; i < userCSSList.length; ++i) { userCSSList[i][2] = settings.charAt(i + 3) != '0'; @@ -327,9 +329,10 @@ VT100.prototype.getUserSettings = function() { VT100.prototype.storeUserSettings = function() { var settings = 'shellInABox=' + this.signature + ':' + - (this.utfEnabled ? '1' : '0') + - (this.visualBell ? '1' : '0') + - (this.autoprint ? '1' : '0'); + (this.utfEnabled ? '1' : '0') + + (this.visualBell ? '1' : '0') + + (this.autoprint ? '1' : '0') + + (this.blinkingCursor ? '1' : '0'); if (typeof userCSSList != 'undefined') { for (var i = 0; i < userCSSList.length; ++i) { settings += userCSSList[i][2] ? '1' : '0'; @@ -1954,8 +1957,12 @@ VT100.prototype.toggleBell = function() { this.visualBell = !this.visualBell; }; +VT100.prototype.toggleCursorBlinking = function() { + this.blinkingCursor = !this.blinkingCursor; +}; + VT100.prototype.about = function() { - alert("VT100 Terminal Emulator " + "2.10 (revision 210)" + + alert("VT100 Terminal Emulator " + "2.10 (revision 212)" + "\nCopyright 2008-2010 by Markus Gutschke\n" + "For more information check http://shellinabox.com"); }; @@ -1985,9 +1992,12 @@ VT100.prototype.showContextMenu = function(x, y) { '
  • ' + (this.utfEnabled ? '' : '') + 'Unicode
  • ' + - '
  • ' + + '
  • ' + (this.visualBell ? '' : '') + 'Visual Bell
  • '+ + '
  • ' + + (this.blinkingCursor ? '' : '') + + 'Blinking Cursor
  • '+ (this.usercss.firstChild ? '
    ' + this.usercss.innerHTML + @@ -2015,7 +2025,8 @@ VT100.prototype.showContextMenu = function(x, y) { // Actions for default items var actions = [ this.copyLast, p, this.reset, - this.toggleUTF, this.toggleBell ]; + this.toggleUTF, this.toggleBell, + this.toggleCursorBlinking ]; // Actions for user CSS styles (if any) for (var i = 0; i < this.usercssActions.length; ++i) { @@ -2615,7 +2626,7 @@ VT100.prototype.keyUp = function(event) { VT100.prototype.animateCursor = function(inactive) { if (!this.cursorInterval) { - this.cursorInterval = setInterval( + this.cursorInterval = setInterval( function(vt100) { return function() { vt100.animateCursor(); @@ -2628,10 +2639,14 @@ VT100.prototype.animateCursor = function(inactive) { } if (inactive != undefined || this.cursor.className != 'inactive') { if (inactive) { - this.cursor.className = 'inactive'; + this.cursor.className = 'inactive'; } else { - this.cursor.className = this.cursor.className == 'bright' - ? 'dim' : 'bright'; + if (this.blinkingCursor) { + this.cursor.className = this.cursor.className == 'bright' + ? 'dim' : 'bright'; + } else { + this.cursor.className = 'bright'; + } } } }; diff --git a/shellinabox/vt100.jspp b/shellinabox/vt100.jspp index 4d83daa..51c8fe9 100644 --- a/shellinabox/vt100.jspp +++ b/shellinabox/vt100.jspp @@ -281,11 +281,12 @@ VT100.prototype.getUserSettings = function() { // Compute hash signature to identify the entries in the userCSS menu. // If the menu is unchanged from last time, default values can be // looked up in a cookie associated with this page. - this.signature = 1; + this.signature = 2; this.utfPreferred = true; this.visualBell = typeof suppressAllAudio != 'undefined' && suppressAllAudio; this.autoprint = true; + this.blinkingCursor = true; if (this.visualBell) { this.signature = Math.floor(16807*this.signature + 1) % ((1 << 31) - 1); @@ -315,6 +316,7 @@ VT100.prototype.getUserSettings = function() { this.utfPreferred = settings.charAt(0) != '0'; this.visualBell = settings.charAt(1) != '0'; this.autoprint = settings.charAt(2) != '0'; + this.blinkingCursor = settings.charAt(3) != '0'; if (typeof userCSSList != 'undefined') { for (var i = 0; i < userCSSList.length; ++i) { userCSSList[i][2] = settings.charAt(i + 3) != '0'; @@ -327,9 +329,10 @@ VT100.prototype.getUserSettings = function() { VT100.prototype.storeUserSettings = function() { var settings = 'shellInABox=' + this.signature + ':' + - (this.utfEnabled ? '1' : '0') + - (this.visualBell ? '1' : '0') + - (this.autoprint ? '1' : '0'); + (this.utfEnabled ? '1' : '0') + + (this.visualBell ? '1' : '0') + + (this.autoprint ? '1' : '0') + + (this.blinkingCursor ? '1' : '0'); if (typeof userCSSList != 'undefined') { for (var i = 0; i < userCSSList.length; ++i) { settings += userCSSList[i][2] ? '1' : '0'; @@ -1954,6 +1957,10 @@ VT100.prototype.toggleBell = function() { this.visualBell = !this.visualBell; }; +VT100.prototype.toggleCursorBlinking = function() { + this.blinkingCursor = !this.blinkingCursor; +}; + VT100.prototype.about = function() { alert("VT100 Terminal Emulator " + VERSION + "\nCopyright 2008-2010 by Markus Gutschke\n" + @@ -1985,9 +1992,12 @@ VT100.prototype.showContextMenu = function(x, y) { '
  • ' + (this.utfEnabled ? '' : '') + 'Unicode
  • ' + - '
  • ' + + '
  • ' + (this.visualBell ? '' : '') + 'Visual Bell
  • '+ + '
  • ' + + (this.blinkingCursor ? '' : '') + + 'Blinking Cursor
  • '+ (this.usercss.firstChild ? '
    ' + this.usercss.innerHTML + @@ -2015,7 +2025,8 @@ VT100.prototype.showContextMenu = function(x, y) { // Actions for default items var actions = [ this.copyLast, p, this.reset, - this.toggleUTF, this.toggleBell ]; + this.toggleUTF, this.toggleBell, + this.toggleCursorBlinking ]; // Actions for user CSS styles (if any) for (var i = 0; i < this.usercssActions.length; ++i) { @@ -2615,7 +2626,7 @@ VT100.prototype.keyUp = function(event) { VT100.prototype.animateCursor = function(inactive) { if (!this.cursorInterval) { - this.cursorInterval = setInterval( + this.cursorInterval = setInterval( function(vt100) { return function() { vt100.animateCursor(); @@ -2628,10 +2639,14 @@ VT100.prototype.animateCursor = function(inactive) { } if (inactive != undefined || this.cursor.className != 'inactive') { if (inactive) { - this.cursor.className = 'inactive'; + this.cursor.className = 'inactive'; } else { - this.cursor.className = this.cursor.className == 'bright' - ? 'dim' : 'bright'; + if (this.blinkingCursor) { + this.cursor.className = this.cursor.className == 'bright' + ? 'dim' : 'bright'; + } else { + this.cursor.className = 'bright'; + } } } };