This repository has been archived by the owner. It is now read-only.
Permalink
Please sign in to comment.
Showing
with
14 additions
and 244 deletions.
- +0 −19 src/gui/src/MainWindow.cpp
- +14 −42 src/lib/platform/MSWindowsScreen.cpp
- +0 −9 src/lib/server/Server.cpp
- +0 −13 src/lib/synergy/ArgParser.cpp
- +0 −53 src/lib/synergy/DpiHelper.cpp
- +0 −38 src/lib/synergy/DpiHelper.h
- +0 −70 src/test/unittests/synergy/DpiHelperTests.cpp
| @@ -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; | ||
| -}; |
| @@ -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); | ||
| -} |
0 comments on commit
cf397a0