From b3ccb800d7ff504df27dd033ad7a7914730ebe9c Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Thu, 2 Jun 2016 22:31:20 +0200 Subject: [PATCH] Do not configure console listener when no SSH connection --- src/Application/Application.cpp | 15 ++++++++++----- src/Application/Application.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index 75ab91e..b72ba3a 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -18,6 +18,13 @@ Application::Application(){ ofAddListener(Gui::instance()->jointPressedEvent, this, &Application::onJointPressed); ofAddListener(Gui::instance()->surfacePressedEvent, this, &Application::onSurfacePressed); ofAddListener(Gui::instance()->backgroundPressedEvent, this, &Application::onBackgroundPressed); + + string SSHConnection = ofSystem("if [ -z $SSH_CONNECTION ]; then echo no; else echo yes; fi"); + if(SSHConnection == "yes"){ + _isSSHConnection = true; + }else{ + _isSSHConnection = false; + } } void Application::setup(){ @@ -28,7 +35,9 @@ void Application::setup(){ } } - consoleListener.setup(this); + if(_isSSHConnection){ + consoleListener.setup(this); + } } ApplicationBaseState * Application::getState(){ @@ -143,10 +152,6 @@ bool Application::isShiftKeyDown(){ } void Application::onCharacterReceived(KeyListenerEventData & e){ - return; - - // TODO: Check if the same char is not comming through regular key event - ofKeyEventArgs args; args.key = (int)e.character; diff --git a/src/Application/Application.h b/src/Application/Application.h index b2ef8c6..7d74aba 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -79,6 +79,7 @@ class Application : public KeyListener { Info _info; bool _shiftKeyDown; + bool _isSSHConnection; };