1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-28 11:25:35 +02:00

[170814] avoid excessive sending of resize packets

This commit is contained in:
Martin Oberhuber 2007-01-17 18:51:18 +00:00
parent 8f52495e85
commit 9e62becd1e
6 changed files with 24 additions and 9 deletions

View file

@ -3,7 +3,7 @@
id="org.eclipse.tm.terminal" id="org.eclipse.tm.terminal"
label="%featureName" label="%featureName"
provider-name="%providerName" provider-name="%providerName"
version="0.9.1.qualifier"> version="0.9.2.qualifier">
<description> <description>
%description %description

View file

@ -3,7 +3,7 @@
id="org.eclipse.tm.terminal.ssh" id="org.eclipse.tm.terminal.ssh"
label="%featureName" label="%featureName"
provider-name="%providerName" provider-name="%providerName"
version="0.9.0.qualifier"> version="0.9.1.qualifier">
<description> <description>
%description %description

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.tm.terminal.ssh;singleton:=true Bundle-SymbolicName: org.eclipse.tm.terminal.ssh;singleton:=true
Bundle-Version: 0.9.0.qualifier Bundle-Version: 0.9.1.qualifier
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-Localization: plugin Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui, Require-Bundle: org.eclipse.ui,

View file

@ -32,6 +32,8 @@ public class SshConnector implements ITerminalConnector {
private ChannelShell fChannel; private ChannelShell fChannel;
private SshConnection fConnection; private SshConnection fConnection;
private final SshSettings fSettings; private final SshSettings fSettings;
private int fWidth;
private int fHeight;
public SshConnector() { public SshConnector() {
this(new SshSettings()); this(new SshSettings());
try { try {
@ -80,9 +82,12 @@ public class SshConnector implements ITerminalConnector {
return false; return false;
} }
public void setTerminalSize(int newWidth, int newHeight) { public void setTerminalSize(int newWidth, int newHeight) {
if(fChannel!=null) if(fChannel!=null && (newWidth!=fWidth || newHeight!=fHeight)) {
fChannel.setPtySize(newWidth, newHeight, 8, 8); //avoid excessive communications due to change size requests by caching previous size
fChannel.setPtySize(newWidth, newHeight, 8*newWidth, 8*newHeight);
fWidth=newWidth;
fHeight=newHeight;
}
} }
public InputStream getInputStream() { public InputStream getInputStream() {
return fInputStream; return fInputStream;
@ -128,5 +133,7 @@ public class SshConnector implements ITerminalConnector {
} }
void setChannel(ChannelShell channel) { void setChannel(ChannelShell channel) {
fChannel = channel; fChannel = channel;
fWidth=-1;
fHeight=-1;
} }
} }

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.tm.terminal; singleton:=true Bundle-SymbolicName: org.eclipse.tm.terminal; singleton:=true
Bundle-Version: 0.9.1.qualifier Bundle-Version: 0.9.2.qualifier
Bundle-Activator: org.eclipse.tm.terminal.internal.control.TerminalPlugin Bundle-Activator: org.eclipse.tm.terminal.internal.control.TerminalPlugin
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-Localization: plugin Bundle-Localization: plugin

View file

@ -35,6 +35,9 @@ public class TelnetConnector implements ITerminalConnector {
private ITerminalControl fControl; private ITerminalControl fControl;
private TelnetConnection fTelnetConnection; private TelnetConnection fTelnetConnection;
private final TelnetSettings fSettings; private final TelnetSettings fSettings;
private int fWidth = -1;
private int fHeight = -1;
public TelnetConnector() { public TelnetConnector() {
this(new TelnetSettings()); this(new TelnetSettings());
} }
@ -47,6 +50,8 @@ public class TelnetConnector implements ITerminalConnector {
public void connect(ITerminalControl control) { public void connect(ITerminalControl control) {
Logger.log("entered."); //$NON-NLS-1$ Logger.log("entered."); //$NON-NLS-1$
fControl=control; fControl=control;
fWidth=-1;
fHeight=-1;
TelnetConnectWorker worker = new TelnetConnectWorker(this,control); TelnetConnectWorker worker = new TelnetConnectWorker(this,control);
worker.start(); worker.start();
} }
@ -85,9 +90,12 @@ public class TelnetConnector implements ITerminalConnector {
return fTelnetConnection.localEcho(); return fTelnetConnection.localEcho();
} }
public void setTerminalSize(int newWidth, int newHeight) { public void setTerminalSize(int newWidth, int newHeight) {
if(fTelnetConnection!=null) if(fTelnetConnection!=null && (newWidth!=fWidth || newHeight!=fHeight)) {
//avoid excessive communications due to change size requests by caching previous size
fTelnetConnection.setTerminalSize(newWidth, newHeight); fTelnetConnection.setTerminalSize(newWidth, newHeight);
fWidth=newWidth;
fHeight=newHeight;
}
} }
public InputStream getInputStream() { public InputStream getInputStream() {
return fInputStream; return fInputStream;