This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge branch 'issue5186-different-dpi' into v1.8.6

  • Loading branch information...
Jerry (Xinyu Hou)
Jerry (Xinyu Hou) committed Nov 3, 2016
2 parents 7ce6905 + b8233fc commit a279348cf9acac924e872c4dc59e80208d81d6a4
View
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" manifestVersion="1.0">
- <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
- <application>
- <!-- Windows 7 -->
- <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
- </application>
- </compatibility>
- <asmv3:application>
- <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
- <dpiAware>true</dpiAware>
- </asmv3:windowsSettings>
- </asmv3:application>
-</assembly>
-
@@ -60,15 +60,6 @@ add_executable(synergyc ${sources})
target_link_libraries(synergyc
arch base client common io mt net ipc platform server synergy ${libs} ${OPENSSL_LIBS})
-if (WIN32)
- ADD_CUSTOM_COMMAND(
- TARGET synergyc
- POST_BUILD
- COMMAND "mt.exe" -manifest \"${CMAKE_SOURCE_DIR}\\res\\dpiaware.manifest\" -inputresource:\"$<TARGET_FILE:synergyc>\"\;\#1 -outputresource:\"$<TARGET_FILE:synergyc>\"\;\#1
- COMMENT "Adding display aware manifest..."
- )
-endif()
-
if (CONF_CPACK)
install(TARGETS
synergyc
@@ -37,15 +37,6 @@ endif()
target_link_libraries(synergyd
arch base common io ipc mt net platform synergy shared ${libs} ${OPENSSL_LIBS})
-if (WIN32)
- ADD_CUSTOM_COMMAND(
- TARGET synergyd
- POST_BUILD
- COMMAND "mt.exe" -manifest \"${CMAKE_SOURCE_DIR}\\res\\dpiaware.manifest\" -inputresource:\"$<TARGET_FILE:synergyd>\"\;\#1 -outputresource:\"$<TARGET_FILE:synergyd>\"\;\#1
- COMMENT "Adding display aware manifest..."
- )
-endif()
-
if (CONF_CPACK)
install(TARGETS
synergyd
@@ -60,15 +60,6 @@ add_executable(synergys ${sources})
target_link_libraries(synergys
arch base client common io mt net ipc platform server synergy ${libs} ${OPENSSL_LIBS})
-if (WIN32)
- ADD_CUSTOM_COMMAND(
- TARGET synergys
- POST_BUILD
- COMMAND "mt.exe" -manifest \"${CMAKE_SOURCE_DIR}\\res\\dpiaware.manifest\" -inputresource:\"$<TARGET_FILE:synergys>\"\;\#1 -outputresource:\"$<TARGET_FILE:synergys>\"\;\#1
- COMMENT "Adding display aware manifest..."
- )
-endif()
-
if (CONF_CPACK)
install(TARGETS
synergys
View
@@ -808,25 +808,6 @@ bool MainWindow::serverArgs(QStringList& args, QString& app)
args << "--serial-key" << appConfig().serialKey();
}
-#if defined(Q_OS_WIN)
- // pass in physical resolution and primary screen center
- // TODO: get this information in the core binary even when
- // high DPI is used
- int height = QApplication::desktop()->height();
- int width = QApplication::desktop()->width();
-
- QRect rec = QApplication::desktop()->screenGeometry();
- int heightCenter = rec.height() / 2;
- int widthCenter = rec.width() / 2;
-
- appendLogDebug(tr("screen resolution: %1 %2 primary screen center: %3 %4")
- .arg(width).arg(height).arg(widthCenter).arg(heightCenter));
-
- args << "--res-w" << QString::number(width);
- args << "--res-h" << QString::number(height);
- args << "--prm-wc" << QString::number(widthCenter);
- args << "--prm-hc" << QString::number(heightCenter);
- #endif
return true;
}
@@ -31,7 +31,6 @@
#include "synergy/App.h"
#include "synergy/ArgsBase.h"
#include "synergy/ClientApp.h"
-#include "synergy/DpiHelper.h"
#include "mt/Lock.h"
#include "mt/Thread.h"
#include "arch/win32/ArchMiscWindows.h"
@@ -105,7 +104,6 @@ MSWindowsScreen::MSWindowsScreen(
m_xCenter(0), m_yCenter(0),
m_multimon(false),
m_xCursor(0), m_yCursor(0),
- m_xFractionalMove(0.0f), m_yFractionalMove(0.0f),
m_sequenceNumber(0),
m_mark(0),
m_markReceived(0),
@@ -146,10 +144,6 @@ MSWindowsScreen::MSWindowsScreen(
stopOnDeskSwitch);
m_keyState = new MSWindowsKeyState(m_desks, getEventTarget(), m_events);
- DpiHelper::calculateDpi(
- GetSystemMetrics(SM_CXVIRTUALSCREEN),
- GetSystemMetrics(SM_CYVIRTUALSCREEN));
-
updateScreenShape();
m_class = createWindowClass();
m_window = createWindow(m_class, "Synergy");
@@ -348,8 +342,7 @@ MSWindowsScreen::leave()
// warp to center
LOG((CLOG_DEBUG1 "warping cursor to center: %+d, %+d", m_xCenter, m_yCenter));
- float dpi = DpiHelper::getDpi();
- warpCursor(m_xCenter / dpi, m_yCenter / dpi);
+ warpCursor(m_xCenter, m_yCenter);
// disable special key sequences on win95 family
enableSpecialKeys(false);
@@ -576,21 +569,6 @@ void MSWindowsScreen::saveMousePosition(SInt32 x, SInt32 y) {
LOG((CLOG_DEBUG5 "saved mouse position for next delta: %+d,%+d", x,y));
}
-void MSWindowsScreen::accumulateFractionalMove(float x, float y, SInt32& intX, SInt32& intY)
-{
- // Accumulate together the move into the running total
- m_xFractionalMove += x;
- m_yFractionalMove += y;
-
- // Return the integer part
- intX = (SInt32)m_xFractionalMove;
- intY = (SInt32)m_yFractionalMove;
-
- // And keep only the fractional part
- m_xFractionalMove -= intX;
- m_yFractionalMove -= intY;
-}
-
UInt32
MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
{
@@ -1369,20 +1347,10 @@ MSWindowsScreen::onMouseButton(WPARAM wParam, LPARAM lParam)
bool
MSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
{
- SInt32 originalMX = mx;
- SInt32 originalMY = my;
- float scaledMX = (float)mx;
- float scaledMY = (float)my;
-
- if (DpiHelper::s_dpiScaled) {
- scaledMX /= DpiHelper::getDpi();
- scaledMY /= DpiHelper::getDpi();
- }
-
// compute motion delta (relative to the last known
// mouse position)
- float x = scaledMX - m_xCursor;
- float y = scaledMY - m_yCursor;
+ SInt32 x = mx - m_xCursor;
+ SInt32 y = my - m_yCursor;
LOG((CLOG_DEBUG3
"mouse move - motion delta: %+d=(%+d - %+d),%+d=(%+d - %+d)",
@@ -1395,14 +1363,14 @@ MSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
}
// save position to compute delta of next motion
- saveMousePosition((SInt32)scaledMX, (SInt32)scaledMY);
+ saveMousePosition(mx, my);
if (m_isOnScreen) {
// motion on primary screen
sendEvent(
m_events->forIPrimaryScreen().motionOnPrimary(),
- MotionInfo::alloc(originalMX, originalMY));
+ MotionInfo::alloc(m_xCursor, m_yCursor));
if (m_buttons[kButtonLeft] == true && m_draggingStarted == false) {
m_draggingStarted = true;
@@ -1415,27 +1383,24 @@ MSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
// will always try to return to the original entry point on the
// secondary screen.
LOG((CLOG_DEBUG5 "warping server cursor to center: %+d,%+d", m_xCenter, m_yCenter));
- float dpi = DpiHelper::getDpi();
- warpCursorNoFlush(m_xCenter / dpi, m_yCenter / dpi);
+ warpCursorNoFlush(m_xCenter, m_yCenter);
// examine the motion. if it's about the distance
// from the center of the screen to an edge then
// it's probably a bogus motion that we want to
// ignore (see warpCursorNoFlush() for a further
// description).
static SInt32 bogusZoneSize = 10;
- if (-x + bogusZoneSize > (m_xCenter - m_x) / dpi ||
- x + bogusZoneSize > (m_x + m_w - m_xCenter) / dpi ||
- -y + bogusZoneSize > (m_yCenter - m_y) / dpi ||
- y + bogusZoneSize > (m_y + m_h - m_yCenter) / dpi) {
+ if (-x + bogusZoneSize > m_xCenter - m_x ||
+ x + bogusZoneSize > m_x + m_w - m_xCenter ||
+ -y + bogusZoneSize > m_yCenter - m_y ||
+ y + bogusZoneSize > m_y + m_h - m_yCenter) {
LOG((CLOG_DEBUG "dropped bogus delta motion: %+d,%+d", x, y));
}
else {
// send motion
- SInt32 ix, iy;
- accumulateFractionalMove(x, y, ix, iy);
- sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), MotionInfo::alloc(ix, iy));
+ sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), MotionInfo::alloc(x, y));
}
}
@@ -1623,26 +1588,13 @@ void
MSWindowsScreen::updateScreenShape()
{
// get shape and center
- if (DpiHelper::s_dpiScaled) {
- // use the original resolution size for width and height
- m_w = (SInt32)DpiHelper::s_resolutionWidth;
- m_h = (SInt32)DpiHelper::s_resolutionHeight;
-
- // calculate center position according to the original size
- m_xCenter = (SInt32)DpiHelper::s_primaryWidthCenter;
- m_yCenter = (SInt32)DpiHelper::s_primaryHeightCenter;
- }
- else {
- m_w = GetSystemMetrics(SM_CXVIRTUALSCREEN);
- m_h = GetSystemMetrics(SM_CYVIRTUALSCREEN);
-
- m_xCenter = GetSystemMetrics(SM_CXSCREEN) >> 1;
- m_yCenter = GetSystemMetrics(SM_CYSCREEN) >> 1;
- }
-
- // get position
+ m_w = GetSystemMetrics(SM_CXVIRTUALSCREEN);
+ m_h = GetSystemMetrics(SM_CYVIRTUALSCREEN);
m_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
m_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
+ m_xCenter = GetSystemMetrics(SM_CXSCREEN) >> 1;
+ m_yCenter = GetSystemMetrics(SM_CYSCREEN) >> 1;
+
// check for multiple monitors
m_multimon = (m_w != GetSystemMetrics(SM_CXSCREEN) ||
m_h != GetSystemMetrics(SM_CYSCREEN));
@@ -216,10 +216,6 @@ class MSWindowsScreen : public PlatformScreen {
// save last position of mouse to compute next delta movement
void saveMousePosition(SInt32 x, SInt32 y);
- // accumulates together a series of fractional pixel moves, each time
- // taking away and returning just the integer part of the running total.
- void accumulateFractionalMove(float x, float y, SInt32& intX, SInt32& intY);
-
// check if it is a modifier key repeating message
bool isModifierRepeat(KeyModifierMask oldState,
KeyModifierMask state, WPARAM wParam) const;
@@ -270,9 +266,6 @@ class MSWindowsScreen : public PlatformScreen {
// last mouse position
SInt32 m_xCursor, m_yCursor;
- // accumulated fractional pixel moves
- float m_xFractionalMove, m_yFractionalMove;
-
// last clipboard
UInt32 m_sequenceNumber;
@@ -33,7 +33,6 @@
#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"
@@ -2004,14 +2003,6 @@ Server::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
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, newX, newY, false);
}
@@ -23,7 +23,6 @@
#include "synergy/ClientArgs.h"
#include "synergy/ToolArgs.h"
#include "synergy/ArgsBase.h"
-#include "synergy/DpiHelper.h"
#include "base/Log.h"
#include "base/String.h"
@@ -58,18 +57,6 @@ ArgParser::parseServerArgs(ServerArgs& args, int argc, const char* const* argv)
// save configuration file path
args.m_configFile = argv[++i];
}
- else if (isArg(i, argc, argv, "", "--res-w", 1)) {
- DpiHelper::s_resolutionWidth = synergy::string::stringToSizeType(argv[++i]);
- }
- else if (isArg(i, argc, argv, "", "--res-h", 1)) {
- DpiHelper::s_resolutionHeight = synergy::string::stringToSizeType(argv[++i]);
- }
- else if (isArg(i, argc, argv, "", "--prm-wc", 1)) {
- DpiHelper::s_primaryWidthCenter = synergy::string::stringToSizeType(argv[++i]);
- }
- else if (isArg(i, argc, argv, "", "--prm-hc", 1)) {
- DpiHelper::s_primaryHeightCenter = synergy::string::stringToSizeType(argv[++i]);
- }
else if (isArg(i, argc, argv, "", "--serial-key", 1)) {
args.m_serial = SerialKey(argv[++i]);
}
@@ -332,6 +319,26 @@ ArgParser::parseDeprecatedArgs(int argc, const char* const* argv, int& i)
i++;
return true;
}
+ else if (isArg(i, argc, argv, NULL, "--res-w")) {
+ LOG((CLOG_NOTE "--res-w is deprecated"));
+ i++;
+ return true;
+ }
+ else if (isArg(i, argc, argv, NULL, "--res-h")) {
+ LOG((CLOG_NOTE "--res-h is deprecated"));
+ i++;
+ return true;
+ }
+ else if (isArg(i, argc, argv, NULL, "--prm-wc")) {
+ LOG((CLOG_NOTE "--prm-wc is deprecated"));
+ i++;
+ return true;
+ }
+ else if (isArg(i, argc, argv, NULL, "--prm-hc")) {
+ LOG((CLOG_NOTE "--prm-hc is deprecated"));
+ i++;
+ return true;
+ }
return false;
}
Oops, something went wrong.

0 comments on commit a279348

Please sign in to comment.