mirror of
https://github.com/debauchee/barrier.git
synced 2026-11-30 15:56:00 +08:00
merged 1.4 r1007:1008 into trunk
This commit is contained in:
@@ -64,24 +64,6 @@ CEvent::getFlags() const
|
||||
return m_flags;
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
CEvent::registerType(const char* name)
|
||||
{
|
||||
return EVENTQUEUE->registerType(name);
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
CEvent::registerTypeOnce(Type& type, const char* name)
|
||||
{
|
||||
return EVENTQUEUE->registerTypeOnce(type, name);
|
||||
}
|
||||
|
||||
const char*
|
||||
CEvent::getTypeName(Type type)
|
||||
{
|
||||
return EVENTQUEUE->getTypeName(type);
|
||||
}
|
||||
|
||||
void
|
||||
CEvent::deleteData(const CEvent& event)
|
||||
{
|
||||
|
||||
@@ -59,27 +59,6 @@ public:
|
||||
//! @name manipulators
|
||||
//@{
|
||||
|
||||
//! Creates a new event type
|
||||
/*!
|
||||
Returns a unique event type id.
|
||||
*/
|
||||
static Type registerType(const char* name);
|
||||
|
||||
//! Creates a new event type
|
||||
/*!
|
||||
If \p type contains \c kUnknown then it is set to a unique event
|
||||
type id otherwise it is left alone. The final value of \p type
|
||||
is returned.
|
||||
*/
|
||||
static Type registerTypeOnce(Type& type, const char* name);
|
||||
|
||||
//! Get name for event
|
||||
/*!
|
||||
Returns the name for the event \p type. This is primarily for
|
||||
debugging.
|
||||
*/
|
||||
static const char* getTypeName(Type type);
|
||||
|
||||
//! Release event data
|
||||
/*!
|
||||
Deletes event data for the given event (using free()).
|
||||
|
||||
@@ -187,21 +187,21 @@ CClient::getServerAddress() const
|
||||
CEvent::Type
|
||||
CClient::getConnectedEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_connectedEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_connectedEvent,
|
||||
"CClient::connected");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
CClient::getConnectionFailedEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_connectionFailedEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_connectionFailedEvent,
|
||||
"CClient::failed");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
CClient::getDisconnectedEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_disconnectedEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_disconnectedEvent,
|
||||
"CClient::disconnected");
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ if (WIN32)
|
||||
endif()
|
||||
|
||||
set(inc
|
||||
../arch
|
||||
../base
|
||||
../common
|
||||
)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "IStream.h"
|
||||
#include "CEventQueue.h"
|
||||
|
||||
//
|
||||
// IStream
|
||||
@@ -30,34 +31,34 @@ CEvent::Type IStream::s_outputShutdownEvent = CEvent::kUnknown;
|
||||
CEvent::Type
|
||||
IStream::getInputReadyEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_inputReadyEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_inputReadyEvent,
|
||||
"IStream::inputReady");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IStream::getOutputFlushedEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_outputFlushedEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_outputFlushedEvent,
|
||||
"IStream::outputFlushed");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IStream::getOutputErrorEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_outputErrorEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_outputErrorEvent,
|
||||
"IStream::outputError");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IStream::getInputShutdownEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_inputShutdownEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_inputShutdownEvent,
|
||||
"IStream::inputShutdown");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IStream::getOutputShutdownEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_outputShutdownEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_outputShutdownEvent,
|
||||
"IStream::outputShutdown");
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "IDataSocket.h"
|
||||
#include "CEventQueue.h"
|
||||
|
||||
//
|
||||
// IDataSocket
|
||||
@@ -27,14 +28,14 @@ CEvent::Type IDataSocket::s_failedEvent = CEvent::kUnknown;
|
||||
CEvent::Type
|
||||
IDataSocket::getConnectedEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_connectedEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_connectedEvent,
|
||||
"IDataSocket::connected");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IDataSocket::getConnectionFailedEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_failedEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_failedEvent,
|
||||
"IDataSocket::failed");
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "IListenSocket.h"
|
||||
#include "CEventQueue.h"
|
||||
|
||||
//
|
||||
// IListenSocket
|
||||
@@ -26,6 +27,6 @@ CEvent::Type IListenSocket::s_connectingEvent = CEvent::kUnknown;
|
||||
CEvent::Type
|
||||
IListenSocket::getConnectingEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_connectingEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_connectingEvent,
|
||||
"IListenSocket::connecting");
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "ISocket.h"
|
||||
#include "CEventQueue.h"
|
||||
|
||||
//
|
||||
// ISocket
|
||||
@@ -26,6 +27,6 @@ CEvent::Type ISocket::s_disconnectedEvent = CEvent::kUnknown;
|
||||
CEvent::Type
|
||||
ISocket::getDisconnectedEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_disconnectedEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_disconnectedEvent,
|
||||
"ISocket::disconnected");
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ CClientListener::getNextClient()
|
||||
CEvent::Type
|
||||
CClientListener::getConnectedEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_connectedEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_connectedEvent,
|
||||
"CClientListener::connected");
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "CProtocolUtil.h"
|
||||
#include "IStream.h"
|
||||
#include "CLog.h"
|
||||
#include "CEventQueue.h"
|
||||
|
||||
//
|
||||
// CClientProxy
|
||||
@@ -59,21 +60,21 @@ CClientProxy::getStream() const
|
||||
CEvent::Type
|
||||
CClientProxy::getReadyEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_readyEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_readyEvent,
|
||||
"CClientProxy::ready");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
CClientProxy::getDisconnectedEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_disconnectedEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_disconnectedEvent,
|
||||
"CClientProxy::disconnected");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
CClientProxy::getClipboardChangedEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_clipboardChangedEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_clipboardChangedEvent,
|
||||
"CClientProxy::clipboardChanged");
|
||||
}
|
||||
|
||||
|
||||
@@ -79,14 +79,14 @@ CClientProxyUnknown::orphanClientProxy()
|
||||
CEvent::Type
|
||||
CClientProxyUnknown::getSuccessEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_successEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_successEvent,
|
||||
"CClientProxy::success");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
CClientProxyUnknown::getFailureEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_failureEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_failureEvent,
|
||||
"CClientProxy::failure");
|
||||
}
|
||||
|
||||
|
||||
@@ -536,8 +536,8 @@ CInputFilter::CKeystrokeAction::format() const
|
||||
void
|
||||
CInputFilter::CKeystrokeAction::perform(const CEvent& event)
|
||||
{
|
||||
CEvent::Type type = m_press ? IPlatformScreen::getKeyDownEvent() :
|
||||
IPlatformScreen::getKeyUpEvent();
|
||||
CEvent::Type type = m_press ? IPlatformScreen::getKeyDownEvent(*EVENTQUEUE) :
|
||||
IPlatformScreen::getKeyUpEvent(*EVENTQUEUE);
|
||||
EVENTQUEUE->addEvent(CEvent(IPlatformScreen::getFakeInputBeginEvent(),
|
||||
event.getTarget(), NULL,
|
||||
CEvent::kDeliverImmediately));
|
||||
@@ -609,7 +609,7 @@ CInputFilter::CMouseButtonAction::perform(const CEvent& event)
|
||||
KeyID key = m_press ? kKeySetModifiers : kKeyClearModifiers;
|
||||
modifierInfo =
|
||||
IKeyState::CKeyInfo::alloc(key, m_buttonInfo->m_mask, 0, 1);
|
||||
EVENTQUEUE->addEvent(CEvent(IPlatformScreen::getKeyDownEvent(),
|
||||
EVENTQUEUE->addEvent(CEvent(IPlatformScreen::getKeyDownEvent(*EVENTQUEUE),
|
||||
event.getTarget(), modifierInfo,
|
||||
CEvent::kDeliverImmediately));
|
||||
}
|
||||
@@ -937,11 +937,11 @@ CInputFilter::setPrimaryClient(CPrimaryClient* client)
|
||||
rule->disable(m_primaryClient);
|
||||
}
|
||||
|
||||
EVENTQUEUE->removeHandler(IPlatformScreen::getKeyDownEvent(),
|
||||
EVENTQUEUE->removeHandler(IPlatformScreen::getKeyDownEvent(*EVENTQUEUE),
|
||||
m_primaryClient->getEventTarget());
|
||||
EVENTQUEUE->removeHandler(IPlatformScreen::getKeyUpEvent(),
|
||||
EVENTQUEUE->removeHandler(IPlatformScreen::getKeyUpEvent(*EVENTQUEUE),
|
||||
m_primaryClient->getEventTarget());
|
||||
EVENTQUEUE->removeHandler(IPlatformScreen::getKeyRepeatEvent(),
|
||||
EVENTQUEUE->removeHandler(IPlatformScreen::getKeyRepeatEvent(*EVENTQUEUE),
|
||||
m_primaryClient->getEventTarget());
|
||||
EVENTQUEUE->removeHandler(IPlatformScreen::getButtonDownEvent(),
|
||||
m_primaryClient->getEventTarget());
|
||||
@@ -958,15 +958,15 @@ CInputFilter::setPrimaryClient(CPrimaryClient* client)
|
||||
m_primaryClient = client;
|
||||
|
||||
if (m_primaryClient != NULL) {
|
||||
EVENTQUEUE->adoptHandler(IPlatformScreen::getKeyDownEvent(),
|
||||
EVENTQUEUE->adoptHandler(IPlatformScreen::getKeyDownEvent(*EVENTQUEUE),
|
||||
m_primaryClient->getEventTarget(),
|
||||
new TMethodEventJob<CInputFilter>(this,
|
||||
&CInputFilter::handleEvent));
|
||||
EVENTQUEUE->adoptHandler(IPlatformScreen::getKeyUpEvent(),
|
||||
EVENTQUEUE->adoptHandler(IPlatformScreen::getKeyUpEvent(*EVENTQUEUE),
|
||||
m_primaryClient->getEventTarget(),
|
||||
new TMethodEventJob<CInputFilter>(this,
|
||||
&CInputFilter::handleEvent));
|
||||
EVENTQUEUE->adoptHandler(IPlatformScreen::getKeyRepeatEvent(),
|
||||
EVENTQUEUE->adoptHandler(IPlatformScreen::getKeyRepeatEvent(*EVENTQUEUE),
|
||||
m_primaryClient->getEventTarget(),
|
||||
new TMethodEventJob<CInputFilter>(this,
|
||||
&CInputFilter::handleEvent));
|
||||
|
||||
@@ -95,15 +95,15 @@ CServer::CServer(const CConfig& config, CPrimaryClient* primaryClient) :
|
||||
EVENTQUEUE->adoptHandler(CEvent::kTimer, this,
|
||||
new TMethodEventJob<CServer>(this,
|
||||
&CServer::handleSwitchWaitTimeout));
|
||||
EVENTQUEUE->adoptHandler(IPlatformScreen::getKeyDownEvent(),
|
||||
EVENTQUEUE->adoptHandler(IPlatformScreen::getKeyDownEvent(*EVENTQUEUE),
|
||||
m_inputFilter,
|
||||
new TMethodEventJob<CServer>(this,
|
||||
&CServer::handleKeyDownEvent));
|
||||
EVENTQUEUE->adoptHandler(IPlatformScreen::getKeyUpEvent(),
|
||||
EVENTQUEUE->adoptHandler(IPlatformScreen::getKeyUpEvent(*EVENTQUEUE),
|
||||
m_inputFilter,
|
||||
new TMethodEventJob<CServer>(this,
|
||||
&CServer::handleKeyUpEvent));
|
||||
EVENTQUEUE->adoptHandler(IPlatformScreen::getKeyRepeatEvent(),
|
||||
EVENTQUEUE->adoptHandler(IPlatformScreen::getKeyRepeatEvent(* EVENTQUEUE),
|
||||
m_inputFilter,
|
||||
new TMethodEventJob<CServer>(this,
|
||||
&CServer::handleKeyRepeatEvent));
|
||||
@@ -182,11 +182,11 @@ CServer::CServer(const CConfig& config, CPrimaryClient* primaryClient) :
|
||||
CServer::~CServer()
|
||||
{
|
||||
// remove event handlers and timers
|
||||
EVENTQUEUE->removeHandler(IPlatformScreen::getKeyDownEvent(),
|
||||
EVENTQUEUE->removeHandler(IPlatformScreen::getKeyDownEvent(*EVENTQUEUE),
|
||||
m_inputFilter);
|
||||
EVENTQUEUE->removeHandler(IPlatformScreen::getKeyUpEvent(),
|
||||
EVENTQUEUE->removeHandler(IPlatformScreen::getKeyUpEvent(*EVENTQUEUE),
|
||||
m_inputFilter);
|
||||
EVENTQUEUE->removeHandler(IPlatformScreen::getKeyRepeatEvent(),
|
||||
EVENTQUEUE->removeHandler(IPlatformScreen::getKeyRepeatEvent(*EVENTQUEUE),
|
||||
m_inputFilter);
|
||||
EVENTQUEUE->removeHandler(IPlatformScreen::getButtonDownEvent(),
|
||||
m_inputFilter);
|
||||
@@ -345,49 +345,49 @@ CServer::getClients(std::vector<CString>& list) const
|
||||
CEvent::Type
|
||||
CServer::getErrorEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_errorEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_errorEvent,
|
||||
"CServer::error");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
CServer::getConnectedEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_connectedEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_connectedEvent,
|
||||
"CServer::connected");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
CServer::getDisconnectedEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_disconnectedEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_disconnectedEvent,
|
||||
"CServer::disconnected");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
CServer::getSwitchToScreenEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_switchToScreen,
|
||||
return EVENTQUEUE->registerTypeOnce(s_switchToScreen,
|
||||
"CServer::switchToScreen");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
CServer::getSwitchInDirectionEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_switchInDirection,
|
||||
return EVENTQUEUE->registerTypeOnce(s_switchInDirection,
|
||||
"CServer::switchInDirection");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
CServer::getKeyboardBroadcastEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_keyboardBroadcast,
|
||||
return EVENTQUEUE->registerTypeOnce(s_keyboardBroadcast,
|
||||
"CServer:keyboardBroadcast");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
CServer::getLockCursorToScreenEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_lockCursorToScreen,
|
||||
return EVENTQUEUE->registerTypeOnce(s_lockCursorToScreen,
|
||||
"CServer::lockCursorToScreen");
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ public:
|
||||
//@{
|
||||
|
||||
//! Swap with another \c CKeyMap
|
||||
void swap(CKeyMap&);
|
||||
virtual void swap(CKeyMap&);
|
||||
|
||||
//! Add a key entry
|
||||
/*!
|
||||
@@ -189,19 +189,19 @@ public:
|
||||
Records that modifier key \p key is half-duplex. This is called to
|
||||
set user configurable half-duplex settings.
|
||||
*/
|
||||
void addHalfDuplexModifier(KeyID key);
|
||||
virtual void addHalfDuplexModifier(KeyID key);
|
||||
|
||||
//! Finish adding entries
|
||||
/*!
|
||||
Called after adding entries, this does some internal housekeeping.
|
||||
*/
|
||||
void finish();
|
||||
virtual void finish();
|
||||
|
||||
//! Iterate over all added keys items
|
||||
/*!
|
||||
Calls \p cb for every key item.
|
||||
*/
|
||||
void foreachKey(ForeachKeyCallback cb, void* userData);
|
||||
virtual void foreachKey(ForeachKeyCallback cb, void* userData);
|
||||
|
||||
//@}
|
||||
//! @name accessors
|
||||
@@ -251,7 +251,7 @@ public:
|
||||
Returns \c true iff modifier key \p key or button \p button is
|
||||
half-duplex.
|
||||
*/
|
||||
bool isHalfDuplex(KeyID key, KeyButton button) const;
|
||||
virtual bool isHalfDuplex(KeyID key, KeyButton button) const;
|
||||
|
||||
//! Test if modifiers indicate a command
|
||||
/*!
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
#include "CKeyState.h"
|
||||
#include "IEventQueue.h"
|
||||
#include "CLog.h"
|
||||
#include <cstring>
|
||||
#include <algorithm>
|
||||
@@ -383,7 +382,31 @@ static const KeyID s_numpadTable[] = {
|
||||
//
|
||||
|
||||
CKeyState::CKeyState() :
|
||||
m_mask(0)
|
||||
IKeyState(),
|
||||
m_mask(0),
|
||||
m_keyMapPtr(new CKeyMap()),
|
||||
m_keyMap(*m_keyMapPtr)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
CKeyState::CKeyState(IEventQueue& eventQueue, CKeyMap& keyMap) :
|
||||
IKeyState(eventQueue),
|
||||
m_mask(0),
|
||||
m_keyMapPtr(0),
|
||||
m_keyMap(keyMap)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
CKeyState::~CKeyState()
|
||||
{
|
||||
if (m_keyMapPtr)
|
||||
delete m_keyMapPtr;
|
||||
}
|
||||
|
||||
void
|
||||
CKeyState::init()
|
||||
{
|
||||
memset(&m_keys, 0, sizeof(m_keys));
|
||||
memset(&m_syntheticKeys, 0, sizeof(m_syntheticKeys));
|
||||
@@ -391,11 +414,6 @@ CKeyState::CKeyState() :
|
||||
memset(&m_serverKeys, 0, sizeof(m_serverKeys));
|
||||
}
|
||||
|
||||
CKeyState::~CKeyState()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CKeyState::onKey(KeyButton button, bool down, KeyModifierMask newState)
|
||||
{
|
||||
@@ -431,23 +449,23 @@ CKeyState::sendKeyEvent(
|
||||
// ignore auto-repeat on half-duplex keys
|
||||
}
|
||||
else {
|
||||
EVENTQUEUE->addEvent(CEvent(getKeyDownEvent(), target,
|
||||
getEventQueue().addEvent(CEvent(getKeyDownEvent(), target,
|
||||
CKeyInfo::alloc(key, mask, button, 1)));
|
||||
EVENTQUEUE->addEvent(CEvent(getKeyUpEvent(), target,
|
||||
getEventQueue().addEvent(CEvent(getKeyUpEvent(), target,
|
||||
CKeyInfo::alloc(key, mask, button, 1)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isAutoRepeat) {
|
||||
EVENTQUEUE->addEvent(CEvent(getKeyRepeatEvent(), target,
|
||||
getEventQueue().addEvent(CEvent(getKeyRepeatEvent(), target,
|
||||
CKeyInfo::alloc(key, mask, button, count)));
|
||||
}
|
||||
else if (press) {
|
||||
EVENTQUEUE->addEvent(CEvent(getKeyDownEvent(), target,
|
||||
getEventQueue().addEvent(CEvent(getKeyDownEvent(), target,
|
||||
CKeyInfo::alloc(key, mask, button, 1)));
|
||||
}
|
||||
else {
|
||||
EVENTQUEUE->addEvent(CEvent(getKeyUpEvent(), target,
|
||||
getEventQueue().addEvent(CEvent(getKeyUpEvent(), target,
|
||||
CKeyInfo::alloc(key, mask, button, 1)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ platform specific methods.
|
||||
class CKeyState : public IKeyState {
|
||||
public:
|
||||
CKeyState();
|
||||
CKeyState(IEventQueue& eventQueue, CKeyMap& keyMap);
|
||||
virtual ~CKeyState();
|
||||
|
||||
//! @name manipulators
|
||||
@@ -137,6 +138,7 @@ protected:
|
||||
private:
|
||||
typedef CKeyMap::Keystrokes Keystrokes;
|
||||
typedef CKeyMap::ModifierToKeys ModifierToKeys;
|
||||
public:
|
||||
struct CAddActiveModifierContext {
|
||||
public:
|
||||
CAddActiveModifierContext(SInt32 group, KeyModifierMask mask,
|
||||
@@ -152,6 +154,7 @@ private:
|
||||
CAddActiveModifierContext(const CAddActiveModifierContext&);
|
||||
CAddActiveModifierContext& operator=(const CAddActiveModifierContext&);
|
||||
};
|
||||
private:
|
||||
|
||||
class ButtonToKeyLess {
|
||||
public:
|
||||
@@ -166,6 +169,9 @@ private:
|
||||
CKeyState(const CKeyState&);
|
||||
CKeyState& operator=(const CKeyState&);
|
||||
|
||||
// called by all ctors.
|
||||
void init();
|
||||
|
||||
// adds alias key sequences. these are sequences that are equivalent
|
||||
// to other sequences.
|
||||
void addAliasEntries();
|
||||
@@ -190,8 +196,11 @@ private:
|
||||
CKeyMap::KeyItem& keyItem, void* vcontext);
|
||||
|
||||
private:
|
||||
// must be declared before m_keyMap. used when this class owns the key map.
|
||||
CKeyMap* m_keyMapPtr;
|
||||
|
||||
// the keyboard map
|
||||
CKeyMap m_keyMap;
|
||||
CKeyMap& m_keyMap;
|
||||
|
||||
// current modifier state
|
||||
KeyModifierMask m_mask;
|
||||
|
||||
@@ -289,7 +289,7 @@ CServerApp::loadConfig(const CString& pathname)
|
||||
CEvent::Type
|
||||
CServerApp::getReloadConfigEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_reloadConfigEvent, "reloadConfig");
|
||||
return EVENTQUEUE->registerTypeOnce(s_reloadConfigEvent, "reloadConfig");
|
||||
}
|
||||
|
||||
void
|
||||
@@ -303,13 +303,13 @@ CServerApp::forceReconnect(const CEvent&, void*)
|
||||
CEvent::Type
|
||||
CServerApp::getForceReconnectEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_forceReconnectEvent, "forceReconnect");
|
||||
return EVENTQUEUE->registerTypeOnce(s_forceReconnectEvent, "forceReconnect");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
CServerApp::getResetServerEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_resetServerEvent, "resetServer");
|
||||
return EVENTQUEUE->registerTypeOnce(s_resetServerEvent, "resetServer");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "IKeyState.h"
|
||||
#include "CEventQueue.h"
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -27,28 +28,37 @@ CEvent::Type IKeyState::s_keyDownEvent = CEvent::kUnknown;
|
||||
CEvent::Type IKeyState::s_keyUpEvent = CEvent::kUnknown;
|
||||
CEvent::Type IKeyState::s_keyRepeatEvent = CEvent::kUnknown;
|
||||
|
||||
CEvent::Type
|
||||
IKeyState::getKeyDownEvent()
|
||||
IKeyState::IKeyState() :
|
||||
m_eventQueue(*EVENTQUEUE)
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_keyDownEvent,
|
||||
}
|
||||
|
||||
IKeyState::IKeyState(IEventQueue& eventQueue) :
|
||||
m_eventQueue(eventQueue)
|
||||
{
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IKeyState::getKeyDownEvent(IEventQueue& eventQueue)
|
||||
{
|
||||
return eventQueue.registerTypeOnce(s_keyDownEvent,
|
||||
"IKeyState::keyDown");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IKeyState::getKeyUpEvent()
|
||||
IKeyState::getKeyUpEvent(IEventQueue& eventQueue)
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_keyUpEvent,
|
||||
return eventQueue.registerTypeOnce(s_keyUpEvent,
|
||||
"IKeyState::keyUp");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IKeyState::getKeyRepeatEvent()
|
||||
IKeyState::getKeyRepeatEvent(IEventQueue& eventQueue)
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_keyRepeatEvent,
|
||||
return eventQueue.registerTypeOnce(s_keyRepeatEvent,
|
||||
"IKeyState::keyRepeat");
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// IKeyState::CKeyInfo
|
||||
//
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "CEvent.h"
|
||||
#include "CString.h"
|
||||
#include "stdset.h"
|
||||
#include "IEventQueue.h"
|
||||
|
||||
//! Key state interface
|
||||
/*!
|
||||
@@ -31,6 +32,9 @@ to synthesize key events.
|
||||
*/
|
||||
class IKeyState : public IInterface {
|
||||
public:
|
||||
IKeyState();
|
||||
IKeyState(IEventQueue& eventQueue);
|
||||
|
||||
enum {
|
||||
kNumButtons = 0x200
|
||||
};
|
||||
@@ -160,18 +164,33 @@ public:
|
||||
virtual void pollPressedKeys(KeyButtonSet& pressedKeys) const = 0;
|
||||
|
||||
//! Get key down event type. Event data is CKeyInfo*, count == 1.
|
||||
static CEvent::Type getKeyDownEvent();
|
||||
CEvent::Type getKeyDownEvent() { return getKeyDownEvent(m_eventQueue); }
|
||||
|
||||
//! Get key up event type. Event data is CKeyInfo*, count == 1.
|
||||
static CEvent::Type getKeyUpEvent();
|
||||
CEvent::Type getKeyUpEvent() { return getKeyUpEvent(m_eventQueue); }
|
||||
|
||||
//! Get key repeat event type. Event data is CKeyInfo*.
|
||||
static CEvent::Type getKeyRepeatEvent();
|
||||
CEvent::Type getKeyRepeatEvent() { return getKeyRepeatEvent(m_eventQueue); }
|
||||
|
||||
//! Get key down event type. Event data is CKeyInfo*, count == 1.
|
||||
static CEvent::Type getKeyDownEvent(IEventQueue& eventQueue);
|
||||
|
||||
//! Get key up event type. Event data is CKeyInfo*, count == 1.
|
||||
static CEvent::Type getKeyUpEvent(IEventQueue& eventQueue);
|
||||
|
||||
//! Get key repeat event type. Event data is CKeyInfo*.
|
||||
static CEvent::Type getKeyRepeatEvent(IEventQueue& eventQueue);
|
||||
|
||||
//@}
|
||||
|
||||
protected:
|
||||
IEventQueue& getEventQueue() const { return m_eventQueue; }
|
||||
|
||||
private:
|
||||
static CEvent::Type s_keyDownEvent;
|
||||
static CEvent::Type s_keyUpEvent;
|
||||
static CEvent::Type s_keyRepeatEvent;
|
||||
IEventQueue& m_eventQueue;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "IPrimaryScreen.h"
|
||||
#include "CEventQueue.h"
|
||||
#include <cstdlib>
|
||||
|
||||
//
|
||||
@@ -37,77 +38,77 @@ CEvent::Type IPrimaryScreen::s_fakeInputEnd = CEvent::kUnknown;
|
||||
CEvent::Type
|
||||
IPrimaryScreen::getButtonDownEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_buttonDownEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_buttonDownEvent,
|
||||
"IPrimaryScreen::buttonDown");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IPrimaryScreen::getButtonUpEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_buttonUpEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_buttonUpEvent,
|
||||
"IPrimaryScreen::buttonUp");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IPrimaryScreen::getMotionOnPrimaryEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_motionPrimaryEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_motionPrimaryEvent,
|
||||
"IPrimaryScreen::motionPrimary");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IPrimaryScreen::getMotionOnSecondaryEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_motionSecondaryEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_motionSecondaryEvent,
|
||||
"IPrimaryScreen::motionSecondary");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IPrimaryScreen::getWheelEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_wheelEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_wheelEvent,
|
||||
"IPrimaryScreen::wheel");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IPrimaryScreen::getScreensaverActivatedEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_ssActivatedEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_ssActivatedEvent,
|
||||
"IPrimaryScreen::screensaverActivated");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IPrimaryScreen::getScreensaverDeactivatedEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_ssDeactivatedEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_ssDeactivatedEvent,
|
||||
"IPrimaryScreen::screensaverDeactivated");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IPrimaryScreen::getHotKeyDownEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_hotKeyDownEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_hotKeyDownEvent,
|
||||
"IPrimaryScreen::hotKeyDown");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IPrimaryScreen::getHotKeyUpEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_hotKeyUpEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_hotKeyUpEvent,
|
||||
"IPrimaryScreen::hotKeyUp");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IPrimaryScreen::getFakeInputBeginEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_fakeInputBegin,
|
||||
return EVENTQUEUE->registerTypeOnce(s_fakeInputBegin,
|
||||
"IPrimaryScreen::fakeInputBegin");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IPrimaryScreen::getFakeInputEndEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_fakeInputEnd,
|
||||
return EVENTQUEUE->registerTypeOnce(s_fakeInputEnd,
|
||||
"IPrimaryScreen::fakeInputEnd");
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "IScreen.h"
|
||||
#include "CEventQueue.h"
|
||||
|
||||
//
|
||||
// IScreen
|
||||
@@ -30,34 +31,34 @@ CEvent::Type IScreen::s_resumeEvent = CEvent::kUnknown;
|
||||
CEvent::Type
|
||||
IScreen::getErrorEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_errorEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_errorEvent,
|
||||
"IScreen::error");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IScreen::getShapeChangedEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_shapeChangedEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_shapeChangedEvent,
|
||||
"IScreen::shapeChanged");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IScreen::getClipboardGrabbedEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_clipboardGrabbedEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_clipboardGrabbedEvent,
|
||||
"IScreen::clipboardGrabbed");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IScreen::getSuspendEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_suspendEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_suspendEvent,
|
||||
"IScreen::suspend");
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
IScreen::getResumeEvent()
|
||||
{
|
||||
return CEvent::registerTypeOnce(s_resumeEvent,
|
||||
return EVENTQUEUE->registerTypeOnce(s_resumeEvent,
|
||||
"IScreen::resume");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user