Add mouse input mode tracking in the agent.

This commit is contained in:
Ryan Prichard 2015-12-14 19:08:02 -06:00
parent 05a01ab4b5
commit c857ae1dea
2 changed files with 18 additions and 0 deletions

View File

@ -160,6 +160,7 @@ Agent::Agent(LPCWSTR controlPipeName,
SetConsoleCtrlHandler(NULL, FALSE);
SetConsoleCtrlHandler(consoleCtrlHandler, TRUE);
updateMouseInputFlag(true);
setPollInterval(25);
}
@ -360,8 +361,23 @@ void Agent::pollDataSocket()
}
}
void Agent::updateMouseInputFlag(bool forceTrace)
{
DWORD mode = 0;
GetConsoleMode(m_console->conin(), &mode);
bool newFlag = mode & ENABLE_MOUSE_INPUT;
if (forceTrace || newFlag != m_consoleMouseInputFlag) {
trace("CONIN mode ENABLE_MOUSE_INPUT: %s",
newFlag ? "enabled" : "disabled");
}
m_consoleMouseInputFlag = newFlag;
}
void Agent::onPollTimeout()
{
// Check the mouse input flag so we can output a trace message.
updateMouseInputFlag();
// Give the ConsoleInput object a chance to flush input from an incomplete
// escape sequence (e.g. pressing ESC).
m_consoleInput->flushIncompleteEscapeCode();

View File

@ -69,6 +69,7 @@ private:
int handleStartProcessPacket(ReadBuffer &packet);
int handleSetSizePacket(ReadBuffer &packet);
void pollDataSocket();
void updateMouseInputFlag(bool forceTrace=false);
protected:
virtual void onPollTimeout();
@ -94,6 +95,7 @@ private:
private:
bool m_useMark;
Win32Console *m_console;
bool m_consoleMouseInputFlag;
NamedPipe *m_controlSocket;
NamedPipe *m_dataSocket;
bool m_closingDataSocket;