patch by jerry: fixed new event queue on Mac and Linu
This commit is contained in:
parent
608074c041
commit
18a3db6843
|
@ -24,7 +24,9 @@
|
|||
//
|
||||
|
||||
COSXClientTaskBarReceiver::COSXClientTaskBarReceiver(
|
||||
const CBufferedLogOutputter*)
|
||||
const CBufferedLogOutputter*,
|
||||
IEventQueue* events) :
|
||||
CClientTaskBarReceiver(events)
|
||||
{
|
||||
// add ourself to the task bar
|
||||
ARCH->addReceiver(this);
|
||||
|
@ -60,8 +62,8 @@ COSXClientTaskBarReceiver::getIcon() const
|
|||
}
|
||||
|
||||
IArchTaskBarReceiver*
|
||||
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer)
|
||||
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events)
|
||||
{
|
||||
return new COSXClientTaskBarReceiver(logBuffer);
|
||||
return new COSXClientTaskBarReceiver(logBuffer, events);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,11 +22,12 @@
|
|||
#include "CClientTaskBarReceiver.h"
|
||||
|
||||
class CBufferedLogOutputter;
|
||||
class IEventQueue;
|
||||
|
||||
//! Implementation of CClientTaskBarReceiver for OS X
|
||||
class COSXClientTaskBarReceiver : public CClientTaskBarReceiver {
|
||||
public:
|
||||
COSXClientTaskBarReceiver(const CBufferedLogOutputter*);
|
||||
COSXClientTaskBarReceiver(const CBufferedLogOutputter*, IEventQueue* events);
|
||||
virtual ~COSXClientTaskBarReceiver();
|
||||
|
||||
// IArchTaskBarReceiver overrides
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
//
|
||||
|
||||
CXWindowsClientTaskBarReceiver::CXWindowsClientTaskBarReceiver(
|
||||
const CBufferedLogOutputter*)
|
||||
const CBufferedLogOutputter*,
|
||||
IEventQueue* events) :
|
||||
CClientTaskBarReceiver(events)
|
||||
{
|
||||
// add ourself to the task bar
|
||||
ARCH->addReceiver(this);
|
||||
|
@ -60,7 +62,7 @@ CXWindowsClientTaskBarReceiver::getIcon() const
|
|||
}
|
||||
|
||||
IArchTaskBarReceiver*
|
||||
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer)
|
||||
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events)
|
||||
{
|
||||
return new CXWindowsClientTaskBarReceiver(logBuffer);
|
||||
return new CXWindowsClientTaskBarReceiver(logBuffer, events);
|
||||
}
|
||||
|
|
|
@ -22,11 +22,13 @@
|
|||
#include "CClientTaskBarReceiver.h"
|
||||
|
||||
class CBufferedLogOutputter;
|
||||
class IEventQueue;
|
||||
|
||||
//! Implementation of CClientTaskBarReceiver for X Windows
|
||||
class CXWindowsClientTaskBarReceiver : public CClientTaskBarReceiver {
|
||||
public:
|
||||
CXWindowsClientTaskBarReceiver(const CBufferedLogOutputter*);
|
||||
CXWindowsClientTaskBarReceiver(
|
||||
const CBufferedLogOutputter*, IEventQueue* events);
|
||||
virtual ~CXWindowsClientTaskBarReceiver();
|
||||
|
||||
// IArchTaskBarReceiver overrides
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
//
|
||||
|
||||
COSXServerTaskBarReceiver::COSXServerTaskBarReceiver(
|
||||
const CBufferedLogOutputter*)
|
||||
const CBufferedLogOutputter*, IEventQueue* events) :
|
||||
CServerTaskBarReceiver(events)
|
||||
{
|
||||
// add ourself to the task bar
|
||||
ARCH->addReceiver(this);
|
||||
|
@ -60,7 +61,7 @@ COSXServerTaskBarReceiver::getIcon() const
|
|||
}
|
||||
|
||||
IArchTaskBarReceiver*
|
||||
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer)
|
||||
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events)
|
||||
{
|
||||
return new COSXServerTaskBarReceiver(logBuffer);
|
||||
return new COSXServerTaskBarReceiver(logBuffer, events);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class CBufferedLogOutputter;
|
|||
//! Implementation of CServerTaskBarReceiver for OS X
|
||||
class COSXServerTaskBarReceiver : public CServerTaskBarReceiver {
|
||||
public:
|
||||
COSXServerTaskBarReceiver(const CBufferedLogOutputter*);
|
||||
COSXServerTaskBarReceiver(const CBufferedLogOutputter*, IEventQueue* events);
|
||||
virtual ~COSXServerTaskBarReceiver();
|
||||
|
||||
// IArchTaskBarReceiver overrides
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
//
|
||||
|
||||
CXWindowsServerTaskBarReceiver::CXWindowsServerTaskBarReceiver(
|
||||
const CBufferedLogOutputter*)
|
||||
const CBufferedLogOutputter*, IEventQueue* events) :
|
||||
CServerTaskBarReceiver(events)
|
||||
{
|
||||
// add ourself to the task bar
|
||||
ARCH->addReceiver(this);
|
||||
|
@ -60,7 +61,7 @@ CXWindowsServerTaskBarReceiver::getIcon() const
|
|||
}
|
||||
|
||||
IArchTaskBarReceiver*
|
||||
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer)
|
||||
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events)
|
||||
{
|
||||
return new CXWindowsServerTaskBarReceiver(logBuffer);
|
||||
return new CXWindowsServerTaskBarReceiver(logBuffer, events);
|
||||
}
|
||||
|
|
|
@ -22,11 +22,13 @@
|
|||
#include "CServerTaskBarReceiver.h"
|
||||
|
||||
class CBufferedLogOutputter;
|
||||
class IEventQueue;
|
||||
|
||||
//! Implementation of CServerTaskBarReceiver for X Windows
|
||||
class CXWindowsServerTaskBarReceiver : public CServerTaskBarReceiver {
|
||||
public:
|
||||
CXWindowsServerTaskBarReceiver(const CBufferedLogOutputter*);
|
||||
CXWindowsServerTaskBarReceiver(
|
||||
const CBufferedLogOutputter*, IEventQueue* events);
|
||||
virtual ~CXWindowsServerTaskBarReceiver();
|
||||
|
||||
// IArchTaskBarReceiver overrides
|
||||
|
|
|
@ -177,7 +177,7 @@ private:
|
|||
|
||||
#define EVENT_TYPE_ACCESSOR(type_) \
|
||||
type_##Events& \
|
||||
CEventQueue::for##type_##() { \
|
||||
CEventQueue::for##type_() { \
|
||||
if (m_typesFor##type_ == NULL) { \
|
||||
m_typesFor##type_ = new type_##Events(); \
|
||||
m_typesFor##type_->setEvents(dynamic_cast<IEventQueue*>(this)); \
|
||||
|
|
|
@ -26,7 +26,7 @@ CEventTypes::CEventTypes() :
|
|||
}
|
||||
|
||||
IEventQueue*
|
||||
CEventTypes::events() const
|
||||
CEventTypes::getEvents() const
|
||||
{
|
||||
assert(m_events != NULL);
|
||||
return m_events;
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
void setEvents(IEventQueue* events);
|
||||
|
||||
protected:
|
||||
IEventQueue* events() const;
|
||||
IEventQueue* getEvents() const;
|
||||
|
||||
private:
|
||||
IEventQueue* m_events;
|
||||
|
@ -37,7 +37,7 @@ private:
|
|||
CEvent::Type \
|
||||
type_##Events::name_() \
|
||||
{ \
|
||||
return events()->registerTypeOnce(m_##name_, __FUNCTION__); \
|
||||
return getEvents()->registerTypeOnce(m_##name_, __FUNCTION__); \
|
||||
}
|
||||
|
||||
class CClientEvents : public CEventTypes {
|
||||
|
|
|
@ -30,8 +30,8 @@ class CEventQueueTimer { };
|
|||
// COSXEventQueueBuffer
|
||||
//
|
||||
|
||||
COSXEventQueueBuffer::COSXEventQueueBuffer() :
|
||||
m_event(NULL)
|
||||
COSXEventQueueBuffer::COSXEventQueueBuffer(IEventQueue* events) :
|
||||
m_eventQueue(events), m_event(NULL)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ COSXEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID)
|
|||
|
||||
default:
|
||||
event = CEvent(CEvent::kSystem,
|
||||
m_events->getSystemTarget(), &m_event);
|
||||
m_eventQueue->getSystemTarget(), &m_event);
|
||||
return kSystem;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,10 +22,12 @@
|
|||
#include <Carbon/Carbon.h>
|
||||
#include "IEventQueueBuffer.h"
|
||||
|
||||
class IEventQueue;
|
||||
|
||||
//! Event queue buffer for OS X
|
||||
class COSXEventQueueBuffer : public IEventQueueBuffer {
|
||||
public:
|
||||
COSXEventQueueBuffer();
|
||||
COSXEventQueueBuffer(IEventQueue* eventQueue);
|
||||
virtual ~COSXEventQueueBuffer();
|
||||
|
||||
// IEventQueueBuffer overrides
|
||||
|
@ -39,6 +41,7 @@ public:
|
|||
|
||||
private:
|
||||
EventRef m_event;
|
||||
IEventQueue* m_eventQueue;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -181,6 +181,7 @@ static const CKeyEntry s_controlKeys[] = {
|
|||
//
|
||||
|
||||
COSXKeyState::COSXKeyState(IEventQueue* events) :
|
||||
CKeyState(events),
|
||||
m_deadKeyState(0)
|
||||
{
|
||||
init();
|
||||
|
|
|
@ -64,7 +64,9 @@ enum {
|
|||
bool COSXScreen::s_testedForGHOM = false;
|
||||
bool COSXScreen::s_hasGHOM = false;
|
||||
|
||||
COSXScreen::COSXScreen(bool isPrimary, bool autoShowHideCursor) :
|
||||
COSXScreen::COSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCursor) :
|
||||
CPlatformScreen(events),
|
||||
m_events(events),
|
||||
MouseButtonEventMap(NumButtonIDs),
|
||||
m_isPrimary(isPrimary),
|
||||
m_isOnScreen(m_isPrimary),
|
||||
|
@ -98,8 +100,8 @@ COSXScreen::COSXScreen(bool isPrimary, bool autoShowHideCursor) :
|
|||
try {
|
||||
m_displayID = CGMainDisplayID();
|
||||
updateScreenShape(m_displayID, 0);
|
||||
m_screensaver = new COSXScreenSaver(getEventTarget());
|
||||
m_keyState = new COSXKeyState();
|
||||
m_screensaver = new COSXScreenSaver(m_events, getEventTarget());
|
||||
m_keyState = new COSXKeyState(m_events);
|
||||
|
||||
// TODO: http://stackoverflow.com/questions/2950124/enable-access-for-assistive-device-programmatically
|
||||
if (m_isPrimary && !AXAPIEnabled())
|
||||
|
@ -178,7 +180,7 @@ COSXScreen::COSXScreen(bool isPrimary, bool autoShowHideCursor) :
|
|||
&COSXScreen::handleSystemEvent));
|
||||
|
||||
// install the platform event queue
|
||||
m_events->adoptBuffer(new COSXEventQueueBuffer);
|
||||
m_events->adoptBuffer(new COSXEventQueueBuffer(m_events));
|
||||
}
|
||||
|
||||
COSXScreen::~COSXScreen()
|
||||
|
@ -1036,7 +1038,7 @@ COSXScreen::onMouseMove(SInt32 mx, SInt32 my)
|
|||
|
||||
if (m_isOnScreen) {
|
||||
// motion on primary screen
|
||||
sendEvent(m_events->forIScreen().motionOnPrimary(),
|
||||
sendEvent(m_events->forIPrimaryScreen().motionOnPrimary(),
|
||||
CMotionInfo::alloc(m_xCursor, m_yCursor));
|
||||
}
|
||||
else {
|
||||
|
@ -1058,7 +1060,7 @@ COSXScreen::onMouseMove(SInt32 mx, SInt32 my)
|
|||
}
|
||||
else {
|
||||
// send motion
|
||||
sendEvent(m_events->forIScreen().motionOnSecondary(), CMotionInfo::alloc(x, y));
|
||||
sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), CMotionInfo::alloc(x, y));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1494,7 +1496,7 @@ COSXScreen::updateScreenShape()
|
|||
|
||||
delete[] displays;
|
||||
// We want to notify the peer screen whether we are primary screen or not
|
||||
sendEvent(m_events->forIPrimaryScreen().shapeChanged());
|
||||
sendEvent(m_events->forIScreen().shapeChanged());
|
||||
|
||||
LOG((CLOG_DEBUG "screen shape: center=%d,%d size=%dx%d on %u %s",
|
||||
m_x, m_y, m_w, m_h, displayCount,
|
||||
|
@ -1518,15 +1520,16 @@ COSXScreen::userSwitchCallback(EventHandlerCallRef nextHandler,
|
|||
{
|
||||
COSXScreen* screen = (COSXScreen*)inUserData;
|
||||
UInt32 kind = GetEventKind(theEvent);
|
||||
IEventQueue* events = screen->getEvents();
|
||||
|
||||
if (kind == kEventSystemUserSessionDeactivated) {
|
||||
LOG((CLOG_DEBUG "user session deactivated"));
|
||||
m_events->addEvent(CEvent(m_events->forIScreen().suspend(),
|
||||
events->addEvent(CEvent(events->forIScreen().suspend(),
|
||||
screen->getEventTarget()));
|
||||
}
|
||||
else if (kind == kEventSystemUserSessionActivated) {
|
||||
LOG((CLOG_DEBUG "user session activated"));
|
||||
m_events->addEvent(CEvent(m_events->forIScreen().resume(),
|
||||
events->addEvent(CEvent(events->forIScreen().resume(),
|
||||
screen->getEventTarget()));
|
||||
}
|
||||
return (CallNextEventHandler(nextHandler, theEvent));
|
||||
|
|
|
@ -49,13 +49,16 @@ class CMutex;
|
|||
class CThread;
|
||||
class COSXKeyState;
|
||||
class COSXScreenSaver;
|
||||
class IEventQueue;
|
||||
|
||||
//! Implementation of IPlatformScreen for OS X
|
||||
class COSXScreen : public CPlatformScreen {
|
||||
public:
|
||||
COSXScreen(bool isPrimary, bool autoShowHideCursor=true);
|
||||
COSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCursor=true);
|
||||
virtual ~COSXScreen();
|
||||
|
||||
IEventQueue* getEvents() const { return m_events; }
|
||||
|
||||
// IScreen overrides
|
||||
virtual void* getEventTarget() const;
|
||||
virtual bool getClipboard(ClipboardID id, IClipboard*) const;
|
||||
|
@ -335,6 +338,8 @@ private:
|
|||
|
||||
// cursor will hide and show on enable and disable if true.
|
||||
bool m_autoShowHideCursor;
|
||||
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
// COSXScreenSaver
|
||||
//
|
||||
|
||||
COSXScreenSaver::COSXScreenSaver(void* eventTarget) :
|
||||
COSXScreenSaver::COSXScreenSaver(IEventQueue* events, void* eventTarget) :
|
||||
m_events(events),
|
||||
m_eventTarget(eventTarget),
|
||||
m_enabled(true)
|
||||
{
|
||||
|
|
|
@ -22,10 +22,12 @@
|
|||
#include "IScreenSaver.h"
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
class IEventQueue;
|
||||
|
||||
//! OSX screen saver implementation
|
||||
class COSXScreenSaver : public IScreenSaver {
|
||||
public:
|
||||
COSXScreenSaver(void* eventTarget);
|
||||
COSXScreenSaver(IEventQueue* events, void* eventTarget);
|
||||
virtual ~COSXScreenSaver();
|
||||
|
||||
// IScreenSaver overrides
|
||||
|
@ -53,6 +55,7 @@ private:
|
|||
void* m_autoReleasePool;
|
||||
EventHandlerRef m_launchTerminationEventHandlerRef;
|
||||
ProcessSerialNumber m_screenSaverPSN;
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -51,7 +51,8 @@ class CEventQueueTimer { };
|
|||
//
|
||||
|
||||
CXWindowsEventQueueBuffer::CXWindowsEventQueueBuffer(
|
||||
Display* display, Window window) :
|
||||
Display* display, Window window, IEventQueue* events) :
|
||||
m_events(events),
|
||||
m_display(display),
|
||||
m_window(window),
|
||||
m_waiting(false)
|
||||
|
|
|
@ -28,10 +28,12 @@
|
|||
# include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
class IEventQueue;
|
||||
|
||||
//! Event queue buffer for X11
|
||||
class CXWindowsEventQueueBuffer : public IEventQueueBuffer {
|
||||
public:
|
||||
CXWindowsEventQueueBuffer(Display*, Window);
|
||||
CXWindowsEventQueueBuffer(Display*, Window, IEventQueue* events);
|
||||
virtual ~CXWindowsEventQueueBuffer();
|
||||
|
||||
// IEventQueueBuffer overrides
|
||||
|
@ -57,6 +59,7 @@ private:
|
|||
CEventList m_postedEvents;
|
||||
bool m_waiting;
|
||||
int m_pipefd[2];
|
||||
IEventQueue* m_events;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -38,7 +38,10 @@
|
|||
|
||||
static const size_t ModifiersFromXDefaultSize = 32;
|
||||
|
||||
CXWindowsKeyState::CXWindowsKeyState(Display* display, bool useXKB) :
|
||||
CXWindowsKeyState::CXWindowsKeyState(
|
||||
Display* display, bool useXKB,
|
||||
IEventQueue* events) :
|
||||
CKeyState(events),
|
||||
m_display(display),
|
||||
m_modifierFromX(ModifiersFromXDefaultSize)
|
||||
{
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
class IEventQueue;
|
||||
|
||||
//! X Windows key state
|
||||
/*!
|
||||
A key state for X Windows.
|
||||
|
@ -48,7 +50,7 @@ public:
|
|||
kGroupPollAndSet = -2
|
||||
};
|
||||
|
||||
CXWindowsKeyState(Display*, bool useXKB);
|
||||
CXWindowsKeyState(Display*, bool useXKB, IEventQueue* events);
|
||||
CXWindowsKeyState(Display*, bool useXKB,
|
||||
IEventQueue* events, CKeyMap& keyMap);
|
||||
~CXWindowsKeyState();
|
||||
|
|
|
@ -88,7 +88,12 @@ static int xi_opcode;
|
|||
|
||||
CXWindowsScreen* CXWindowsScreen::s_screen = NULL;
|
||||
|
||||
CXWindowsScreen::CXWindowsScreen(const char* displayName, bool isPrimary, bool disableXInitThreads, int mouseScrollDelta, IEventQueue* events) :
|
||||
CXWindowsScreen::CXWindowsScreen(
|
||||
const char* displayName,
|
||||
bool isPrimary,
|
||||
bool disableXInitThreads,
|
||||
int mouseScrollDelta,
|
||||
IEventQueue* events) :
|
||||
m_isPrimary(isPrimary),
|
||||
m_mouseScrollDelta(mouseScrollDelta),
|
||||
m_display(NULL),
|
||||
|
@ -185,7 +190,8 @@ CXWindowsScreen::CXWindowsScreen(const char* displayName, bool isPrimary, bool d
|
|||
&CXWindowsScreen::handleSystemEvent));
|
||||
|
||||
// install the platform event queue
|
||||
m_events->adoptBuffer(new CXWindowsEventQueueBuffer(m_display, m_window));
|
||||
m_events->adoptBuffer(new CXWindowsEventQueueBuffer(
|
||||
m_display, m_window, m_events));
|
||||
}
|
||||
|
||||
CXWindowsScreen::~CXWindowsScreen()
|
||||
|
@ -1317,7 +1323,7 @@ CXWindowsScreen::handleSystemEvent(const CEvent& event, void*)
|
|||
if (id != kClipboardEnd) {
|
||||
LOG((CLOG_DEBUG "lost clipboard %d ownership at time %d", id, xevent->xselectionclear.time));
|
||||
m_clipboard[id]->lost(xevent->xselectionclear.time);
|
||||
sendClipboardEvent(m_events->forIPrimaryScreen().clipboardGrabbed(), id);
|
||||
sendClipboardEvent(m_events->forIScreen().clipboardGrabbed(), id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1731,7 +1737,7 @@ CXWindowsScreen::onError()
|
|||
m_display = NULL;
|
||||
|
||||
// notify of failure
|
||||
sendEvent(m_events->forIPrimaryScreen().error(), NULL);
|
||||
sendEvent(m_events->forIScreen().error(), NULL);
|
||||
|
||||
// FIXME -- should ensure that we ignore operations that involve
|
||||
// m_display from now on. however, Xlib will simply exit the
|
||||
|
|
|
@ -36,7 +36,9 @@ class CXWindowsScreenSaver;
|
|||
//! Implementation of IPlatformScreen for X11
|
||||
class CXWindowsScreen : public CPlatformScreen {
|
||||
public:
|
||||
CXWindowsScreen(const char* displayName, bool isPrimary, bool disableXInitThreads, int mouseScrollDelta, IEventQueue* events);
|
||||
CXWindowsScreen(const char* displayName, bool isPrimary,
|
||||
bool disableXInitThreads, int mouseScrollDelta,
|
||||
IEventQueue* events);
|
||||
virtual ~CXWindowsScreen();
|
||||
|
||||
//! @name manipulators
|
||||
|
|
|
@ -398,12 +398,12 @@ CXWindowsScreenSaver::setXScreenSaverActive(bool activated)
|
|||
|
||||
if (activated) {
|
||||
m_events->addEvent(CEvent(
|
||||
m_events->forIPlatformScreen().screensaverActivated(),
|
||||
m_events->forIPrimaryScreen().screensaverActivated(),
|
||||
m_eventTarget));
|
||||
}
|
||||
else {
|
||||
m_events->addEvent(CEvent(
|
||||
m_events->forIPlatformScreen().screensaverDeactivated(),
|
||||
m_events->forIPrimaryScreen().screensaverDeactivated(),
|
||||
m_eventTarget));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
virtual void setByeFunc(void(*bye)(int)) { m_bye = bye; }
|
||||
virtual void bye(int error) { m_bye(error); }
|
||||
|
||||
virtual IEventQueue* events() const { return m_events; }
|
||||
virtual IEventQueue* getEvents() const { return m_events; }
|
||||
|
||||
private:
|
||||
void handleIpcMessage(const CEvent&, void*);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "CAppUtilUnix.h"
|
||||
#include "CArgsBase.h"
|
||||
|
||||
CAppUtilUnix::CAppUtilUnix()
|
||||
CAppUtilUnix::CAppUtilUnix(IEventQueue* events)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,11 @@
|
|||
|
||||
#define ARCH_APP_UTIL CAppUtilUnix
|
||||
|
||||
class IEventQueue;
|
||||
|
||||
class CAppUtilUnix : public CAppUtil {
|
||||
public:
|
||||
CAppUtilUnix();
|
||||
CAppUtilUnix(IEventQueue* events);
|
||||
virtual ~CAppUtilUnix();
|
||||
|
||||
bool parseArg(const int& argc, const char* const* argv, int& i);
|
||||
|
|
|
@ -53,7 +53,7 @@ CAppUtilWindows::~CAppUtilWindows()
|
|||
BOOL WINAPI CAppUtilWindows::consoleHandler(DWORD)
|
||||
{
|
||||
LOG((CLOG_INFO "got shutdown signal"));
|
||||
IEventQueue* events = CAppUtil::instance().app().events();
|
||||
IEventQueue* events = CAppUtil::instance().app().getEvents();
|
||||
events->addEvent(CEvent(CEvent::kQuit));
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -234,9 +234,9 @@ CClientApp::createScreen()
|
|||
#elif WINAPI_XWINDOWS
|
||||
return new CScreen(new CXWindowsScreen(
|
||||
args().m_display, false, args().m_disableXInitThreads,
|
||||
args().m_yscroll, m_events));
|
||||
args().m_yscroll, m_events), m_events);
|
||||
#elif WINAPI_CARBON
|
||||
return new CScreen(new COSXScreen(false));
|
||||
return new CScreen(new COSXScreen(m_events, false), m_events);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ CServerApp::help()
|
|||
void
|
||||
CServerApp::reloadSignalHandler(CArch::ESignal, void*)
|
||||
{
|
||||
IEventQueue* events = CApp::instance().events();
|
||||
IEventQueue* events = CApp::instance().getEvents();
|
||||
events->addEvent(CEvent(events->forCServerApp().reloadConfig(),
|
||||
events->getSystemTarget()));
|
||||
}
|
||||
|
@ -625,9 +625,9 @@ CServerApp::createScreen()
|
|||
true, args().m_noHooks, args().m_gameDevice, args().m_stopOnDeskSwitch, m_events), m_events);
|
||||
#elif WINAPI_XWINDOWS
|
||||
return new CScreen(new CXWindowsScreen(
|
||||
args().m_display, true, args().m_disableXInitThreads, 0, m_events));
|
||||
args().m_display, true, args().m_disableXInitThreads, 0, m_events), m_events);
|
||||
#elif WINAPI_CARBON
|
||||
return new CScreen(new COSXScreen(true));
|
||||
return new CScreen(new COSXScreen(m_events, true), m_events);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -46,5 +46,5 @@ public:
|
|||
virtual const char* daemonName() const = 0;
|
||||
virtual int foregroundStartup(int argc, char** argv) = 0;
|
||||
virtual CScreen* createScreen() = 0;
|
||||
virtual IEventQueue* events() const = 0;
|
||||
virtual IEventQueue* getEvents() const = 0;
|
||||
};
|
||||
|
|
|
@ -40,7 +40,7 @@ TEST_F(COSXKeyStateTests, fakeAndPoll_shift)
|
|||
{
|
||||
CKeyMap keyMap;
|
||||
CMockEventQueue eventQueue;
|
||||
COSXKeyState keyState((IEventQueue*)eventQueue, keyMap);
|
||||
COSXKeyState keyState(&eventQueue, keyMap);
|
||||
keyState.updateKeyMap();
|
||||
|
||||
keyState.fakeKeyDown(SHIFT_ID_L, 0, 1);
|
||||
|
@ -60,7 +60,7 @@ TEST_F(COSXKeyStateTests, fakeAndPoll_charKey)
|
|||
{
|
||||
CKeyMap keyMap;
|
||||
CMockEventQueue eventQueue;
|
||||
COSXKeyState keyState((IEventQueue*)eventQueue, keyMap);
|
||||
COSXKeyState keyState(&eventQueue, keyMap);
|
||||
keyState.updateKeyMap();
|
||||
|
||||
keyState.fakeKeyDown(A_CHAR_ID, 0, 1);
|
||||
|
@ -79,7 +79,7 @@ TEST_F(COSXKeyStateTests, fakeAndPoll_charKeyAndModifier)
|
|||
{
|
||||
CKeyMap keyMap;
|
||||
CMockEventQueue eventQueue;
|
||||
COSXKeyState keyState((IEventQueue*)eventQueue, keyMap);
|
||||
COSXKeyState keyState(&eventQueue, keyMap);
|
||||
keyState.updateKeyMap();
|
||||
|
||||
keyState.fakeKeyDown(A_CHAR_ID, KeyModifierShift, 1);
|
||||
|
|
|
@ -77,7 +77,8 @@ TEST_F(CXWindowsKeyStateTests, setActiveGroup_pollAndSet_groupIsZero)
|
|||
{
|
||||
CMockKeyMap keyMap;
|
||||
CMockEventQueue eventQueue;
|
||||
CXWindowsKeyState keyState(m_display, true, eventQueue, keyMap);
|
||||
CXWindowsKeyState keyState(
|
||||
m_display, true, &eventQueue, keyMap);
|
||||
|
||||
keyState.setActiveGroup(CXWindowsKeyState::kGroupPollAndSet);
|
||||
|
||||
|
@ -88,7 +89,8 @@ TEST_F(CXWindowsKeyStateTests, setActiveGroup_poll_groupIsNotSet)
|
|||
{
|
||||
CMockKeyMap keyMap;
|
||||
CMockEventQueue eventQueue;
|
||||
CXWindowsKeyState keyState(m_display, true, eventQueue, keyMap);
|
||||
CXWindowsKeyState keyState(
|
||||
m_display, true, &eventQueue, keyMap);
|
||||
|
||||
keyState.setActiveGroup(CXWindowsKeyState::kGroupPoll);
|
||||
|
||||
|
@ -99,7 +101,8 @@ TEST_F(CXWindowsKeyStateTests, setActiveGroup_customGroup_groupWasSet)
|
|||
{
|
||||
CMockKeyMap keyMap;
|
||||
CMockEventQueue eventQueue;
|
||||
CXWindowsKeyState keyState(m_display, true, eventQueue, keyMap);
|
||||
CXWindowsKeyState keyState(
|
||||
m_display, true, &eventQueue, keyMap);
|
||||
|
||||
keyState.setActiveGroup(1);
|
||||
|
||||
|
@ -110,7 +113,8 @@ TEST_F(CXWindowsKeyStateTests, mapModifiersFromX_zeroState_zeroMask)
|
|||
{
|
||||
CMockKeyMap keyMap;
|
||||
CMockEventQueue eventQueue;
|
||||
CXWindowsKeyState keyState(m_display, true, eventQueue, keyMap);
|
||||
CXWindowsKeyState keyState(
|
||||
m_display, true, &eventQueue, keyMap);
|
||||
|
||||
int mask = keyState.mapModifiersFromX(0);
|
||||
|
||||
|
@ -121,7 +125,8 @@ TEST_F(CXWindowsKeyStateTests, mapModifiersToX_zeroMask_resultIsTrue)
|
|||
{
|
||||
CMockKeyMap keyMap;
|
||||
CMockEventQueue eventQueue;
|
||||
CXWindowsKeyState keyState(m_display, true, eventQueue, keyMap);
|
||||
CXWindowsKeyState keyState(
|
||||
m_display, true, &eventQueue, keyMap);
|
||||
|
||||
unsigned int modifiers = 0;
|
||||
bool result = keyState.mapModifiersToX(0, modifiers);
|
||||
|
@ -133,7 +138,8 @@ TEST_F(CXWindowsKeyStateTests, fakeCtrlAltDel_default_returnsFalse)
|
|||
{
|
||||
CMockKeyMap keyMap;
|
||||
CMockEventQueue eventQueue;
|
||||
CXWindowsKeyState keyState(m_display, true, eventQueue, keyMap);
|
||||
CXWindowsKeyState keyState(
|
||||
m_display, true, &eventQueue, keyMap);
|
||||
|
||||
bool result = keyState.fakeCtrlAltDel();
|
||||
|
||||
|
@ -144,7 +150,8 @@ TEST_F(CXWindowsKeyStateTests, pollActiveModifiers_defaultState_returnsZero)
|
|||
{
|
||||
CMockKeyMap keyMap;
|
||||
CMockEventQueue eventQueue;
|
||||
CXWindowsKeyState keyState(m_display, true, eventQueue, keyMap);
|
||||
CXWindowsKeyState keyState(
|
||||
m_display, true, &eventQueue, keyMap);
|
||||
|
||||
KeyModifierMask actual = keyState.pollActiveModifiers();
|
||||
|
||||
|
@ -155,7 +162,8 @@ TEST_F(CXWindowsKeyStateTests, pollActiveModifiers_shiftKeyDownThenUp_masksAreCo
|
|||
{
|
||||
CMockKeyMap keyMap;
|
||||
CMockEventQueue eventQueue;
|
||||
CXWindowsKeyState keyState(m_display, true, eventQueue, keyMap);
|
||||
CXWindowsKeyState keyState(
|
||||
m_display, true, &eventQueue, keyMap);
|
||||
|
||||
// set mock modifier mapping
|
||||
std::fill(
|
||||
|
@ -187,7 +195,8 @@ TEST_F(CXWindowsKeyStateTests, pollActiveGroup_defaultState_returnsZero)
|
|||
{
|
||||
CMockKeyMap keyMap;
|
||||
CMockEventQueue eventQueue;
|
||||
CXWindowsKeyState keyState(m_display, true, eventQueue, keyMap);
|
||||
CXWindowsKeyState keyState(
|
||||
m_display, true, &eventQueue, keyMap);
|
||||
|
||||
SInt32 actual = keyState.pollActiveGroup();
|
||||
|
||||
|
@ -198,7 +207,8 @@ TEST_F(CXWindowsKeyStateTests, pollActiveGroup_positiveGroup_returnsGroup)
|
|||
{
|
||||
CMockKeyMap keyMap;
|
||||
CMockEventQueue eventQueue;
|
||||
CXWindowsKeyState keyState(m_display, true, eventQueue, keyMap);
|
||||
CXWindowsKeyState keyState(
|
||||
m_display, true, &eventQueue, keyMap);
|
||||
|
||||
keyState.m_group = 3;
|
||||
|
||||
|
@ -212,7 +222,8 @@ TEST_F(CXWindowsKeyStateTests, pollActiveGroup_xkb_areEqual)
|
|||
#if HAVE_XKB_EXTENSION
|
||||
CMockKeyMap keyMap;
|
||||
CMockEventQueue eventQueue;
|
||||
CXWindowsKeyState keyState(m_display, true, eventQueue, keyMap);
|
||||
CXWindowsKeyState keyState(
|
||||
m_display, true, &eventQueue, keyMap);
|
||||
|
||||
// reset the group
|
||||
keyState.m_group = -1;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#include <gtest/gtest.h>
|
||||
#include "CXWindowsScreenSaver.h"
|
||||
#include "CMockEventQueue.h"
|
||||
|
@ -24,14 +25,14 @@
|
|||
using ::testing::_;
|
||||
|
||||
// TODO: not working on build machine for some reason
|
||||
#if 0
|
||||
TEST(CXWindowsScreenSaverTests, activate_defaultScreen_todo)
|
||||
{
|
||||
Display* display = XOpenDisplay(":0.0");
|
||||
Window window = DefaultRootWindow(display);
|
||||
CMockEventQueue eventQueue;
|
||||
EXPECT_CALL(eventQueue, removeHandler(_, _)).Times(1);
|
||||
CXWindowsScreenSaver screenSaver(display, window, NULL, eventQueue);
|
||||
CXWindowsScreenSaver screenSaver(
|
||||
display, window, NULL, &eventQueue);
|
||||
|
||||
screenSaver.activate();
|
||||
|
||||
|
|
|
@ -28,7 +28,8 @@ TEST(CXWindowsScreenTests, fakeMouseMove_nonPrimary_getCursorPosValuesCorrect)
|
|||
EXPECT_CALL(eventQueue, adoptHandler(_, _, _)).Times(2);
|
||||
EXPECT_CALL(eventQueue, adoptBuffer(_)).Times(2);
|
||||
EXPECT_CALL(eventQueue, removeHandler(_, _)).Times(2);
|
||||
CXWindowsScreen screen(":0.0", false, false, 0, eventQueue);
|
||||
CXWindowsScreen screen(
|
||||
":0.0", false, false, 0, &eventQueue);
|
||||
|
||||
screen.fakeMouseMove(10, 20);
|
||||
|
||||
|
|
Loading…
Reference in New Issue