diff options
author | Kenny Root <kenny@the-b.org> | 2009-01-23 14:19:46 +0000 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2009-01-23 14:19:46 +0000 |
commit | a7fbe0bb6523c8659733b21c4bf957278e83ebfc (patch) | |
tree | 43d8ebaf959bba193415843039ce4572e4f677fd /src | |
parent | aed1876f36b34ee62e1537d42fcb339c6baa05b0 (diff) | |
download | connectbot-a7fbe0bb6523c8659733b21c4bf957278e83ebfc.tar.gz connectbot-a7fbe0bb6523c8659733b21c4bf957278e83ebfc.tar.bz2 connectbot-a7fbe0bb6523c8659733b21c4bf957278e83ebfc.zip |
Comply with RFC 4254 on window-change packet
* Always send false for "want reply"
* We don't need to wait since a reply should not be sent.
* Allow the sending of (informational) pixel dimensions.
Diffstat (limited to 'src')
-rw-r--r-- | src/com/trilead/ssh2/Session.java | 23 | ||||
-rw-r--r-- | src/com/trilead/ssh2/channel/ChannelManager.java | 14 | ||||
-rw-r--r-- | src/com/trilead/ssh2/packets/PacketSessionPtyResize.java | 14 | ||||
-rw-r--r-- | src/org/connectbot/service/TerminalBridge.java | 2 |
4 files changed, 34 insertions, 19 deletions
diff --git a/src/com/trilead/ssh2/Session.java b/src/com/trilead/ssh2/Session.java index c41d837..30efa6f 100644 --- a/src/com/trilead/ssh2/Session.java +++ b/src/com/trilead/ssh2/Session.java @@ -130,7 +130,26 @@ public class Session terminal_modes);
}
- public void resizePTY(int width, int height) throws IOException {
+ /**
+ * Inform other side of connection that our PTY has resized.
+ * <p>
+ * Zero dimension parameters are ignored. The character/row dimensions
+ * override the pixel dimensions (when nonzero). Pixel dimensions refer to
+ * the drawable area of the window. The dimension parameters are only
+ * informational.
+ *
+ * @param term_width_characters
+ * terminal width, characters (e.g., 80)
+ * @param term_height_characters
+ * terminal height, rows (e.g., 24)
+ * @param term_width_pixels
+ * terminal width, pixels (e.g., 640)
+ * @param term_height_pixels
+ * terminal height, pixels (e.g., 480)
+ * @throws IOException
+ */
+ public void resizePTY(int term_width_characters, int term_height_characters, int term_width_pixels,
+ int term_height_pixels) throws IOException {
synchronized (this)
{
/* The following is just a nicer error, we would catch it anyway later in the channel code */
@@ -138,7 +157,7 @@ public class Session throw new IOException("This session is closed.");
}
- cm.resizePTY(cn, width, height);
+ cm.resizePTY(cn, term_width_characters, term_height_characters, term_width_pixels, term_height_pixels);
}
/**
diff --git a/src/com/trilead/ssh2/channel/ChannelManager.java b/src/com/trilead/ssh2/channel/ChannelManager.java index e582a52..fb4beae 100644 --- a/src/com/trilead/ssh2/channel/ChannelManager.java +++ b/src/com/trilead/ssh2/channel/ChannelManager.java @@ -678,7 +678,8 @@ public class ChannelManager implements MessageHandler }
- public void resizePTY(Channel c, int width, int height) throws IOException {
+ public void resizePTY(Channel c, int term_width_characters, int term_height_characters,
+ int term_width_pixels, int term_height_pixels) throws IOException {
PacketSessionPtyResize spr;
synchronized (c) {
@@ -686,7 +687,8 @@ public class ChannelManager implements MessageHandler throw new IOException("Cannot request PTY on this channel ("
+ c.getReasonClosed() + ")");
- spr = new PacketSessionPtyResize(c.remoteID, true, width, height);
+ spr = new PacketSessionPtyResize(c.remoteID, term_width_characters, term_height_characters,
+ term_width_pixels, term_height_pixels);
c.successCounter = c.failedCounter = 0;
}
@@ -696,14 +698,6 @@ public class ChannelManager implements MessageHandler + c.getReasonClosed() + ")");
tm.sendMessage(spr.getPayload());
}
-
- try {
- //waitForChannelSuccessOrFailure(c);
- this.waitForChannelRequestResult(c);
- } catch (IOException e) {
- throw (IOException) new IOException("PTY request failed")
- .initCause(e);
- }
}
diff --git a/src/com/trilead/ssh2/packets/PacketSessionPtyResize.java b/src/com/trilead/ssh2/packets/PacketSessionPtyResize.java index 27b5f00..1e3b558 100644 --- a/src/com/trilead/ssh2/packets/PacketSessionPtyResize.java +++ b/src/com/trilead/ssh2/packets/PacketSessionPtyResize.java @@ -4,15 +4,17 @@ public class PacketSessionPtyResize { byte[] payload; public int recipientChannelID; - public boolean wantReply; public int width; public int height; + public int pixelWidth; + public int pixelHeight; - public PacketSessionPtyResize(int recipientChannelID, boolean wantReply, int width, int height) { + public PacketSessionPtyResize(int recipientChannelID, int width, int height, int pixelWidth, int pixelHeight) { this.recipientChannelID = recipientChannelID; - this.wantReply = wantReply; this.width = width; this.height = height; + this.pixelWidth = pixelWidth; + this.pixelHeight = pixelHeight; } public byte[] getPayload() @@ -23,11 +25,11 @@ public class PacketSessionPtyResize { tw.writeByte(Packets.SSH_MSG_CHANNEL_REQUEST); tw.writeUINT32(recipientChannelID); tw.writeString("window-change"); - tw.writeBoolean(wantReply); + tw.writeBoolean(false); tw.writeUINT32(width); tw.writeUINT32(height); - tw.writeUINT32(0); - tw.writeUINT32(0); + tw.writeUINT32(pixelWidth); + tw.writeUINT32(pixelHeight); payload = tw.getBytes(); } diff --git a/src/org/connectbot/service/TerminalBridge.java b/src/org/connectbot/service/TerminalBridge.java index 5e7c2dc..3c7d4d3 100644 --- a/src/org/connectbot/service/TerminalBridge.java +++ b/src/org/connectbot/service/TerminalBridge.java @@ -1154,7 +1154,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal buffer.setCursorPosition(buffer.getCursorColumn(), prevRow); if(session != null) - session.resizePTY(termWidth, termHeight); + session.resizePTY(termWidth, termHeight, width, height); } catch(Exception e) { Log.e(TAG, "Problem while trying to resize screen or PTY", e); } |