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();
if (m_draggingStarted) {
fakeMouseButton(kButtonLeft, false);
m_draggingStarted = false;
}

View File

@ -1741,6 +1741,11 @@ CServer::onMouseMovePrimary(SInt32 x, SInt32 y)
// should we switch or not?
if (isSwitchOkay(newScreen, dir, x, y, xc, yc)) {
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();
size_t size = dragFileList.size() + 1;
char* fileList = new char[size];

View File

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