fixes, mainly for windows. first, had to add a notification from
CServer to the primary screen when the configuration changes so it can make necessary adjustments (the win32 primary screen must tell the hook dll about the new jump zones). changed includes of some std c++ library files to go through our own include files. these wrap the include with stuff to keep vc++ quiet when compiling at warning level 4, which is what it does now. it also works around missing <istream> and <ostream> on g++2.96. added missing std:: where necessary. g++ doesn't really support namespaces so it lets references without the namespace slip through. added workaround or fix. not sure if istringstream::str(string) should reset eofbit. it does on g++ but does not on vc++. added clear() after str() so it works either way. added low-level keyboard hook to win32. if available (it's only available on NT SP3 and up) it allows us to catch and handle alt+tab, alt+esc, ctrl+esc, and windows key hot keys. i think that leaves only ctrl+alt+del and accessibility functions uncaught on those systems.
This commit is contained in:
parent
1ac62a9533
commit
d2135af0d9
|
@ -21,6 +21,11 @@ static const char* g_priority[] = {
|
|||
};
|
||||
static const int g_numPriority = (int)(sizeof(g_priority) /
|
||||
sizeof(g_priority[0]));
|
||||
#if defined(NDEBUG)
|
||||
static const int g_defaultMaxPriority = 4;
|
||||
#else
|
||||
static const int g_defaultMaxPriority = 5;
|
||||
#endif
|
||||
static const int g_maxPriorityLength = 7; // length of longest string
|
||||
static const int g_prioritySuffixLength = 2;
|
||||
static const int g_priorityPad = g_maxPriorityLength +
|
||||
|
@ -145,11 +150,7 @@ int CLog::getMaxPriority()
|
|||
CHoldLock lock(s_lock);
|
||||
|
||||
if (s_maxPriority == -1) {
|
||||
#if defined(NDEBUG)
|
||||
s_maxPriority = 4;
|
||||
#else
|
||||
s_maxPriority = 5;
|
||||
#endif
|
||||
s_maxPriority = g_defaultMaxPriority;
|
||||
const char* priEnv = getenv("SYN_LOG_PRI");
|
||||
if (priEnv != NULL) {
|
||||
for (int i = 0; i < g_numPriority; ++i) {
|
||||
|
|
|
@ -37,11 +37,11 @@ public:
|
|||
private:
|
||||
class CHoldLock {
|
||||
public:
|
||||
CHoldLock(CLog::Lock lock) : m_lock(lock) { m_lock(true); }
|
||||
CHoldLock(Lock lock) : m_lock(lock) { m_lock(true); }
|
||||
~CHoldLock() { m_lock(false); }
|
||||
|
||||
private:
|
||||
CLog::Lock m_lock;
|
||||
Lock m_lock;
|
||||
};
|
||||
|
||||
static void dummyLock(bool);
|
||||
|
|
|
@ -2,7 +2,14 @@
|
|||
#define CSTRING_H
|
||||
|
||||
#include "common.h"
|
||||
#include "stdpre.h"
|
||||
#include <string>
|
||||
#include "stdpost.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push, 4)
|
||||
#pragma warning(disable: 4097) // typedef-name used as synonym
|
||||
#endif
|
||||
|
||||
#ifndef CSTRING_DEF_CTOR
|
||||
#define CSTRING_ALLOC1
|
||||
|
@ -37,5 +44,9 @@ public:
|
|||
_Myt(_f, _l CSTRING_ALLOC2) { }
|
||||
};
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
#define XBASE_H
|
||||
|
||||
#include "CString.h"
|
||||
#include "stdpre.h"
|
||||
#include <exception>
|
||||
#include "stdpost.h"
|
||||
|
||||
class XBase : public std::exception {
|
||||
public:
|
||||
|
|
|
@ -41,7 +41,7 @@ RSC=rc.exe
|
|||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
|
||||
# ADD CPP /nologo /MT /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
|
@ -65,7 +65,7 @@ LIB32=link.exe -lib
|
|||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
|
@ -139,6 +139,46 @@ SOURCE=.\IJob.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\stdfstream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\stdistream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\stdlist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\stdmap.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\stdostream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\stdpost.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\stdpre.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\stdset.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\stdsstream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\stdvector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TMethodJob.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -25,17 +25,8 @@
|
|||
|
||||
// turn off bonehead warnings
|
||||
#pragma warning(disable: 4786) // identifier truncated in debug info
|
||||
#pragma warning(disable: 4514) // unreferenced inline function removed
|
||||
|
||||
//
|
||||
// ignore warnings inside microsoft's standard C++ library
|
||||
//
|
||||
// bonehead bugs/warnings
|
||||
#pragma warning(disable: 4097) // typedef-name used as synonym
|
||||
#pragma warning(disable: 4511) // copy constructor can't be generated
|
||||
#pragma warning(disable: 4512) // assignment operator can't be generated
|
||||
|
||||
// we'd really rather have these enabled to check our code
|
||||
#pragma warning(disable: 4100) // unreferenced formal parameter
|
||||
#endif // (_MSC_VER >= 1200)
|
||||
|
||||
#else
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
#include "stdpre.h"
|
||||
#include <fstream>
|
||||
#include "stdpost.h"
|
||||
#include "stdistream.h"
|
|
@ -0,0 +1,28 @@
|
|||
#include "stdpre.h"
|
||||
#if !defined(CONFIG_PLATFORM_LINUX)
|
||||
#include <istream>
|
||||
#else
|
||||
#include <iostream>
|
||||
#endif
|
||||
#include "stdpost.h"
|
||||
|
||||
#if defined(CONFIG_PLATFORM_WIN32) && defined(_MSC_VER)
|
||||
inline
|
||||
std::istream& operator>>(std::istream& s, SInt8& i)
|
||||
{ return s >> (signed char&)i; }
|
||||
inline
|
||||
std::istream& operator>>(std::istream& s, SInt16& i)
|
||||
{ return s >> (short&)i; }
|
||||
inline
|
||||
std::istream& operator>>(std::istream& s, SInt32& i)
|
||||
{ return s >> (int&)i; }
|
||||
inline
|
||||
std::istream& operator>>(std::istream& s, UInt8& i)
|
||||
{ return s >> (unsigned char&)i; }
|
||||
inline
|
||||
std::istream& operator>>(std::istream& s, UInt16& i)
|
||||
{ return s >> (unsigned short&)i; }
|
||||
inline
|
||||
std::istream& operator>>(std::istream& s, UInt32& i)
|
||||
{ return s >> (unsigned int&)i; }
|
||||
#endif
|
|
@ -0,0 +1,3 @@
|
|||
#include "stdpre.h"
|
||||
#include <list>
|
||||
#include "stdpost.h"
|
|
@ -0,0 +1,3 @@
|
|||
#include "stdpre.h"
|
||||
#include <map>
|
||||
#include "stdpost.h"
|
|
@ -0,0 +1,7 @@
|
|||
#include "stdpre.h"
|
||||
#if !defined(CONFIG_PLATFORM_LINUX)
|
||||
#include <ostream>
|
||||
#else
|
||||
#include <iostream>
|
||||
#endif
|
||||
#include "stdpost.h"
|
|
@ -0,0 +1,3 @@
|
|||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
|
@ -0,0 +1,11 @@
|
|||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4786) // identifier truncated
|
||||
#pragma warning(disable: 4514) // unreferenced inline
|
||||
#pragma warning(disable: 4710) // not inlined
|
||||
#pragma warning(disable: 4663) // C++ change, template specialization
|
||||
#pragma warning(push, 3)
|
||||
#pragma warning(disable: 4018) // signed/unsigned mismatch
|
||||
#pragma warning(disable: 4284)
|
||||
#pragma warning(disable: 4146) // unary minus on unsigned value
|
||||
#pragma warning(disable: 4127) // conditional expression is constant
|
||||
#endif
|
|
@ -0,0 +1,3 @@
|
|||
#include "stdpre.h"
|
||||
#include <set>
|
||||
#include "stdpost.h"
|
|
@ -0,0 +1,4 @@
|
|||
#include "stdpre.h"
|
||||
#include <sstream>
|
||||
#include "stdpost.h"
|
||||
#include "stdistream.h"
|
|
@ -0,0 +1,3 @@
|
|||
#include "stdpre.h"
|
||||
#include <vector>
|
||||
#include "stdpost.h"
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
#include "CMSWindowsScreen.h"
|
||||
#include "ISecondaryScreen.h"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "stdmap.h"
|
||||
#include "stdvector.h"
|
||||
|
||||
class CMSWindowsSecondaryScreen : public CMSWindowsScreen, public ISecondaryScreen {
|
||||
public:
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
#include "CXWindowsScreen.h"
|
||||
#include "ISecondaryScreen.h"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "stdmap.h"
|
||||
#include "stdvector.h"
|
||||
|
||||
class CXWindowsSecondaryScreen : public CXWindowsScreen, public ISecondaryScreen {
|
||||
public:
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "CNetwork.h"
|
||||
#include "CNetworkAddress.h"
|
||||
#include "CThread.h"
|
||||
#include <assert.h>
|
||||
|
||||
//
|
||||
// logging thread safety
|
||||
|
|
|
@ -42,7 +42,7 @@ RSC=rc.exe
|
|||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\base" /I "..\io" /I "..\mt" /I "..\net" /I "..\synergy" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
|
||||
# ADD CPP /nologo /MT /W4 /GX /O2 /I "..\base" /I "..\io" /I "..\mt" /I "..\net" /I "..\synergy" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
|
@ -68,7 +68,7 @@ LINK32=link.exe
|
|||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\base" /I "..\io" /I "..\mt" /I "..\net" /I "..\synergy" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "..\base" /I "..\io" /I "..\mt" /I "..\net" /I "..\synergy" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
#include "XHTTP.h"
|
||||
#include "IInputStream.h"
|
||||
#include "IOutputStream.h"
|
||||
#include "stdsstream.h"
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <locale.h>
|
||||
#include <time.h>
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
//
|
||||
// CHTTPUtil::CaselessCmp
|
||||
|
@ -88,6 +89,7 @@ CHTTPRequest* CHTTPProtocol::readRequest(IInputStream* stream)
|
|||
// parse version
|
||||
char dot;
|
||||
s.str(version);
|
||||
s.clear();
|
||||
s.ignore(5);
|
||||
s >> request->m_majorVersion;
|
||||
s.get(dot);
|
||||
|
@ -229,7 +231,7 @@ void CHTTPProtocol::reply(
|
|||
}
|
||||
|
||||
// write reply header
|
||||
ostringstream s;
|
||||
std::ostringstream s;
|
||||
s << "HTTP/" << reply.m_majorVersion << "." <<
|
||||
reply.m_minorVersion << " " <<
|
||||
reply.m_status << " " <<
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
#include "BasicTypes.h"
|
||||
#include "CString.h"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "stdmap.h"
|
||||
#include "stdvector.h"
|
||||
|
||||
class IInputStream;
|
||||
class IOutputStream;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "XHTTP.h"
|
||||
#include "CHTTPProtocol.h"
|
||||
#include <stdio.h>
|
||||
#include "stdsstream.h"
|
||||
|
||||
//
|
||||
// XHTTP
|
||||
|
@ -45,16 +45,15 @@ void XHTTP::addHeaders(CHTTPReply&) const
|
|||
CString XHTTP::getWhat() const throw()
|
||||
{
|
||||
try {
|
||||
char code[20];
|
||||
sprintf(code, "%d ", m_status);
|
||||
CString msg(code);
|
||||
std::ostringstream s;
|
||||
s << m_status << " ";
|
||||
if (!m_reason.empty()) {
|
||||
msg += m_reason;
|
||||
s << m_reason.c_str();
|
||||
}
|
||||
else {
|
||||
msg += getReason(m_status);
|
||||
s << getReason(m_status);
|
||||
}
|
||||
return msg;
|
||||
return s.str();
|
||||
}
|
||||
catch (...) {
|
||||
return CString();
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
# Microsoft Developer Studio Project File - Name="http" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=http - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "http.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "http.mak" CFG="http - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "http - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "http - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName "millpond"
|
||||
# PROP Scc_LocalPath "."
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "http - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W4 /GX /O2 /I "..\base" /I "..\io" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "http - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "..\base" /I "..\io" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "http - Win32 Release"
|
||||
# Name "http - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CHTTPProtocol.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\XHTTP.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CHTTPProtocol.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\XHTTP.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
|
@ -2,8 +2,8 @@
|
|||
#define CSTREAMBUFFER_H
|
||||
|
||||
#include "BasicTypes.h"
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include "stdlist.h"
|
||||
#include "stdvector.h"
|
||||
|
||||
class CStreamBuffer {
|
||||
public:
|
||||
|
|
|
@ -41,7 +41,7 @@ RSC=rc.exe
|
|||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\base" /I "..\mt" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
|
||||
# ADD CPP /nologo /MT /W4 /GX /O2 /I "..\base" /I "..\mt" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
|
@ -65,7 +65,7 @@ LIB32=link.exe -lib
|
|||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\base" /I "..\mt" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "..\base" /I "..\mt" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
|
|
|
@ -41,7 +41,7 @@ RSC=rc.exe
|
|||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\base" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
|
||||
# ADD CPP /nologo /MT /W4 /GX /O2 /I "..\base" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
|
@ -65,7 +65,7 @@ LIB32=link.exe -lib
|
|||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\base" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "..\base" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
|
|
|
@ -41,7 +41,7 @@ RSC=rc.exe
|
|||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\base" /I "..\io" /I "..\mt" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
|
||||
# ADD CPP /nologo /MT /W4 /GX /O2 /I "..\base" /I "..\io" /I "..\mt" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
|
@ -65,7 +65,7 @@ LIB32=link.exe -lib
|
|||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\base" /I "..\io" /I "..\mt" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "..\base" /I "..\io" /I "..\mt" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
#include "CConfig.h"
|
||||
#include "stdistream.h"
|
||||
#include "stdostream.h"
|
||||
#include <assert.h>
|
||||
// FIXME -- fix this with automake and config.h
|
||||
#if !defined(CONFIG_PLATFORM_LINUX)
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#else
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
//
|
||||
// CConfig
|
||||
|
@ -160,10 +155,10 @@ const char* CConfig::dirName(EDirection dir)
|
|||
return s_name[dir - kFirstDirection];
|
||||
}
|
||||
|
||||
bool CConfig::readLine(istream& s, CString& line)
|
||||
bool CConfig::readLine(std::istream& s, CString& line)
|
||||
{
|
||||
s >> std::ws;
|
||||
while (getline(s, line)) {
|
||||
while (std::getline(s, line)) {
|
||||
// strip comments and then trailing whitespace
|
||||
CString::size_type i = line.rfind('#');
|
||||
if (i != CString::npos) {
|
||||
|
@ -183,7 +178,7 @@ bool CConfig::readLine(istream& s, CString& line)
|
|||
return false;
|
||||
}
|
||||
|
||||
void CConfig::readSection(istream& s)
|
||||
void CConfig::readSection(std::istream& s)
|
||||
{
|
||||
static const char s_section[] = "section:";
|
||||
static const char s_screens[] = "screens";
|
||||
|
@ -223,7 +218,7 @@ void CConfig::readSection(istream& s)
|
|||
}
|
||||
}
|
||||
|
||||
void CConfig::readSectionScreens(istream& s)
|
||||
void CConfig::readSectionScreens(std::istream& s)
|
||||
{
|
||||
CString line;
|
||||
CString name;
|
||||
|
@ -256,7 +251,7 @@ void CConfig::readSectionScreens(istream& s)
|
|||
throw XConfigRead("unexpected end of screens section");
|
||||
}
|
||||
|
||||
void CConfig::readSectionLinks(istream& s)
|
||||
void CConfig::readSectionLinks(std::istream& s)
|
||||
{
|
||||
CString line;
|
||||
CString screen;
|
||||
|
@ -338,7 +333,7 @@ void CConfig::readSectionLinks(istream& s)
|
|||
// CConfig I/O
|
||||
//
|
||||
|
||||
istream& operator>>(istream& s, CConfig& config)
|
||||
std::istream& operator>>(std::istream& s, CConfig& config)
|
||||
{
|
||||
// FIXME -- should track line and column to improve error reporting
|
||||
|
||||
|
@ -350,44 +345,44 @@ istream& operator>>(istream& s, CConfig& config)
|
|||
return s;
|
||||
}
|
||||
|
||||
ostream& operator<<(ostream& s, const CConfig& config)
|
||||
std::ostream& operator<<(std::ostream& s, const CConfig& config)
|
||||
{
|
||||
// screens section
|
||||
s << "section: screens" << endl;
|
||||
s << "section: screens" << std::endl;
|
||||
for (CConfig::const_iterator screen = config.begin();
|
||||
screen != config.end(); ++screen) {
|
||||
s << "\t" << screen->c_str() << ":" << endl;
|
||||
s << "\t" << screen->c_str() << ":" << std::endl;
|
||||
}
|
||||
s << "end" << endl;
|
||||
s << "end" << std::endl;
|
||||
|
||||
// links section
|
||||
CString neighbor;
|
||||
s << "section: links" << endl;
|
||||
s << "section: links" << std::endl;
|
||||
for (CConfig::const_iterator screen = config.begin();
|
||||
screen != config.end(); ++screen) {
|
||||
s << "\t" << screen->c_str() << ":" << endl;
|
||||
s << "\t" << screen->c_str() << ":" << std::endl;
|
||||
|
||||
neighbor = config.getNeighbor(*screen, CConfig::kLeft);
|
||||
if (!neighbor.empty()) {
|
||||
s << "\t\tleft=" << neighbor.c_str() << endl;
|
||||
s << "\t\tleft=" << neighbor.c_str() << std::endl;
|
||||
}
|
||||
|
||||
neighbor = config.getNeighbor(*screen, CConfig::kRight);
|
||||
if (!neighbor.empty()) {
|
||||
s << "\t\tright=" << neighbor.c_str() << endl;
|
||||
s << "\t\tright=" << neighbor.c_str() << std::endl;
|
||||
}
|
||||
|
||||
neighbor = config.getNeighbor(*screen, CConfig::kTop);
|
||||
if (!neighbor.empty()) {
|
||||
s << "\t\tup=" << neighbor.c_str() << endl;
|
||||
s << "\t\tup=" << neighbor.c_str() << std::endl;
|
||||
}
|
||||
|
||||
neighbor = config.getNeighbor(*screen, CConfig::kBottom);
|
||||
if (!neighbor.empty()) {
|
||||
s << "\t\tdown=" << neighbor.c_str() << endl;
|
||||
s << "\t\tdown=" << neighbor.c_str() << std::endl;
|
||||
}
|
||||
}
|
||||
s << "end" << endl;
|
||||
s << "end" << std::endl;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "CString.h"
|
||||
#include "XBase.h"
|
||||
#include <iosfwd>
|
||||
#include <map>
|
||||
#include "stdmap.h"
|
||||
|
||||
class CConfig;
|
||||
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
CConfig::internal_const_iterator m_i;
|
||||
internal_const_iterator m_i;
|
||||
};
|
||||
|
||||
CConfig();
|
||||
|
@ -98,17 +98,17 @@ public:
|
|||
|
||||
// read/write a configuration. operator>> will throw XConfigRead
|
||||
// on error.
|
||||
friend istream& operator>>(istream&, CConfig&);
|
||||
friend ostream& operator<<(ostream&, const CConfig&);
|
||||
friend std::istream& operator>>(std::istream&, CConfig&);
|
||||
friend std::ostream& operator<<(std::ostream&, const CConfig&);
|
||||
|
||||
// get the name of a direction (for debugging)
|
||||
static const char* dirName(EDirection);
|
||||
|
||||
private:
|
||||
static bool readLine(istream&, CString&);
|
||||
void readSection(istream&);
|
||||
void readSectionScreens(istream&);
|
||||
void readSectionLinks(istream&);
|
||||
static bool readLine(std::istream&, CString&);
|
||||
void readSection(std::istream&);
|
||||
void readSectionScreens(std::istream&);
|
||||
void readSectionLinks(std::istream&);
|
||||
|
||||
private:
|
||||
CCellMap m_map;
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
#include "CLog.h"
|
||||
#include "XThread.h"
|
||||
#include "ISocket.h"
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include "stdset.h"
|
||||
#include "stdsstream.h"
|
||||
#include <assert.h>
|
||||
|
||||
//
|
||||
// CHTTPServer
|
||||
|
@ -158,7 +159,7 @@ void CHTTPServer::doProcessGetEditMap(
|
|||
static const char* s_editMapScreenEnd =
|
||||
"</td>\r\n";
|
||||
|
||||
ostringstream s;
|
||||
std::ostringstream s;
|
||||
|
||||
// convert screen map into a temporary screen map
|
||||
CScreenArray screens;
|
||||
|
@ -236,7 +237,7 @@ void CHTTPServer::doProcessPostEditMap(
|
|||
}
|
||||
|
||||
try {
|
||||
ostringstream s;
|
||||
std::ostringstream s;
|
||||
|
||||
// convert post data into a temporary screen map. also check
|
||||
// that no screen name is invalid or used more than once.
|
||||
|
@ -309,7 +310,7 @@ void CHTTPServer::doProcessPostEditMap(
|
|||
// now reply with current map
|
||||
doProcessGetEditMap(request, reply);
|
||||
}
|
||||
catch (XHTTP& e) {
|
||||
catch (XHTTP&) {
|
||||
// FIXME -- construct a more meaningful error?
|
||||
throw;
|
||||
}
|
||||
|
@ -318,7 +319,7 @@ void CHTTPServer::doProcessPostEditMap(
|
|||
bool CHTTPServer::parseXY(
|
||||
const CString& xy, SInt32& x, SInt32& y)
|
||||
{
|
||||
istringstream s(xy);
|
||||
std::istringstream s(xy);
|
||||
char delimiter;
|
||||
s >> x;
|
||||
s.get(delimiter);
|
||||
|
@ -326,65 +327,10 @@ bool CHTTPServer::parseXY(
|
|||
return (!!s && delimiter == 'x');
|
||||
}
|
||||
|
||||
/*
|
||||
#include <iostream> // FIXME
|
||||
// FIXME
|
||||
cout << "method: " << request.m_method << endl;
|
||||
cout << "uri: " << request.m_uri << endl;
|
||||
cout << "version: " << request.m_majorVersion << "." <<
|
||||
request.m_majorVersion << endl;
|
||||
|
||||
cout << "headers:" << endl;
|
||||
for (CHTTPRequest::CHeaderMap::const_iterator
|
||||
index = request.m_headerIndexByName.begin();
|
||||
index != request.m_headerIndexByName.end();
|
||||
++index) {
|
||||
assert(index->second < request.m_headers.size());
|
||||
cout << " " << index->first << ": " <<
|
||||
request.m_headers[index->second] << endl;
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
cout << request.m_body << endl;
|
||||
|
||||
// FIXME
|
||||
reply.m_majorVersion = request.m_majorVersion;
|
||||
reply.m_minorVersion = request.m_minorVersion;
|
||||
reply.m_status = 200;
|
||||
reply.m_reason = "OK";
|
||||
reply.m_method = request.m_method;
|
||||
reply.m_headers.push_back(std::make_pair(CString("Content-Type"),
|
||||
CString("text/html")));
|
||||
if (request.m_uri != "/bar") {
|
||||
reply.m_body =
|
||||
"<html>\r\n"
|
||||
" <head>\r\n"
|
||||
" <title>test</title>\r\n"
|
||||
" </head>\r\n"
|
||||
" <body>\r\n"
|
||||
" <h2>test</h2>\r\n"
|
||||
" <form method=POST action=\"bar\" enctype=\"multipart/form-data\">\r\n"
|
||||
" <input type=text name=a size=8 maxlength=40 value=\"aValue\">\r\n"
|
||||
" <input type=submit name=b value=\"blah\">\r\n"
|
||||
" </form>\r\n"
|
||||
" </body>\r\n"
|
||||
"</html>\r\n"
|
||||
;
|
||||
}
|
||||
else {
|
||||
reply.m_body =
|
||||
"<html>\r\n"
|
||||
" <head>\r\n"
|
||||
" <title>test reply</title>\r\n"
|
||||
" </head>\r\n"
|
||||
" <body>\r\n"
|
||||
" <h2>test reply</h2>\r\n"
|
||||
" </body>\r\n"
|
||||
"</html>\r\n"
|
||||
;
|
||||
}
|
||||
// FIXME
|
||||
*/
|
||||
//
|
||||
// CHTTPServer::CScreenArray
|
||||
//
|
||||
|
||||
CHTTPServer::CScreenArray::CScreenArray() : m_w(0), m_h(0)
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "BasicTypes.h"
|
||||
#include "CString.h"
|
||||
#include <vector>
|
||||
#include "stdvector.h"
|
||||
|
||||
class CServer;
|
||||
class CConfig;
|
||||
|
|
|
@ -22,7 +22,13 @@ CMSWindowsPrimaryScreen::CMSWindowsPrimaryScreen() :
|
|||
m_mark(0),
|
||||
m_markReceived(0)
|
||||
{
|
||||
// do nothing
|
||||
// detect operating system
|
||||
OSVERSIONINFO version;
|
||||
version.dwOSVersionInfoSize = sizeof(version);
|
||||
if (GetVersionEx(&version) == 0) {
|
||||
log((CLOG_WARN "cannot determine OS: %d", GetLastError()));
|
||||
}
|
||||
m_is95Family = (version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS);
|
||||
}
|
||||
|
||||
CMSWindowsPrimaryScreen::~CMSWindowsPrimaryScreen()
|
||||
|
@ -97,7 +103,19 @@ void CMSWindowsPrimaryScreen::doEnter()
|
|||
// not active anymore
|
||||
m_active = false;
|
||||
|
||||
// set the zones that should cause a jump
|
||||
// release keyboard/mouse and set the zones that should cause a jump
|
||||
/* FIXME
|
||||
if (UnregisterHotKey(m_window, 0x0001) != 0) {
|
||||
log((CLOG_INFO "released hot key"));
|
||||
}
|
||||
else {
|
||||
log((CLOG_INFO "failed to release hot key: %d", GetLastError()));
|
||||
}
|
||||
*/
|
||||
if (m_is95Family) {
|
||||
DWORD dummy = 0;
|
||||
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, FALSE, &dummy, 0);
|
||||
}
|
||||
SInt32 w, h;
|
||||
getScreenSize(&w, &h);
|
||||
SetZoneFunc setZone = (SetZoneFunc)GetProcAddress(
|
||||
|
@ -159,6 +177,19 @@ void CMSWindowsPrimaryScreen::leave()
|
|||
SetRelayFunc setRelay = (SetRelayFunc)GetProcAddress(
|
||||
m_hookLibrary, "setRelay");
|
||||
setRelay();
|
||||
if (m_is95Family) {
|
||||
// disable ctrl+alt+del, alt+tab, ctrl+esc
|
||||
DWORD dummy = 0;
|
||||
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &dummy, 0);
|
||||
}
|
||||
/* FIXME
|
||||
if (RegisterHotKey(m_window, 0x0001, MOD_ALT, VK_TAB) != 0) {
|
||||
log((CLOG_INFO "got hot key"));
|
||||
}
|
||||
else {
|
||||
log((CLOG_INFO "failed to get hot key: %d", GetLastError()));
|
||||
}
|
||||
*/
|
||||
|
||||
// get keyboard input and capture mouse
|
||||
SetActiveWindow(m_window);
|
||||
|
@ -203,6 +234,17 @@ void CMSWindowsPrimaryScreen::leave()
|
|||
}
|
||||
}
|
||||
|
||||
void CMSWindowsPrimaryScreen::onConfigure()
|
||||
{
|
||||
if (!m_active) {
|
||||
SInt32 w, h;
|
||||
getScreenSize(&w, &h);
|
||||
SetZoneFunc setZone = (SetZoneFunc)GetProcAddress(
|
||||
m_hookLibrary, "setZone");
|
||||
setZone(m_server->getActivePrimarySides(), w, h, getJumpZoneSize());
|
||||
}
|
||||
}
|
||||
|
||||
void CMSWindowsPrimaryScreen::warpCursor(SInt32 x, SInt32 y)
|
||||
{
|
||||
// set the cursor position without generating an event
|
||||
|
@ -479,7 +521,12 @@ LRESULT CMSWindowsPrimaryScreen::onEvent(
|
|||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg) {
|
||||
// FIXME -- handle display changes (and resize full-screen window)
|
||||
/*
|
||||
case WM_HOTKEY:
|
||||
log((CLOG_INFO "hot key: %d, %d, %s %s %s", wParam, HIWORD(lParam), (LOWORD(lParam) & MOD_ALT) ? "ALT" : "", (LOWORD(lParam) & MOD_CONTROL) ? "CTRL" : "", (LOWORD(lParam) & MOD_SHIFT) ? "SHIFT" : "", (LOWORD(lParam) & MOD_WIN) ? "WIN" : ""));
|
||||
return 0;
|
||||
*/
|
||||
|
||||
case WM_PAINT:
|
||||
ValidateRect(hwnd, NULL);
|
||||
return 0;
|
||||
|
|
|
@ -20,6 +20,7 @@ public:
|
|||
virtual void close();
|
||||
virtual void enter(SInt32 xAbsolute, SInt32 yAbsolute);
|
||||
virtual void leave();
|
||||
virtual void onConfigure();
|
||||
virtual void warpCursor(SInt32 xAbsolute, SInt32 yAbsolute);
|
||||
virtual void setClipboard(ClipboardID, const IClipboard*);
|
||||
virtual void grabClipboard(ClipboardID);
|
||||
|
@ -49,6 +50,7 @@ private:
|
|||
|
||||
private:
|
||||
CServer* m_server;
|
||||
bool m_is95Family;
|
||||
bool m_active;
|
||||
HWND m_window;
|
||||
HWND m_nextClipboardWindow;
|
||||
|
|
|
@ -151,6 +151,11 @@ bool CServer::setConfig(const CConfig& config)
|
|||
|
||||
// cut over
|
||||
m_config = config;
|
||||
|
||||
// tell primary screen about reconfiguration
|
||||
if (m_primary != NULL) {
|
||||
m_primary->onConfigure();
|
||||
}
|
||||
}
|
||||
|
||||
// wait for old secondary screen threads to disconnect. must
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
#include "CString.h"
|
||||
#include "CThread.h"
|
||||
#include "XBase.h"
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include "stdlist.h"
|
||||
#include "stdmap.h"
|
||||
|
||||
class CThread;
|
||||
class IServerProtocol;
|
||||
|
|
|
@ -42,6 +42,10 @@ static HHOOK g_keyboard = NULL;
|
|||
static HHOOK g_mouse = NULL;
|
||||
static HHOOK g_cbt = NULL;
|
||||
static HHOOK g_getMessage = NULL;
|
||||
static HANDLE g_keyHookThread = NULL;
|
||||
static DWORD g_keyHookThreadID = 0;
|
||||
static HANDLE g_keyHookEvent = NULL;
|
||||
static HHOOK g_keyboardLL = NULL;
|
||||
static bool g_relay = false;
|
||||
static SInt32 g_zoneSize = 0;
|
||||
static UInt32 g_zoneSides = 0;
|
||||
|
@ -103,7 +107,9 @@ static LRESULT CALLBACK keyboardHook(int code, WPARAM wParam, LPARAM lParam)
|
|||
case VK_CAPITAL:
|
||||
case VK_NUMLOCK:
|
||||
case VK_SCROLL:
|
||||
// pass event
|
||||
// pass event on. we want to let these through to
|
||||
// the window proc because otherwise the keyboard
|
||||
// lights may not stay synchronized.
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -250,6 +256,119 @@ static LRESULT CALLBACK getMessageHook(int code, WPARAM wParam, LPARAM lParam)
|
|||
return CallNextHookEx(g_getMessage, code, wParam, lParam);
|
||||
}
|
||||
|
||||
#if (_WIN32_WINNT >= 0x0400)
|
||||
|
||||
//
|
||||
// low-level keyboard hook -- this allows us to capture and handle
|
||||
// alt+tab, alt+esc, ctrl+esc, and windows key hot keys. on the down
|
||||
// side, key repeats are not compressed for us.
|
||||
//
|
||||
|
||||
static LRESULT CALLBACK keyboardLLHook(int code, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (code >= 0) {
|
||||
if (g_relay) {
|
||||
KBDLLHOOKSTRUCT* info = reinterpret_cast<KBDLLHOOKSTRUCT*>(lParam);
|
||||
|
||||
// let certain keys pass through
|
||||
switch (info->vkCode) {
|
||||
case VK_CAPITAL:
|
||||
case VK_NUMLOCK:
|
||||
case VK_SCROLL:
|
||||
// pass event on. we want to let these through to
|
||||
// the window proc because otherwise the keyboard
|
||||
// lights may not stay synchronized.
|
||||
break;
|
||||
|
||||
default:
|
||||
// construct lParam for WM_KEYDOWN, etc.
|
||||
DWORD lParam = 1; // repeat code
|
||||
lParam |= (info->scanCode << 16); // scan code
|
||||
if (info->flags & LLKHF_EXTENDED) {
|
||||
lParam |= (1lu << 24); // extended key
|
||||
}
|
||||
if (info->flags & LLKHF_ALTDOWN) {
|
||||
lParam |= (1lu << 29); // context code
|
||||
}
|
||||
if (info->flags & LLKHF_UP) {
|
||||
lParam |= (1lu << 31); // transition
|
||||
}
|
||||
// FIXME -- bit 30 should be set if key was already down
|
||||
|
||||
// forward message to our window
|
||||
PostMessage(g_hwnd, SYNERGY_MSG_KEY, info->vkCode, lParam);
|
||||
|
||||
// discard event
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return CallNextHookEx(g_keyboardLL, code, wParam, lParam);
|
||||
}
|
||||
|
||||
static DWORD WINAPI getKeyboardLLProc(void*)
|
||||
{
|
||||
// thread proc for low-level keyboard hook. this does nothing but
|
||||
// install the hook, process events, and uninstall the hook.
|
||||
|
||||
// force this thread to have a message queue
|
||||
MSG msg;
|
||||
PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
|
||||
|
||||
// install low-level keyboard hook
|
||||
g_keyboardLL = SetWindowsHookEx(WH_KEYBOARD_LL,
|
||||
&keyboardLLHook,
|
||||
g_hinstance,
|
||||
0);
|
||||
if (g_keyboardLL == NULL) {
|
||||
// indicate failure and exit
|
||||
g_keyHookThreadID = 0;
|
||||
SetEvent(g_keyHookEvent);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ready
|
||||
SetEvent(g_keyHookEvent);
|
||||
|
||||
// message loop
|
||||
bool done = false;
|
||||
while (!done) {
|
||||
switch (GetMessage(&msg, NULL, 0, 0)) {
|
||||
case -1:
|
||||
break;
|
||||
|
||||
case 0:
|
||||
done = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// uninstall hook
|
||||
UnhookWindowsHookEx(g_keyboardLL);
|
||||
g_keyboardLL = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else // (_WIN32_WINNT < 0x0400)
|
||||
|
||||
#error foo
|
||||
|
||||
static DWORD WINAPI getKeyboardLLProc(void*)
|
||||
{
|
||||
g_keyHookThreadID = 0;
|
||||
SetEvent(g_keyHookEvent);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static EWheelSupport GetWheelSupport()
|
||||
{
|
||||
// get operating system
|
||||
|
@ -286,8 +405,8 @@ static EWheelSupport GetWheelSupport()
|
|||
// assume modern. we don't do anything special in this case
|
||||
// except respond to WM_MOUSEWHEEL messages. GetSystemMetrics()
|
||||
// can apparently return FALSE even if a mouse wheel is present
|
||||
// though i'm not sure exactly when it does that (but WinME does
|
||||
// for my logitech usb trackball).
|
||||
// though i'm not sure exactly when it does that (WinME returns
|
||||
// FALSE for my logitech USB trackball).
|
||||
return kWheelModern;
|
||||
}
|
||||
|
||||
|
@ -387,6 +506,34 @@ int install(HWND hwnd)
|
|||
// ignore failure; we just won't get mouse wheel messages
|
||||
}
|
||||
|
||||
// install low-level keyboard hook, if possible. since this hook
|
||||
// is called in the context of the installing thread and that
|
||||
// thread must have a message loop but we don't want the caller's
|
||||
// message loop to do the work, we'll fire up a separate thread
|
||||
// just for the hook. note that low-level keyboard hooks are only
|
||||
// available on windows NT SP3 and above.
|
||||
g_keyHookEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
if (g_keyHookEvent != NULL) {
|
||||
g_keyHookThread = CreateThread(NULL, 0, &getKeyboardLLProc, 0,
|
||||
CREATE_SUSPENDED, &g_keyHookThreadID);
|
||||
if (g_keyHookThread != NULL) {
|
||||
// start the thread and wait for it to initialize
|
||||
ResumeThread(g_keyHookThread);
|
||||
WaitForSingleObject(g_keyHookEvent, INFINITE);
|
||||
ResetEvent(g_keyHookEvent);
|
||||
|
||||
// the thread clears g_keyHookThreadID if it failed
|
||||
if (g_keyHookThreadID == 0) {
|
||||
CloseHandle(g_keyHookThread);
|
||||
g_keyHookThread = NULL;
|
||||
}
|
||||
}
|
||||
if (g_keyHookThread == NULL) {
|
||||
CloseHandle(g_keyHookEvent);
|
||||
g_keyHookEvent = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -397,6 +544,15 @@ int uninstall(void)
|
|||
assert(g_cbt != NULL);
|
||||
|
||||
// uninstall hooks
|
||||
if (g_keyHookThread != NULL) {
|
||||
PostThreadMessage(g_keyHookThreadID, WM_QUIT, 0, 0);
|
||||
WaitForSingleObject(g_keyHookThread, INFINITE);
|
||||
CloseHandle(g_keyHookEvent);
|
||||
CloseHandle(g_keyHookThread);
|
||||
g_keyHookEvent = NULL;
|
||||
g_keyHookThread = NULL;
|
||||
g_keyHookThreadID = 0;
|
||||
}
|
||||
UnhookWindowsHookEx(g_keyboard);
|
||||
UnhookWindowsHookEx(g_mouse);
|
||||
UnhookWindowsHookEx(g_cbt);
|
||||
|
|
|
@ -303,6 +303,11 @@ void CXWindowsPrimaryScreen::leave()
|
|||
m_active = true;
|
||||
}
|
||||
|
||||
void CXWindowsPrimaryScreen::onConfigure()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void CXWindowsPrimaryScreen::warpCursor(SInt32 x, SInt32 y)
|
||||
{
|
||||
CDisplayLock display(this);
|
||||
|
|
|
@ -18,6 +18,7 @@ public:
|
|||
virtual void close();
|
||||
virtual void enter(SInt32 xAbsolute, SInt32 yAbsolute);
|
||||
virtual void leave();
|
||||
virtual void onConfigure();
|
||||
virtual void warpCursor(SInt32 xAbsolute, SInt32 yAbsolute);
|
||||
virtual void setClipboard(ClipboardID, const IClipboard*);
|
||||
virtual void grabClipboard(ClipboardID);
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
#include "CMutex.h"
|
||||
#include "CNetwork.h"
|
||||
#include "CThread.h"
|
||||
#include <fstream>
|
||||
#include "stdfstream.h"
|
||||
#include <assert.h>
|
||||
|
||||
//
|
||||
// config file stuff
|
||||
|
@ -54,7 +55,7 @@ void realMain()
|
|||
CConfig config;
|
||||
{
|
||||
log((CLOG_DEBUG "opening configuration"));
|
||||
ifstream configStream(s_configFileName);
|
||||
std::ifstream configStream(s_configFileName);
|
||||
if (!configStream) {
|
||||
throw XConfigRead("cannot open configuration");
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ RSC=rc.exe
|
|||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\base" /I "..\io" /I "..\mt" /I "..\net" /I "..\synergy" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
|
||||
# ADD CPP /nologo /MT /W4 /GX /O2 /I "..\base" /I "..\io" /I "..\mt" /I "..\net" /I "..\synergy" /I "..\http" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
|
@ -68,7 +68,7 @@ LINK32=link.exe
|
|||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\base" /I "..\io" /I "..\mt" /I "..\net" /I "..\synergy" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "..\base" /I "..\io" /I "..\mt" /I "..\net" /I "..\synergy" /I "..\http" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
|
@ -92,11 +92,15 @@ LINK32=link.exe
|
|||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CMSWindowsPrimaryScreen.cpp
|
||||
SOURCE=.\CConfig.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CConfig.cpp
|
||||
SOURCE=.\CHTTPServer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CMSWindowsPrimaryScreen.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
|
@ -124,11 +128,15 @@ SOURCE=.\server.rc
|
|||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CMSWindowsPrimaryScreen.h
|
||||
SOURCE=.\CConfig.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CConfig.h
|
||||
SOURCE=.\CHTTPServer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CMSWindowsPrimaryScreen.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ RSC=rc.exe
|
|||
# PROP Intermediate_Dir "ReleaseHook"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SYNRGYHK_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\base" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SYNRGYHK_EXPORTS" /FD /c
|
||||
# ADD CPP /nologo /MT /W4 /GX /O2 /I "..\base" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SYNRGYHK_EXPORTS" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
|
@ -68,7 +68,7 @@ LINK32=link.exe
|
|||
# PROP Intermediate_Dir "DebugHook"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SYNRGYHK_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\base" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SYNRGYHK_EXPORTS" /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "..\base" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SYNRGYHK_EXPORTS" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
|
@ -93,6 +93,7 @@ LINK32=link.exe
|
|||
# Begin Source File
|
||||
|
||||
SOURCE=.\CSynergyHook.cpp
|
||||
# ADD CPP /D _WIN32_WINNT=0x0400
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
|
55
synergy.dsw
55
synergy.dsw
|
@ -7,10 +7,6 @@ Project: "all"=.\all.dsp - Package Owner=<4>
|
|||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
millpond
|
||||
.
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
|
@ -29,10 +25,6 @@ Project: "base"=.\base\base.dsp - Package Owner=<4>
|
|||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
millpond
|
||||
.\base
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
|
@ -45,10 +37,6 @@ Project: "client"=.\client\client.dsp - Package Owner=<4>
|
|||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
millpond
|
||||
.\client
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
|
@ -72,14 +60,22 @@ Package=<4>
|
|||
|
||||
###############################################################################
|
||||
|
||||
Project: "http"=.\HTTP\http.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "io"=.\io\io.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
millpond
|
||||
.\io
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
|
@ -92,10 +88,6 @@ Project: "makehook"=.\server\makehook.dsp - Package Owner=<4>
|
|||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
millpond
|
||||
.\server
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
|
@ -111,10 +103,6 @@ Project: "mt"=.\mt\mt.dsp - Package Owner=<4>
|
|||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
millpond
|
||||
.\mt
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
|
@ -127,10 +115,6 @@ Project: "net"=.\net\net.dsp - Package Owner=<4>
|
|||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
millpond
|
||||
.\net
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
|
@ -143,10 +127,6 @@ Project: "server"=.\server\server.dsp - Package Owner=<4>
|
|||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
millpond
|
||||
.\server
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
|
@ -169,6 +149,9 @@ Package=<4>
|
|||
Begin Project Dependency
|
||||
Project_Dep_Name makehook
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name http
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
@ -177,10 +160,6 @@ Project: "synergy"=.\synergy\synergy.dsp - Package Owner=<4>
|
|||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
millpond
|
||||
.\synergy
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
|
@ -193,10 +172,6 @@ Project: "synrgyhk"=.\server\synrgyhk.dsp - Package Owner=<4>
|
|||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
millpond
|
||||
.\server
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
#include "IClipboard.h"
|
||||
#include "ClipboardTypes.h"
|
||||
#include "CString.h"
|
||||
#include "stdmap.h"
|
||||
#include "stdlist.h"
|
||||
#include <X11/Xlib.h>
|
||||
#include <map>
|
||||
#include <list>
|
||||
|
||||
class CXWindowsClipboard : public IClipboard {
|
||||
public:
|
||||
|
|
|
@ -49,6 +49,11 @@ public:
|
|||
// the cursor and grab exclusive access to the input devices.
|
||||
virtual void leave() = 0;
|
||||
|
||||
// called when the configuration has changed. subclasses may need
|
||||
// to adjust things (like the jump zones) after the configuration
|
||||
// changes.
|
||||
virtual void onConfigure() = 0;
|
||||
|
||||
// warp the cursor to the given position
|
||||
virtual void warpCursor(SInt32 xAbsolute, SInt32 yAbsolute) = 0;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ RSC=rc.exe
|
|||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\base" /I "..\io" /I "..\mt" /I "..\net" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
|
||||
# ADD CPP /nologo /MT /W4 /GX /O2 /I "..\base" /I "..\io" /I "..\mt" /I "..\net" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
|
@ -65,7 +65,7 @@ LIB32=link.exe -lib
|
|||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\base" /I "..\io" /I "..\mt" /I "..\net" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "..\base" /I "..\io" /I "..\mt" /I "..\net" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
|
|
Loading…
Reference in New Issue