fix Terminal element. check for allocated gpmclient.

This commit is contained in:
Christopher Jeffrey 2015-02-17 22:12:49 -08:00
parent a335257505
commit 5d72fb1938
2 changed files with 18 additions and 16 deletions

View File

@ -750,6 +750,8 @@ Program.prototype.enableGpm = function() {
var self = this;
var gpmclient = require('./gpmclient')
if (this.gpm) return;
this.gpm = gpmclient();
this.gpm.on('btndown', function(btn, modifier, x, y) {

View File

@ -6596,10 +6596,12 @@ Terminal.prototype.bootstrap = function() {
this.screen.on('mouse', function(data) {
if (self.screen.focused !== self) return;
if (data.x < self.left + self.ileft) return;
if (data.y < self.top + self.itop) return;
if (data.x > self.left - self.ileft + self.width) return;
if (data.y > self.top - self.itop + self.height) return;
if (self.term.x10Mouse
|| self.term.vt200Mouse
|| self.term.normalMouse
@ -6611,13 +6613,14 @@ Terminal.prototype.bootstrap = function() {
} else {
return;
}
var b = data.raw[0];
//var x = data.x - (self.left + self.ileft);
//var y = data.y - (self.top + self.itop);
var x = data.x - self.left;
var y = data.y - self.top;
var b = data.raw[0]
, x = data.x - self.left
, y = data.y - self.top
, s;
if (self.term.urxvtMouse) {
var s = '\x1b['
s = '\x1b['
+ String.fromCharCode(b)
+ ';'
+ String.fromCharCode(x)
@ -6628,7 +6631,7 @@ Terminal.prototype.bootstrap = function() {
if (!self.screen.program.sgrMouse) {
b -= 32;
}
var s = '\x1b[<'
s = '\x1b[<'
+ String.fromCharCode(b)
+ ';'
+ String.fromCharCode(x)
@ -6636,11 +6639,12 @@ Terminal.prototype.bootstrap = function() {
+ String.fromCharCode(y)
+ (data.action === 'mousedown' ? 'M' : 'm');
} else {
var s = '\x1b[M'
s = '\x1b[M'
+ String.fromCharCode(b)
+ String.fromCharCode(x + 32)
+ String.fromCharCode(y + 32);
}
self.handler(s);
});
@ -6749,18 +6753,14 @@ Terminal.prototype.render = function() {
// default foreground = 257
if (((line[x][0] >> 9) & 0x1ff) === 257) {
if (!((line[x][0] >> 18) & 8)) {
line[x][0] &= ~(0x1ff << 9);
line[x][0] |= ((this.dattr >> 9) & 0x1ff) << 9;
}
line[x][0] &= ~(0x1ff << 9);
line[x][0] |= ((this.dattr >> 9) & 0x1ff) << 9;
}
// default background = 256
if ((line[x][0] & 0x1ff) === 256) {
if (!((line[x][0] >> 18) & 8)) {
line[x][0] &= ~0x1ff;
line[x][0] |= this.dattr & 0x1ff;
}
line[x][0] &= ~0x1ff;
line[x][0] |= this.dattr & 0x1ff;
}
}