git-svn-id: svn://db.shs.com.ru/pip@253 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2016-09-02 16:28:00 +00:00
parent 7e3d8ec427
commit f5e90f7a0f
6 changed files with 28 additions and 5 deletions

View File

@@ -65,6 +65,15 @@ private:
};
int main (int argc, char * argv[]) {
int in[8], out[8];
memset(in, 0, 4*8);
memset(out, 0, 4*8);
for (int i = 0; i <= 0xF; ++i) {
for (int b = 0; b < 4; ++b) out[b] = (i >> b) & 1;
for (int b = 0; b < 4; ++b) PICout(0) << " " << out[b];
PICout(0) << PICoutManipulators::NewLine;
}
return 0;
PIScreen screen;
PITerminal term;
TileTerminal tt(&term);

View File

@@ -94,6 +94,7 @@ void readConsole(int x, int y, int w, int h) {
bs.X = w;
bs.Y = h;
bc.X = bc.Y = 0;
memset(chars, 0, w * h * sizeof(CHAR_INFO));
ReadConsoleOutput(console, chars, bs, bc, &(sbi.srWindow));
for (int i = 0; i < h; ++i)
for (int j = 0; j < w; ++j)
@@ -115,8 +116,11 @@ void resizeConsole(int w, int h) {
con_w = w;
con_h = h;
GetConsoleScreenBufferInfo(console, &sbi);
sbi.srWindow.Left = 0;
sbi.srWindow.Right = sbi.srWindow.Left + w - 1;
sbi.srWindow.Bottom = sbi.srWindow.Top + h - 1;
COORD sz; sz.X = w; sz.Y = h;
SetConsoleScreenBufferSize(console, sz);
SetConsoleWindowInfo(console, TRUE, &(sbi.srWindow));
//system(("mode CON: COLS=" + PIString::fromNumber(w) + " LINES=" + PIString::fromNumber(h)).dataAscii());
resizeCells(w, h);

View File

@@ -347,7 +347,7 @@ void PITerminal::destroy() {
waitForFinish(1000);
#ifdef WINDOWS
if (PRIVATE->pi.hProcess) {
piCout << "term";
//piCout << "term";
//TerminateProcess(PRIVATE->pi.hProcess, 0);
GenerateConsoleCtrlEvent(CTRL_C_EVENT, PRIVATE->pi.dwProcessId);
CloseHandle(PRIVATE->pi.hProcess);

View File

@@ -46,7 +46,9 @@ PIPeer::PeerData::PeerData(const PIString & n): PIObject(n) {
PIPeer::PeerData::~PeerData() {
dt_in.stop();
dt_out.stop();
t.stop(true);
t.stop();
if (!t.waitForFinish(1000))
t.terminate();
}

View File

@@ -29,17 +29,18 @@ Daemon::Remote::~Remote() {
void Daemon::Remote::shellOpen() {
if (term) return;
piCoutObj << "shell open";
term = new PITerminal();
term->initialize();
term_timer.start(40);
term_timer.start(50);
}
void Daemon::Remote::shellClose() {
if (!term) return;
//piCoutObj << "shellClose ...";
piCoutObj << "shell close";
term_timer.stop();
term_timer.waitForFinish(100);
term_timer.waitForFinish(1000);
term->destroy();
delete term;
term = 0;
@@ -62,8 +63,11 @@ void Daemon::Remote::shellKeySend(PIKbdListener::KeyEvent k) {
void Daemon::Remote::termTimerTick() {
if (!term) return;
PIVector<PIVector<PIScreenTypes::Cell> > cells = term->content();
if (pcells == cells) return;
pcells = cells;
PIByteArray ba;
ba << int(ShellContent) << cells;
//piCout << ba.size_s() << pcells.back().back().symbol.unicode16Code() << cells.back().back().symbol.unicode16Code();
sendRequest(name(), ba);
}
@@ -595,6 +599,7 @@ void Daemon::connectToDaemon(const PIString & dn) {
void Daemon::disconnect() {
screen->enableExitCapture(PIKbdListener::F10);
conn_name.clear();
mode = rmNone;
showMainList();
@@ -821,6 +826,7 @@ void Daemon::sendDirToRemote(Remote * r) {
void Daemon::requestOpenShell() {
Remote * r = remotes.value(conn_name, 0);
if (!r) return;
screen->disableExitCapture();
PIByteArray ba;
ba << int(ShellOpen);
send(conn_name, ba);
@@ -830,6 +836,7 @@ void Daemon::requestOpenShell() {
void Daemon::requestCloseShell() {
Remote * r = remotes.value(conn_name, 0);
if (!r) return;
screen->enableExitCapture(PIKbdListener::F10);
PIByteArray ba;
ba << int(ShellClose);
send(conn_name, ba);

View File

@@ -123,6 +123,7 @@ private:
PIDir dir_my;
PIVector<PIFile::FileInfo> my_filelist;
PIVector<PIVector<PIScreenTypes::Cell> > pcells;
PIFileTransfer ft;
PIStringList _fl;
PacketType action;