Fix high DPI breaking edge detection and mouse delta calculation #5030

This commit is contained in:
Jerry (Xinyu Hou) 2015-10-19 11:20:56 -07:00
parent 66335cd6f8
commit a09bfc5f07
4 changed files with 69 additions and 24 deletions

View file

@ -33,6 +33,7 @@
#include "synergy/KeyState.h"
#include "synergy/Screen.h"
#include "synergy/PacketStreamFilter.h"
#include "synergy/DpiHelper.h"
#include "net/TCPSocket.h"
#include "net/IDataSocket.h"
#include "net/IListenSocket.h"
@ -2000,8 +2001,18 @@ Server::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
m_sendFileThread = NULL;
}
SInt32 newX = m_x;
SInt32 newY = m_y;
if (DpiHelper::s_dpiScaled) {
// only scale if it's going back to server
if (newScreen->isPrimary()) {
newX = (SInt32)(newX / DpiHelper::getDpi());
newY = (SInt32)(newY / DpiHelper::getDpi());
}
}
// switch screens
switchScreen(newScreen, m_x, m_y, false);
switchScreen(newScreen, newX, newY, false);
}
else {
// same screen. clamp mouse to edge.