Merge branch 'issue5186-different-dpi' into v1.8.6
This commit is contained in:
commit
a279348cf9
|
@ -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
|
target_link_libraries(synergyc
|
||||||
arch base client common io mt net ipc platform server synergy ${libs} ${OPENSSL_LIBS})
|
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)
|
if (CONF_CPACK)
|
||||||
install(TARGETS
|
install(TARGETS
|
||||||
synergyc
|
synergyc
|
||||||
|
|
|
@ -37,15 +37,6 @@ endif()
|
||||||
target_link_libraries(synergyd
|
target_link_libraries(synergyd
|
||||||
arch base common io ipc mt net platform synergy shared ${libs} ${OPENSSL_LIBS})
|
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)
|
if (CONF_CPACK)
|
||||||
install(TARGETS
|
install(TARGETS
|
||||||
synergyd
|
synergyd
|
||||||
|
|
|
@ -60,15 +60,6 @@ add_executable(synergys ${sources})
|
||||||
target_link_libraries(synergys
|
target_link_libraries(synergys
|
||||||
arch base client common io mt net ipc platform server synergy ${libs} ${OPENSSL_LIBS})
|
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)
|
if (CONF_CPACK)
|
||||||
install(TARGETS
|
install(TARGETS
|
||||||
synergys
|
synergys
|
||||||
|
|
|
@ -808,25 +808,6 @@ bool MainWindow::serverArgs(QStringList& args, QString& app)
|
||||||
args << "--serial-key" << appConfig().serialKey();
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "synergy/App.h"
|
#include "synergy/App.h"
|
||||||
#include "synergy/ArgsBase.h"
|
#include "synergy/ArgsBase.h"
|
||||||
#include "synergy/ClientApp.h"
|
#include "synergy/ClientApp.h"
|
||||||
#include "synergy/DpiHelper.h"
|
|
||||||
#include "mt/Lock.h"
|
#include "mt/Lock.h"
|
||||||
#include "mt/Thread.h"
|
#include "mt/Thread.h"
|
||||||
#include "arch/win32/ArchMiscWindows.h"
|
#include "arch/win32/ArchMiscWindows.h"
|
||||||
|
@ -105,7 +104,6 @@ MSWindowsScreen::MSWindowsScreen(
|
||||||
m_xCenter(0), m_yCenter(0),
|
m_xCenter(0), m_yCenter(0),
|
||||||
m_multimon(false),
|
m_multimon(false),
|
||||||
m_xCursor(0), m_yCursor(0),
|
m_xCursor(0), m_yCursor(0),
|
||||||
m_xFractionalMove(0.0f), m_yFractionalMove(0.0f),
|
|
||||||
m_sequenceNumber(0),
|
m_sequenceNumber(0),
|
||||||
m_mark(0),
|
m_mark(0),
|
||||||
m_markReceived(0),
|
m_markReceived(0),
|
||||||
|
@ -146,10 +144,6 @@ MSWindowsScreen::MSWindowsScreen(
|
||||||
stopOnDeskSwitch);
|
stopOnDeskSwitch);
|
||||||
m_keyState = new MSWindowsKeyState(m_desks, getEventTarget(), m_events);
|
m_keyState = new MSWindowsKeyState(m_desks, getEventTarget(), m_events);
|
||||||
|
|
||||||
DpiHelper::calculateDpi(
|
|
||||||
GetSystemMetrics(SM_CXVIRTUALSCREEN),
|
|
||||||
GetSystemMetrics(SM_CYVIRTUALSCREEN));
|
|
||||||
|
|
||||||
updateScreenShape();
|
updateScreenShape();
|
||||||
m_class = createWindowClass();
|
m_class = createWindowClass();
|
||||||
m_window = createWindow(m_class, "Synergy");
|
m_window = createWindow(m_class, "Synergy");
|
||||||
|
@ -348,8 +342,7 @@ MSWindowsScreen::leave()
|
||||||
|
|
||||||
// warp to center
|
// warp to center
|
||||||
LOG((CLOG_DEBUG1 "warping cursor to center: %+d, %+d", m_xCenter, m_yCenter));
|
LOG((CLOG_DEBUG1 "warping cursor to center: %+d, %+d", m_xCenter, m_yCenter));
|
||||||
float dpi = DpiHelper::getDpi();
|
warpCursor(m_xCenter, m_yCenter);
|
||||||
warpCursor(m_xCenter / dpi, m_yCenter / dpi);
|
|
||||||
|
|
||||||
// disable special key sequences on win95 family
|
// disable special key sequences on win95 family
|
||||||
enableSpecialKeys(false);
|
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));
|
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
|
UInt32
|
||||||
MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
|
MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
|
||||||
{
|
{
|
||||||
|
@ -1369,20 +1347,10 @@ MSWindowsScreen::onMouseButton(WPARAM wParam, LPARAM lParam)
|
||||||
bool
|
bool
|
||||||
MSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
|
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
|
// compute motion delta (relative to the last known
|
||||||
// mouse position)
|
// mouse position)
|
||||||
float x = scaledMX - m_xCursor;
|
SInt32 x = mx - m_xCursor;
|
||||||
float y = scaledMY - m_yCursor;
|
SInt32 y = my - m_yCursor;
|
||||||
|
|
||||||
LOG((CLOG_DEBUG3
|
LOG((CLOG_DEBUG3
|
||||||
"mouse move - motion delta: %+d=(%+d - %+d),%+d=(%+d - %+d)",
|
"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
|
// save position to compute delta of next motion
|
||||||
saveMousePosition((SInt32)scaledMX, (SInt32)scaledMY);
|
saveMousePosition(mx, my);
|
||||||
|
|
||||||
if (m_isOnScreen) {
|
if (m_isOnScreen) {
|
||||||
|
|
||||||
// motion on primary screen
|
// motion on primary screen
|
||||||
sendEvent(
|
sendEvent(
|
||||||
m_events->forIPrimaryScreen().motionOnPrimary(),
|
m_events->forIPrimaryScreen().motionOnPrimary(),
|
||||||
MotionInfo::alloc(originalMX, originalMY));
|
MotionInfo::alloc(m_xCursor, m_yCursor));
|
||||||
|
|
||||||
if (m_buttons[kButtonLeft] == true && m_draggingStarted == false) {
|
if (m_buttons[kButtonLeft] == true && m_draggingStarted == false) {
|
||||||
m_draggingStarted = true;
|
m_draggingStarted = true;
|
||||||
|
@ -1415,8 +1383,7 @@ MSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
|
||||||
// will always try to return to the original entry point on the
|
// will always try to return to the original entry point on the
|
||||||
// secondary screen.
|
// secondary screen.
|
||||||
LOG((CLOG_DEBUG5 "warping server cursor to center: %+d,%+d", m_xCenter, m_yCenter));
|
LOG((CLOG_DEBUG5 "warping server cursor to center: %+d,%+d", m_xCenter, m_yCenter));
|
||||||
float dpi = DpiHelper::getDpi();
|
warpCursorNoFlush(m_xCenter, m_yCenter);
|
||||||
warpCursorNoFlush(m_xCenter / dpi, m_yCenter / dpi);
|
|
||||||
|
|
||||||
// examine the motion. if it's about the distance
|
// examine the motion. if it's about the distance
|
||||||
// from the center of the screen to an edge then
|
// from the center of the screen to an edge then
|
||||||
|
@ -1424,18 +1391,16 @@ MSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
|
||||||
// ignore (see warpCursorNoFlush() for a further
|
// ignore (see warpCursorNoFlush() for a further
|
||||||
// description).
|
// description).
|
||||||
static SInt32 bogusZoneSize = 10;
|
static SInt32 bogusZoneSize = 10;
|
||||||
if (-x + bogusZoneSize > (m_xCenter - m_x) / dpi ||
|
if (-x + bogusZoneSize > m_xCenter - m_x ||
|
||||||
x + bogusZoneSize > (m_x + m_w - m_xCenter) / dpi ||
|
x + bogusZoneSize > m_x + m_w - m_xCenter ||
|
||||||
-y + bogusZoneSize > (m_yCenter - m_y) / dpi ||
|
-y + bogusZoneSize > m_yCenter - m_y ||
|
||||||
y + bogusZoneSize > (m_y + m_h - m_yCenter) / dpi) {
|
y + bogusZoneSize > m_y + m_h - m_yCenter) {
|
||||||
|
|
||||||
LOG((CLOG_DEBUG "dropped bogus delta motion: %+d,%+d", x, y));
|
LOG((CLOG_DEBUG "dropped bogus delta motion: %+d,%+d", x, y));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// send motion
|
// send motion
|
||||||
SInt32 ix, iy;
|
sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), MotionInfo::alloc(x, y));
|
||||||
accumulateFractionalMove(x, y, ix, iy);
|
|
||||||
sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), MotionInfo::alloc(ix, iy));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1623,26 +1588,13 @@ void
|
||||||
MSWindowsScreen::updateScreenShape()
|
MSWindowsScreen::updateScreenShape()
|
||||||
{
|
{
|
||||||
// get shape and center
|
// 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_w = GetSystemMetrics(SM_CXVIRTUALSCREEN);
|
||||||
m_h = GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
m_h = GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
||||||
|
|
||||||
m_xCenter = GetSystemMetrics(SM_CXSCREEN) >> 1;
|
|
||||||
m_yCenter = GetSystemMetrics(SM_CYSCREEN) >> 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get position
|
|
||||||
m_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
|
m_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
|
||||||
m_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
|
m_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
|
||||||
|
m_xCenter = GetSystemMetrics(SM_CXSCREEN) >> 1;
|
||||||
|
m_yCenter = GetSystemMetrics(SM_CYSCREEN) >> 1;
|
||||||
|
|
||||||
// check for multiple monitors
|
// check for multiple monitors
|
||||||
m_multimon = (m_w != GetSystemMetrics(SM_CXSCREEN) ||
|
m_multimon = (m_w != GetSystemMetrics(SM_CXSCREEN) ||
|
||||||
m_h != GetSystemMetrics(SM_CYSCREEN));
|
m_h != GetSystemMetrics(SM_CYSCREEN));
|
||||||
|
|
|
@ -216,10 +216,6 @@ private: // HACK
|
||||||
// save last position of mouse to compute next delta movement
|
// save last position of mouse to compute next delta movement
|
||||||
void saveMousePosition(SInt32 x, SInt32 y);
|
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
|
// check if it is a modifier key repeating message
|
||||||
bool isModifierRepeat(KeyModifierMask oldState,
|
bool isModifierRepeat(KeyModifierMask oldState,
|
||||||
KeyModifierMask state, WPARAM wParam) const;
|
KeyModifierMask state, WPARAM wParam) const;
|
||||||
|
@ -270,9 +266,6 @@ private:
|
||||||
// last mouse position
|
// last mouse position
|
||||||
SInt32 m_xCursor, m_yCursor;
|
SInt32 m_xCursor, m_yCursor;
|
||||||
|
|
||||||
// accumulated fractional pixel moves
|
|
||||||
float m_xFractionalMove, m_yFractionalMove;
|
|
||||||
|
|
||||||
// last clipboard
|
// last clipboard
|
||||||
UInt32 m_sequenceNumber;
|
UInt32 m_sequenceNumber;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include "synergy/KeyState.h"
|
#include "synergy/KeyState.h"
|
||||||
#include "synergy/Screen.h"
|
#include "synergy/Screen.h"
|
||||||
#include "synergy/PacketStreamFilter.h"
|
#include "synergy/PacketStreamFilter.h"
|
||||||
#include "synergy/DpiHelper.h"
|
|
||||||
#include "net/TCPSocket.h"
|
#include "net/TCPSocket.h"
|
||||||
#include "net/IDataSocket.h"
|
#include "net/IDataSocket.h"
|
||||||
#include "net/IListenSocket.h"
|
#include "net/IListenSocket.h"
|
||||||
|
@ -2004,14 +2003,6 @@ Server::onMouseMoveSecondary(SInt32 dx, SInt32 dy)
|
||||||
SInt32 newX = m_x;
|
SInt32 newX = m_x;
|
||||||
SInt32 newY = m_y;
|
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
|
// switch screens
|
||||||
switchScreen(newScreen, newX, newY, false);
|
switchScreen(newScreen, newX, newY, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include "synergy/ClientArgs.h"
|
#include "synergy/ClientArgs.h"
|
||||||
#include "synergy/ToolArgs.h"
|
#include "synergy/ToolArgs.h"
|
||||||
#include "synergy/ArgsBase.h"
|
#include "synergy/ArgsBase.h"
|
||||||
#include "synergy/DpiHelper.h"
|
|
||||||
#include "base/Log.h"
|
#include "base/Log.h"
|
||||||
#include "base/String.h"
|
#include "base/String.h"
|
||||||
|
|
||||||
|
@ -58,18 +57,6 @@ ArgParser::parseServerArgs(ServerArgs& args, int argc, const char* const* argv)
|
||||||
// save configuration file path
|
// save configuration file path
|
||||||
args.m_configFile = argv[++i];
|
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)) {
|
else if (isArg(i, argc, argv, "", "--serial-key", 1)) {
|
||||||
args.m_serial = SerialKey(argv[++i]);
|
args.m_serial = SerialKey(argv[++i]);
|
||||||
}
|
}
|
||||||
|
@ -332,6 +319,26 @@ ArgParser::parseDeprecatedArgs(int argc, const char* const* argv, int& i)
|
||||||
i++;
|
i++;
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
/*
|
|
||||||
* synergy -- mouse and keyboard sharing utility
|
|
||||||
* Copyright (C) 2015 Synergy Seamless Inc.
|
|
||||||
*
|
|
||||||
* This package is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* found in the file LICENSE that should have accompanied this file.
|
|
||||||
*
|
|
||||||
* This package is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "synergy/DpiHelper.h"
|
|
||||||
#include "base/Log.h"
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
size_t DpiHelper::s_dpi = kDefaultDpi;
|
|
||||||
bool DpiHelper::s_dpiScaled = false;
|
|
||||||
size_t DpiHelper::s_resolutionWidth = 0;
|
|
||||||
size_t DpiHelper::s_resolutionHeight = 0;
|
|
||||||
size_t DpiHelper::s_primaryWidthCenter = 0;
|
|
||||||
size_t DpiHelper::s_primaryHeightCenter = 0;
|
|
||||||
|
|
||||||
void DpiHelper::calculateDpi(size_t width, size_t height)
|
|
||||||
{
|
|
||||||
if (s_resolutionWidth == 0 ||
|
|
||||||
s_resolutionHeight == 0 ||
|
|
||||||
s_primaryWidthCenter == 0 ||
|
|
||||||
s_primaryHeightCenter == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t dpiTest1 = s_resolutionWidth * 100 / width;
|
|
||||||
size_t dpiTest2 = s_resolutionHeight * 100 / height;
|
|
||||||
|
|
||||||
if (dpiTest1 == dpiTest2) {
|
|
||||||
s_dpi = dpiTest1;
|
|
||||||
|
|
||||||
if (s_dpi != kDefaultDpi) {
|
|
||||||
s_dpiScaled = true;
|
|
||||||
|
|
||||||
LOG((CLOG_DEBUG "DPI: %d%%", s_dpi));
|
|
||||||
LOG((CLOG_DEBUG "physical resolution: %d, %d scaled resolution: %d, %d",
|
|
||||||
s_resolutionWidth, s_resolutionHeight, width, height));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
/*
|
|
||||||
* synergy -- mouse and keyboard sharing utility
|
|
||||||
* Copyright (C) 2015 Synergy Seamless Inc.
|
|
||||||
*
|
|
||||||
* This package is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* found in the file LICENSE that should have accompanied this file.
|
|
||||||
*
|
|
||||||
* This package is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "common/common.h"
|
|
||||||
|
|
||||||
class DpiHelper {
|
|
||||||
public:
|
|
||||||
enum EDpi {
|
|
||||||
kDefaultDpi = 100
|
|
||||||
};
|
|
||||||
|
|
||||||
static void calculateDpi(size_t width, size_t height);
|
|
||||||
static float getDpi() { return (float)(s_dpi / 100.0f); }
|
|
||||||
|
|
||||||
public:
|
|
||||||
static size_t s_dpi;
|
|
||||||
static bool s_dpiScaled;
|
|
||||||
static size_t s_resolutionWidth;
|
|
||||||
static size_t s_resolutionHeight;
|
|
||||||
static size_t s_primaryWidthCenter;
|
|
||||||
static size_t s_primaryHeightCenter;
|
|
||||||
};
|
|
|
@ -28,8 +28,23 @@
|
||||||
<ComponentGroupRef Id="ProductComponents" />
|
<ComponentGroupRef Id="ProductComponents" />
|
||||||
<ComponentGroupRef Id="OpenSslComponents" />
|
<ComponentGroupRef Id="OpenSslComponents" />
|
||||||
<MergeRef Id="CRT" />
|
<MergeRef Id="CRT" />
|
||||||
|
<ComponentRef Id="RegistryEntries" />
|
||||||
</Feature>
|
</Feature>
|
||||||
|
|
||||||
|
<DirectoryRef Id="TARGETDIR">
|
||||||
|
<Component Id="RegistryEntries" Guid="7CF3564D-1F8E-4D3D-9781-E1EE22D5BD67">
|
||||||
|
<RegistryKey Root="HKLM"
|
||||||
|
Key="Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"
|
||||||
|
Action="createAndRemoveOnUninstall">
|
||||||
|
<RegistryValue Type="string" Name="[INSTALLFOLDER]synergys.exe" Value="~ HIGHDPIAWARE WIN7RTM"/>
|
||||||
|
</RegistryKey>
|
||||||
|
|
||||||
|
<Condition>
|
||||||
|
<![CDATA[Installed OR (VersionNT >= 602)]]>
|
||||||
|
</Condition>
|
||||||
|
</Component>
|
||||||
|
</DirectoryRef>
|
||||||
|
|
||||||
<Icon Id="synergy.ico" SourceFile="$(var.ResPath)/synergy.ico"/>
|
<Icon Id="synergy.ico" SourceFile="$(var.ResPath)/synergy.ico"/>
|
||||||
|
|
||||||
<WixVariable Id="WixUILicenseRtf" Value="$(var.ResPath)\License.rtf" />
|
<WixVariable Id="WixUILicenseRtf" Value="$(var.ResPath)\License.rtf" />
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
/*
|
|
||||||
* synergy -- mouse and keyboard sharing utility
|
|
||||||
* Copyright (C) 2015 Synergy Seamless Inc.
|
|
||||||
*
|
|
||||||
* This package is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* found in the file LICENSE that should have accompanied this file.
|
|
||||||
*
|
|
||||||
* This package is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "synergy/DpiHelper.h"
|
|
||||||
|
|
||||||
#include "test/global/gtest.h"
|
|
||||||
|
|
||||||
void resetStaticVariables()
|
|
||||||
{
|
|
||||||
DpiHelper::s_resolutionWidth = 0;
|
|
||||||
DpiHelper::s_resolutionHeight = 0;
|
|
||||||
DpiHelper::s_primaryWidthCenter = 0;
|
|
||||||
DpiHelper::s_primaryHeightCenter = 0;
|
|
||||||
DpiHelper::s_dpi = DpiHelper::kDefaultDpi;
|
|
||||||
DpiHelper::s_dpiScaled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(DpiHelperTests, calculateDpi_samePhysicalAndVirtualResolutions_defaultDpi)
|
|
||||||
{
|
|
||||||
resetStaticVariables();
|
|
||||||
|
|
||||||
DpiHelper::s_resolutionWidth = 1920;
|
|
||||||
DpiHelper::s_resolutionHeight = 1080;
|
|
||||||
DpiHelper::s_primaryWidthCenter = 960;
|
|
||||||
DpiHelper::s_primaryHeightCenter = 540;
|
|
||||||
|
|
||||||
DpiHelper::calculateDpi(1920, 1080);
|
|
||||||
|
|
||||||
EXPECT_FALSE(DpiHelper::s_dpiScaled);
|
|
||||||
EXPECT_EQ(DpiHelper::kDefaultDpi, DpiHelper::s_dpi);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(DpiHelperTests, calculateDpi_differentPhysicalAndVirtualResolutions_scaledDpi)
|
|
||||||
{
|
|
||||||
resetStaticVariables();
|
|
||||||
|
|
||||||
DpiHelper::s_resolutionWidth = 1920;
|
|
||||||
DpiHelper::s_resolutionHeight = 1080;
|
|
||||||
DpiHelper::s_primaryWidthCenter = 960;
|
|
||||||
DpiHelper::s_primaryHeightCenter = 540;
|
|
||||||
|
|
||||||
DpiHelper::calculateDpi(960, 540);
|
|
||||||
|
|
||||||
EXPECT_TRUE(DpiHelper::s_dpiScaled);
|
|
||||||
EXPECT_EQ(200, DpiHelper::s_dpi);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(DpiHelperTests, calculateDpi_defaultStaticValues_defaultDpi)
|
|
||||||
{
|
|
||||||
resetStaticVariables();
|
|
||||||
|
|
||||||
DpiHelper::calculateDpi(1920, 1080);
|
|
||||||
|
|
||||||
EXPECT_FALSE(DpiHelper::s_dpiScaled);
|
|
||||||
EXPECT_EQ(DpiHelper::kDefaultDpi, DpiHelper::s_dpi);
|
|
||||||
}
|
|
Loading…
Reference in New Issue