changed some method names and removed warpCursor() from

secondary screen interface.
This commit is contained in:
crs 2001-10-25 21:40:29 +00:00
parent 5b1826a638
commit c5df2edd14
4 changed files with 32 additions and 52 deletions

View File

@ -258,7 +258,7 @@ void CClient::onKeyDown()
{ {
SInt32 id, mask; SInt32 id, mask;
CProtocolUtil::readf(m_input, kMsgDKeyDown + 4, &id, &mask); CProtocolUtil::readf(m_input, kMsgDKeyDown + 4, &id, &mask);
m_screen->onKeyDown(static_cast<KeyID>(id), m_screen->keyDown(static_cast<KeyID>(id),
static_cast<KeyModifierMask>(mask)); static_cast<KeyModifierMask>(mask));
} }
@ -266,7 +266,7 @@ void CClient::onKeyRepeat()
{ {
SInt32 id, mask, count; SInt32 id, mask, count;
CProtocolUtil::readf(m_input, kMsgDKeyRepeat + 4, &id, &mask, &count); CProtocolUtil::readf(m_input, kMsgDKeyRepeat + 4, &id, &mask, &count);
m_screen->onKeyRepeat(static_cast<KeyID>(id), m_screen->keyRepeat(static_cast<KeyID>(id),
static_cast<KeyModifierMask>(mask), static_cast<KeyModifierMask>(mask),
count); count);
} }
@ -275,7 +275,7 @@ void CClient::onKeyUp()
{ {
SInt32 id, mask; SInt32 id, mask;
CProtocolUtil::readf(m_input, kMsgDKeyUp + 4, &id, &mask); CProtocolUtil::readf(m_input, kMsgDKeyUp + 4, &id, &mask);
m_screen->onKeyUp(static_cast<KeyID>(id), m_screen->keyUp(static_cast<KeyID>(id),
static_cast<KeyModifierMask>(mask)); static_cast<KeyModifierMask>(mask));
} }
@ -283,28 +283,28 @@ void CClient::onMouseDown()
{ {
SInt32 id; SInt32 id;
CProtocolUtil::readf(m_input, kMsgDMouseDown + 4, &id); CProtocolUtil::readf(m_input, kMsgDMouseDown + 4, &id);
m_screen->onMouseDown(static_cast<ButtonID>(id)); m_screen->mouseDown(static_cast<ButtonID>(id));
} }
void CClient::onMouseUp() void CClient::onMouseUp()
{ {
SInt32 id; SInt32 id;
CProtocolUtil::readf(m_input, kMsgDMouseUp + 4, &id); CProtocolUtil::readf(m_input, kMsgDMouseUp + 4, &id);
m_screen->onMouseUp(static_cast<ButtonID>(id)); m_screen->mouseUp(static_cast<ButtonID>(id));
} }
void CClient::onMouseMove() void CClient::onMouseMove()
{ {
SInt32 x, y; SInt32 x, y;
CProtocolUtil::readf(m_input, kMsgDMouseMove + 4, &x, &y); CProtocolUtil::readf(m_input, kMsgDMouseMove + 4, &x, &y);
m_screen->onMouseMove(x, y); m_screen->mouseMove(x, y);
} }
void CClient::onMouseWheel() void CClient::onMouseWheel()
{ {
SInt32 delta; SInt32 delta;
CProtocolUtil::readf(m_input, kMsgDMouseWheel + 4, &delta); CProtocolUtil::readf(m_input, kMsgDMouseWheel + 4, &delta);
m_screen->onMouseWheel(delta); m_screen->mouseWheel(delta);
} }

View File

