Mercurial > 510Connectbot
comparison src/com/five_ten_sg/connectbot/service/TerminalMonitor.java @ 16:48a8daea9221
delay sending cursor move notifications until the host is quiet
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Thu, 29 May 2014 20:15:58 -0700 |
parents | 1588e359a972 |
children | 02717d15de9b |
comparison
equal
deleted
inserted
replaced
15:1588e359a972 | 16:48a8daea9221 |
---|---|
44 private String init = null; | 44 private String init = null; |
45 private int start_line = 0; // monitor part of the screen for changes | 45 private int start_line = 0; // monitor part of the screen for changes |
46 private int end_line = 500; // "" | 46 private int end_line = 500; // "" |
47 private int start_column = 0; // "" | 47 private int start_column = 0; // "" |
48 private int end_column = 500; // "" | 48 private int end_column = 500; // "" |
49 private boolean modified = false; // "" | 49 private boolean modified = false; // used to delay screen change notifications |
50 private boolean moved = false; // used to delay cursor moved notifications | |
51 private int to_line = 0; // "" | |
52 private int to_column = 0; // "" | |
50 private HashMap<Integer,Integer> keymap = null; | 53 private HashMap<Integer,Integer> keymap = null; |
51 private IBinder bound = null; | 54 private IBinder bound = null; |
52 private Socket monitor_socket = null; | 55 private Socket monitor_socket = null; |
53 private InputStream monitor_in = null; | 56 private InputStream monitor_in = null; |
54 private OutputStream monitor_out = null; | 57 private OutputStream monitor_out = null; |
321 arg[2] = (char)(b & 0x0000ffff); | 324 arg[2] = (char)(b & 0x0000ffff); |
322 monitorWrite(MONITOR_CMD_HOSTDATA, arg); | 325 monitorWrite(MONITOR_CMD_HOSTDATA, arg); |
323 } | 326 } |
324 | 327 |
325 public synchronized void cursorMove(int l, int c) { | 328 public synchronized void cursorMove(int l, int c) { |
329 moved = true; | |
330 to_line = l | |
331 to_column = c; | |
332 } | |
333 | |
334 public void cursorMoved() { | |
326 char[] arg = new char[4]; | 335 char[] arg = new char[4]; |
327 arg[2] = (char)(l & 0x0000ffff); | 336 arg[2] = (char)(l & 0x0000ffff); |
328 arg[3] = (char)(c & 0x0000ffff); | 337 arg[3] = (char)(c & 0x0000ffff); |
329 monitorWrite(MONITOR_CMD_CURSORMOVE, arg); | 338 monitorWrite(MONITOR_CMD_CURSORMOVE, arg); |
330 } | 339 } |
331 | 340 |
332 public synchronized void testChanged() { | 341 public synchronized void testChanged() { |
333 if (modified) { | 342 if (modified) { |
334 modified = false; | 343 modified = false; |
335 sendScreen(MONITOR_CMD_SCREENCHANGE); | 344 sendScreen(MONITOR_CMD_SCREENCHANGE); |
345 } | |
346 if (moved) { | |
347 moved = false; | |
348 cursorMoved(); | |
336 } | 349 } |
337 } | 350 } |
338 | 351 |
339 public synchronized void screenChanged(int llow, int lhigh, int clow, int chigh) { | 352 public synchronized void screenChanged(int llow, int lhigh, int clow, int chigh) { |
340 if ((start_line <= lhigh) && (llow <= end_line) && (start_column <= chigh) && (clow <= end_column)) { | 353 if ((start_line <= lhigh) && (llow <= end_line) && (start_column <= chigh) && (clow <= end_column)) { |