Skip to content

Commit

Permalink
Remove disconnected-overlay window and ncurses dep
Browse files Browse the repository at this point in the history
This can't work without etclient being a full-screen curses application,
which would be a major architectural change.
  • Loading branch information
cgull authored and MisterTea committed Mar 29, 2017
1 parent 0c60a8f commit 118210c
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 201 deletions.
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ find_package(Threads REQUIRED)
find_package(Glog REQUIRED)
find_package(GFlags REQUIRED)
find_package(Protobuf REQUIRED)
set(CURSES_NEED_NCURSES TRUE)
find_package(Curses REQUIRED)
find_package(Sodium REQUIRED)

PROTOBUF_GENERATE_CPP(
Expand Down Expand Up @@ -93,7 +91,6 @@ add_library(
STATIC

terminal/ConsoleUtils.cpp
terminal/NCursesOverlay.cpp
terminal/SocketUtils.cpp

${ETERMINAL_SRCS} ${ETERMINAL_HDRS}
Expand Down Expand Up @@ -123,7 +120,6 @@ target_link_libraries (
LINK_PUBLIC
TerminalCommon
EternalTCP-static
${CURSES_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${PROTOBUF_LIBRARIES}
${GLOG_LIBRARIES}
Expand Down Expand Up @@ -178,7 +174,7 @@ if(BUILD_PACKAGE)
# RPM-specific
set(CPACK_RPM_PACKAGE_NAME "et")
set(CPACK_RPM_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
set(CPACK_RPM_PACKAGE_REQUIRES "boost, ncurses, libsodium, protobuf, gflags, glog")
set(CPACK_RPM_PACKAGE_REQUIRES "boost, libsodium, protobuf, gflags, glog")

#To build and verify
#cpack && lintian -c EternalTCP-#.#.#-Linux.deb
Expand Down
2 changes: 0 additions & 2 deletions sandbox/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ set (SANDBOX_SRC
TestFakeSocketHandler.cpp
TestConnection.cpp
TestFlakyConnection.cpp
TestNCurses.cpp
)
# Add test executable target
foreach(SRC_LINE ${SANDBOX_SRC})
Expand All @@ -21,7 +20,6 @@ foreach(SRC_LINE ${SANDBOX_SRC})
LINK_PUBLIC
TerminalCommon
${PROJECT_NAME}-static
${CURSES_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${PROTOBUF_LIBRARIES}
${GLOG_LIBRARIES}
Expand Down
31 changes: 0 additions & 31 deletions sandbox/TestNCurses.cpp

This file was deleted.

66 changes: 0 additions & 66 deletions terminal/NCursesOverlay.cpp

This file was deleted.

55 changes: 0 additions & 55 deletions terminal/NCursesOverlay.hpp

This file was deleted.

43 changes: 1 addition & 42 deletions terminal/TerminalClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "CryptoHandler.hpp"
#include "FlakyFakeSocketHandler.hpp"
#include "Headers.hpp"
#include "NCursesOverlay.hpp"
#include "ServerConnection.hpp"
#include "SocketUtils.hpp"
#include "UnixSocketHandler.hpp"
Expand Down Expand Up @@ -128,38 +127,7 @@ int main(int argc, char** argv) {
time_t keepaliveTime = time(NULL) + 5;
bool waitingOnKeepalive = false;

unique_ptr<NCursesOverlay> disconnectedOverlay;
#if 0
string offlineBuffer;
#endif
while (run) {
#if 0 // This doesn't work with tmux and when combined with a curses
// app on the server side causes weird graphical glitches.

// TODO: Figure out why this causes issues.
if (disconnectedOverlay.get()==NULL && globalClient->isDisconnected()) {
disconnectedOverlay.reset(new NCursesOverlay());
shared_ptr<NCursesWindow> popupWindow;
{
TerminalInfo terminfo;
terminfo.set_id("popup");
terminfo.set_height(7);
terminfo.set_width(41);
terminfo.set_row(disconnectedOverlay->rows()/2 - 3);
terminfo.set_column(disconnectedOverlay->cols()/2 - 20);

popupWindow = disconnectedOverlay->createWindow(terminfo, true);
popupWindow->drawTextCentered(FLAGS_host, 1);
popupWindow->drawTextCentered("Connection lost.", 3);
popupWindow->drawTextCentered("Please wait...", 5);
}
disconnectedOverlay->refresh();
}
if (disconnectedOverlay.get() && !globalClient->isDisconnected()) {
disconnectedOverlay.reset(NULL);
FATAL_FAIL(writeAll(STDOUT_FILENO, &offlineBuffer[0], offlineBuffer.length()));
}
#endif
// Data structures needed for select() and
// non-blocking I/O.
fd_set rfd;
Expand Down Expand Up @@ -221,15 +189,7 @@ int main(int argc, char** argv) {
// VLOG(1) << "Got byte: " << int(b) << " " << char(b) << " " <<
// globalClient->getReader()->getSequenceNumber();
keepaliveTime = time(NULL) + 1;
#if 0
if (disconnectedOverlay.get()) {
offlineBuffer += s;
} else {
#endif
FATAL_FAIL(writeAll(STDOUT_FILENO, &s[0], s.length()));
#if 0
}
#endif
FATAL_FAIL(writeAll(STDOUT_FILENO, &s[0], s.length()));
break;
}
case et::PacketType::KEEP_ALIVE:
Expand Down Expand Up @@ -280,7 +240,6 @@ int main(int argc, char** argv) {
}
}

disconnectedOverlay.release();
tcsetattr(0, TCSANOW, &terminal_backup);
globalClient.reset();
client.reset();
Expand Down

0 comments on commit 118210c

Please sign in to comment.