@ -115,7 +115,8 @@ void CXWindowsSecondaryScreen::enter(SInt32 x, SInt32 y)
CLock lock(&m_mutex); CLock lock(&m_mutex);
// warp to requested location // warp to requested location
warpCursorNoLock(x, y); ::XTestFakeMotionEvent(m_display, m_screen, x, y, CurrentTime);
::XSync(m_display, False);
// show cursor // show cursor
::XUnmapWindow(m_display, m_window); ::XUnmapWindow(m_display, m_window);
@ -135,22 +136,7 @@ void CXWindowsSecondaryScreen::leave()
::XWarpPointer(m_display, None, m_window, 0, 0, 0, 0, 0, 0); ::XWarpPointer(m_display, None, m_window, 0, 0, 0, 0, 0, 0);
} }
void CXWindowsSecondaryScreen::warpCursor(SInt32 x, SInt32 y) void CXWindowsSecondaryScreen::keyDown(
{
CLock lock(&m_mutex);
warpCursorNoLock(x, y);
}
void CXWindowsSecondaryScreen::warpCursorNoLock(
SInt32 x, SInt32 y)
{
assert(m_display != NULL);
::XTestFakeMotionEvent(m_display, m_screen, x, y, CurrentTime);
::XSync(m_display, False);
}
void CXWindowsSecondaryScreen::onKeyDown(
KeyID key, KeyModifierMask mask) KeyID key, KeyModifierMask mask)
{ {
assert(m_display != NULL); assert(m_display != NULL);
@ -161,7 +147,7 @@ void CXWindowsSecondaryScreen::onKeyDown(
::XSync(m_display, False); ::XSync(m_display, False);
} }
void CXWindowsSecondaryScreen::onKeyRepeat( void CXWindowsSecondaryScreen::keyRepeat(
KeyID, KeyModifierMask, SInt32) KeyID, KeyModifierMask, SInt32)
{ {
assert(m_display != NULL); assert(m_display != NULL);
@ -171,7 +157,7 @@ void CXWindowsSecondaryScreen::onKeyRepeat(
// FIXME // FIXME
} }
void CXWindowsSecondaryScreen::onKeyUp( void CXWindowsSecondaryScreen::keyUp(
KeyID key, KeyModifierMask mask) KeyID key, KeyModifierMask mask)
{ {
assert(m_display != NULL); assert(m_display != NULL);
@ -182,7 +168,7 @@ void CXWindowsSecondaryScreen::onKeyUp(
::XSync(m_display, False); ::XSync(m_display, False);
} }
void CXWindowsSecondaryScreen::onMouseDown(ButtonID button) void CXWindowsSecondaryScreen::mouseDown(ButtonID button)
{ {
assert(m_display != NULL); assert(m_display != NULL);
@ -192,7 +178,7 @@ void CXWindowsSecondaryScreen::onMouseDown(ButtonID button)
::XSync(m_display, False); ::XSync(m_display, False);
} }
void CXWindowsSecondaryScreen::onMouseUp(ButtonID button) void CXWindowsSecondaryScreen::mouseUp(ButtonID button)
{ {
assert(m_display != NULL); assert(m_display != NULL);
@ -202,8 +188,7 @@ void CXWindowsSecondaryScreen::onMouseUp(ButtonID button)
::XSync(m_display, False); ::XSync(m_display, False);
} }
void CXWindowsSecondaryScreen::onMouseMove( void CXWindowsSecondaryScreen::mouseMove(SInt32 x, SInt32 y)
SInt32 x, SInt32 y)
{ {
assert(m_display != NULL); assert(m_display != NULL);
@ -213,7 +198,7 @@ void CXWindowsSecondaryScreen::onMouseMove(
::XSync(m_display, False); ::XSync(m_display, False);
} }
void CXWindowsSecondaryScreen::onMouseWheel(SInt32) void CXWindowsSecondaryScreen::mouseWheel(SInt32)
{ {
assert(m_display != NULL); assert(m_display != NULL);

View File

@ -17,20 +17,18 @@ class CXWindowsSecondaryScreen : public ISecondaryScreen {
virtual void close(); virtual void close();
virtual void enter(SInt32 xAbsolute, SInt32 yAbsolute); virtual void enter(SInt32 xAbsolute, SInt32 yAbsolute);
virtual void leave(); virtual void leave();
virtual void warpCursor(SInt32 xAbsolute, SInt32 yAbsolute); virtual void keyDown(KeyID, KeyModifierMask);
virtual void onKeyDown(KeyID, KeyModifierMask); virtual void keyRepeat(KeyID, KeyModifierMask, SInt32 count);
virtual void onKeyRepeat(KeyID, KeyModifierMask, SInt32 count); virtual void keyUp(KeyID, KeyModifierMask);
virtual void onKeyUp(KeyID, KeyModifierMask); virtual void mouseDown(ButtonID);
virtual void onMouseDown(ButtonID); virtual void mouseUp(ButtonID);
virtual void onMouseUp(ButtonID); virtual void mouseMove(SInt32 xAbsolute, SInt32 yAbsolute);
virtual void onMouseMove(SInt32 xAbsolute, SInt32 yAbsolute); virtual void mouseWheel(SInt32 delta);
virtual void onMouseWheel(SInt32 delta);
virtual void getSize(SInt32* width, SInt32* height) const; virtual void getSize(SInt32* width, SInt32* height) const;
virtual SInt32 getJumpZoneSize() const; virtual SInt32 getJumpZoneSize() const;
private: private:
Cursor createBlankCursor(); Cursor createBlankCursor();
void warpCursorNoLock(SInt32 xAbsolute, SInt32 yAbsolute);
void eventThread(void*); void eventThread(void*);
KeyCode mapKey(KeyID, KeyModifierMask) const; KeyCode mapKey(KeyID, KeyModifierMask) const;
unsigned int mapButton(ButtonID button) const; unsigned int mapButton(ButtonID button) const;

View File

@ -30,19 +30,16 @@ class ISecondaryScreen : public IInterface {
// up input event simulation and hide the cursor. // up input event simulation and hide the cursor.
virtual void leave() = 0; virtual void leave() = 0;
// warp the cursor to the given position
virtual void warpCursor(SInt32 xAbsolute, SInt32 yAbsolute) = 0;
// keyboard input simulation // keyboard input simulation
virtual void onKeyDown(KeyID, KeyModifierMask) = 0; virtual void keyDown(KeyID, KeyModifierMask) = 0;
virtual void onKeyRepeat(KeyID, KeyModifierMask, SInt32 count) = 0; virtual void keyRepeat(KeyID, KeyModifierMask, SInt32 count) = 0;
virtual void onKeyUp(KeyID, KeyModifierMask) = 0; virtual void keyUp(KeyID, KeyModifierMask) = 0;
// mouse input simulation // mouse input simulation
virtual void onMouseDown(ButtonID) = 0; virtual void mouseDown(ButtonID) = 0;
virtual void onMouseUp(ButtonID) = 0; virtual void mouseUp(ButtonID) = 0;
virtual void onMouseMove(SInt32 xAbsolute, SInt32 yAbsolute) = 0; virtual void mouseMove(SInt32 xAbsolute, SInt32 yAbsolute) = 0;
virtual void onMouseWheel(SInt32 delta) = 0; virtual void mouseWheel(SInt32 delta) = 0;
/* /*
// set the screen's clipboard contents. this is usually called // set the screen's clipboard contents. this is usually called
@ -50,10 +47,10 @@ class ISecondaryScreen : public IInterface {
virtual void setClipboard(const IClipboard*) = 0; virtual void setClipboard(const IClipboard*) = 0;
// show or hide the screen saver // show or hide the screen saver
virtual void onScreenSaver(bool show) = 0; virtual void screenSaver(bool show) = 0;
// clipboard input // clipboard input
virtual void onClipboardChanged() = 0; virtual void clipboardChanged() = 0;
*/ */
// accessors // accessors