Mercurial > 510Connectbot
comparison src/com/five_ten_sg/connectbot/service/TerminalMonitor.java @ 308:42b15aaa7ac7 ganymed
merge
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 30 Jul 2014 14:21:50 -0700 |
parents | 071eccdff8ea |
children | 2f2b5a244a4d |
comparison
equal
deleted
inserted
replaced
306:90e47d99ea54 | 308:42b15aaa7ac7 |
---|---|
376 monitorWrite(MONITOR_CMD_KEYSTATE, arg); | 376 monitorWrite(MONITOR_CMD_KEYSTATE, arg); |
377 } | 377 } |
378 | 378 |
379 public synchronized void cursorMove(int l, int c) { | 379 public synchronized void cursorMove(int l, int c) { |
380 if ((to_line != l) || (to_column != c)) moved = true; | 380 if ((to_line != l) || (to_column != c)) moved = true; |
381 | |
381 to_line = l; | 382 to_line = l; |
382 to_column = c; | 383 to_column = c; |
383 } | 384 } |
384 | 385 |
385 public void cursorMoved(char why) { | 386 public void cursorMoved(char why) { |
419 public synchronized void setField(int l, int c, char[] data, int offset) { | 420 public synchronized void setField(int l, int c, char[] data, int offset) { |
420 Log.i(TAG, "setField()"); | 421 Log.i(TAG, "setField()"); |
421 int len = data.length - offset; | 422 int len = data.length - offset; |
422 char[] da = new char[len]; | 423 char[] da = new char[len]; |
423 System.arraycopy(data, offset, da, 0, len); | 424 System.arraycopy(data, offset, da, 0, len); |
425 | |
424 if ((l > 60000) || (c > 60000)) { | 426 if ((l > 60000) || (c > 60000)) { |
425 l = -1; | 427 l = -1; |
426 c = -1; | 428 c = -1; |
427 } | 429 } |
428 else { | 430 else { |
429 // ignore setfield outside screen boundaries | 431 // ignore setfield outside screen boundaries |
430 if ((l >= buffer.height) || (c+len >= buffer.width)) return; | 432 if ((l >= buffer.height) || (c + len >= buffer.width)) return; |
431 } | 433 } |
434 | |
432 buffer.setField(l, c, da); | 435 buffer.setField(l, c, da); |
433 } | 436 } |
434 | 437 |
435 public synchronized void showUrl(char [] data, int offset) { | 438 public synchronized void showUrl(char [] data, int offset) { |
436 Log.i(TAG, "setField()"); | 439 Log.i(TAG, "setField()"); |
437 char[] da = new char[data.length - offset]; | 440 char[] da = new char[data.length - offset]; |
438 System.arraycopy(data, offset, da, 0, data.length-offset); | 441 System.arraycopy(data, offset, da, 0, data.length - offset); |
439 String url = new String(da); | 442 String url = new String(da); |
440 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); | 443 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); |
441 parent.startActivity(intent); | 444 parent.startActivity(intent); |
442 } | 445 } |
443 | 446 |
445 Log.i(TAG, "getField()"); | 448 Log.i(TAG, "getField()"); |
446 char[] arg2 = new char[4 + len]; | 449 char[] arg2 = new char[4 + len]; |
447 arg2[2] = (char)(l & 0x0000ffff); | 450 arg2[2] = (char)(l & 0x0000ffff); |
448 arg2[3] = (char)(c & 0x0000ffff); | 451 arg2[3] = (char)(c & 0x0000ffff); |
449 int base = 4; | 452 int base = 4; |
450 if ((l >= buffer.height) || (c+len >= buffer.width)) { | 453 |
451 Arrays.fill(arg2, base, len-1, ' '); | 454 if ((l >= buffer.height) || (c + len >= buffer.width)) { |
455 Arrays.fill(arg2, base, len - 1, ' '); | |
452 } | 456 } |
453 else { | 457 else { |
454 System.arraycopy(buffer.charArray[buffer.screenBase + l], c, arg2, base, len); | 458 System.arraycopy(buffer.charArray[buffer.screenBase + l], c, arg2, base, len); |
455 } | 459 } |
460 | |
456 monitorWrite(MONITOR_CMD_FIELDVALUE, arg2); | 461 monitorWrite(MONITOR_CMD_FIELDVALUE, arg2); |
457 } | 462 } |
458 | 463 |
459 public synchronized void screenWatch(int l, int c, int len) { | 464 public synchronized void screenWatch(int l, int c, int len) { |
460 Log.i(TAG, "screenWatch()"); | 465 Log.i(TAG, "screenWatch()"); |
465 } | 470 } |
466 | 471 |
467 public synchronized void depress(int vk_key) { | 472 public synchronized void depress(int vk_key) { |
468 Log.i(TAG, String.format("depress() %d", vk_key)); | 473 Log.i(TAG, String.format("depress() %d", vk_key)); |
469 Integer x = keymap.get(new Integer(vk_key)); | 474 Integer x = keymap.get(new Integer(vk_key)); |
475 | |
470 if (x != null) buffer.keyDepressed(x, ' ', 0); | 476 if (x != null) buffer.keyDepressed(x, ' ', 0); |
471 } | 477 } |
472 | 478 |
473 public synchronized void switchSession() { | 479 public synchronized void switchSession() { |
474 Log.i(TAG, "switchSession()"); | 480 Log.i(TAG, "switchSession()"); |