diff --git a/main.cpp b/main.cpp index 6e7d03f5..7d41537e 100644 --- a/main.cpp +++ b/main.cpp @@ -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); diff --git a/src/auxiliary/piterminal/main.cpp b/src/auxiliary/piterminal/main.cpp index 2459086a..7a5a2f35 100644 --- a/src/auxiliary/piterminal/main.cpp +++ b/src/auxiliary/piterminal/main.cpp @@ -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); diff --git a/src/console/piterminal.cpp b/src/console/piterminal.cpp index 4d74afd6..68461375 100644 --- a/src/console/piterminal.cpp +++ b/src/console/piterminal.cpp @@ -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); diff --git a/src/io/pipeer.cpp b/src/io/pipeer.cpp index 13fefb0d..29e54de8 100755 --- a/src/io/pipeer.cpp +++ b/src/io/pipeer.cpp @@ -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(); } diff --git a/utils/system_daemon/daemon.cpp b/utils/system_daemon/daemon.cpp index 4738d0f2..79d07f17 100644 --- a/utils/system_daemon/daemon.cpp +++ b/utils/system_daemon/daemon.cpp @@ -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 > 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); diff --git a/utils/system_daemon/daemon.h b/utils/system_daemon/daemon.h index 41eb33bf..19265e71 100644 --- a/utils/system_daemon/daemon.h +++ b/utils/system_daemon/daemon.h @@ -123,6 +123,7 @@ private: PIDir dir_my; PIVector my_filelist; + PIVector > pcells; PIFileTransfer ft; PIStringList _fl; PacketType action;