faked escape key down and up then a left mouse button up in CServer when isSwitchOkay return true.

removed the assertions in CScreen so server screen can fake input event as well.
This commit is contained in:
jerry 2013-09-23 15:31:34 +00:00
parent f6ecf9322c
commit 57db3da6f3
3 changed files with 13 additions and 16 deletions

View File

@ -359,7 +359,6 @@ CMSWindowsScreen::leave()
forceShowCursor(); forceShowCursor();
if (m_draggingStarted) { if (m_draggingStarted) {
fakeMouseButton(kButtonLeft, false);
m_draggingStarted = false; m_draggingStarted = false;
} }

View File

@ -1741,6 +1741,11 @@ CServer::onMouseMovePrimary(SInt32 x, SInt32 y)
// should we switch or not? // should we switch or not?
if (isSwitchOkay(newScreen, dir, x, y, xc, yc)) { if (isSwitchOkay(newScreen, dir, x, y, xc, yc)) {
if (m_screen->getDraggingStarted() && m_active != newScreen) { if (m_screen->getDraggingStarted() && m_active != newScreen) {
// fake a escape key down and up then left mouse button up
m_screen->keyDown(kKeyEscape, 8192, 1);
m_screen->keyUp(kKeyEscape, 8192, 1);
m_screen->mouseUp(kButtonLeft);
CString& dragFileList = m_screen->getDraggingFileDir(); CString& dragFileList = m_screen->getDraggingFileDir();
size_t size = dragFileList.size() + 1; size_t size = dragFileList.size() + 1;
char* fileList = new char[size]; char* fileList = new char[size];

View File

@ -186,8 +186,6 @@ CScreen::screensaver(bool activate)
void void
CScreen::keyDown(KeyID id, KeyModifierMask mask, KeyButton button) CScreen::keyDown(KeyID id, KeyModifierMask mask, KeyButton button)
{ {
assert(!m_isPrimary || m_fakeInput);
// check for ctrl+alt+del emulation // check for ctrl+alt+del emulation
if (id == kKeyDelete && if (id == kKeyDelete &&
(mask & (KeyModifierControl | KeyModifierAlt)) == (mask & (KeyModifierControl | KeyModifierAlt)) ==
@ -211,21 +209,18 @@ CScreen::keyRepeat(KeyID id,
void void
CScreen::keyUp(KeyID, KeyModifierMask, KeyButton button) CScreen::keyUp(KeyID, KeyModifierMask, KeyButton button)
{ {
assert(!m_isPrimary || m_fakeInput);
m_screen->fakeKeyUp(button); m_screen->fakeKeyUp(button);
} }
void void
CScreen::mouseDown(ButtonID button) CScreen::mouseDown(ButtonID button)
{ {
assert(!m_isPrimary);
m_screen->fakeMouseButton(button, true); m_screen->fakeMouseButton(button, true);
} }
void void
CScreen::mouseUp(ButtonID button) CScreen::mouseUp(ButtonID button)
{ {
assert(!m_isPrimary);
m_screen->fakeMouseButton(button, false); m_screen->fakeMouseButton(button, false);
} }
@ -372,16 +367,14 @@ CScreen::isLockedToScreen() const
{ {
// check for pressed mouse buttons // check for pressed mouse buttons
// HACK: commented out as it breaks new drag drop feature // HACK: commented out as it breaks new drag drop feature
// UInt32 buttonID = 0; UInt32 buttonID = 0;
// if (m_screen->isAnyMouseButtonDown(buttonID)) { if (m_screen->isAnyMouseButtonDown(buttonID)) {
// LOG((CLOG_DEBUG "locked by mouse buttonID: %d", buttonID)); if (buttonID != kButtonLeft) {
// if (buttonID == kButtonLeft) { LOG((CLOG_DEBUG "locked by mouse buttonID: %d", buttonID));
// // TODO: fake esc key down and up }
// //m_screen->fakeMouseButton(buttonID, false);
// } return (buttonID == kButtonLeft) ? false : true;
// }
// return (buttonID == kButtonLeft) ? false : true;
// }
// not locked // not locked
return false; return false;