aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2018-09-19 18:23:50 -0400
committerLibravatarUnit 193 <unit193@ubuntu.com>2018-09-19 18:23:50 -0400
commit68a36b3b67ec82cdd3f77e88e40d1043cbab5000 (patch)
tree6a23b540cdd5b17f4df92a850e2bc940d96d1cac /src
parent4a8bfd06e73d7f051f0b39e19e57616c7bbb8ad1 (diff)
New upstream version 2.1.2+dfsgupstream/2.1.2+dfsg
Diffstat (limited to 'src')
-rw-r--r--src/cmd/barrierc/CMakeLists.txt1
-rw-r--r--src/cmd/barrierc/barrierc.exe.manifest2
-rw-r--r--src/cmd/barriers/CMakeLists.txt1
-rw-r--r--src/cmd/barriers/barriers.exe.manifest2
-rw-r--r--src/gui/CMakeLists.txt5
-rw-r--r--src/gui/src/ActionDialog.cpp1
-rw-r--r--src/gui/src/NewScreenWidget.cpp2
-rw-r--r--src/gui/src/ScreenSettingsDialog.cpp21
-rw-r--r--src/gui/src/ScreenSetupView.cpp1
-rw-r--r--src/gui/src/SettingsDialogBase.ui2
-rw-r--r--src/gui/src/SslCertificate.cpp2
-rw-r--r--src/lib/arch/CMakeLists.txt4
-rw-r--r--src/lib/barrier/ServerApp.cpp2
-rw-r--r--src/lib/base/Unicode.cpp18
-rw-r--r--src/lib/platform/OSXScreen.h4
-rw-r--r--src/lib/platform/OSXScreen.mm8
-rw-r--r--src/lib/platform/XWindowsScreen.cpp30
-rw-r--r--src/lib/platform/XWindowsScreen.h11
18 files changed, 75 insertions, 42 deletions
diff --git a/src/cmd/barrierc/CMakeLists.txt b/src/cmd/barrierc/CMakeLists.txt
index 92276d2..0c08550 100644
--- a/src/cmd/barrierc/CMakeLists.txt
+++ b/src/cmd/barrierc/CMakeLists.txt
@@ -29,6 +29,7 @@ if (WIN32)
tb_idle.ico
tb_run.ico
tb_wait.ico
+ barrierc.exe.manifest
)
elseif (APPLE)
file(GLOB arch_headers "OSX*.h")
diff --git a/src/cmd/barrierc/barrierc.exe.manifest b/src/cmd/barrierc/barrierc.exe.manifest
new file mode 100644
index 0000000..7309fde
--- /dev/null
+++ b/src/cmd/barrierc/barrierc.exe.manifest
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"><security><requestedPrivileges><requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel></requestedPrivileges></security></trustInfo><application xmlns="urn:schemas-microsoft-com:asm.v3"><windowsSettings><dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware></windowsSettings></application></assembly> \ No newline at end of file
diff --git a/src/cmd/barriers/CMakeLists.txt b/src/cmd/barriers/CMakeLists.txt
index e1871ee..912421f 100644
--- a/src/cmd/barriers/CMakeLists.txt
+++ b/src/cmd/barriers/CMakeLists.txt
@@ -29,6 +29,7 @@ if (WIN32)
tb_idle.ico
tb_run.ico
tb_wait.ico
+ barriers.exe.manifest
)
elseif (APPLE)
file(GLOB arch_headers "OSX*.h")
diff --git a/src/cmd/barriers/barriers.exe.manifest b/src/cmd/barriers/barriers.exe.manifest
new file mode 100644
index 0000000..7309fde
--- /dev/null
+++ b/src/cmd/barriers/barriers.exe.manifest
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"><security><requestedPrivileges><requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel></requestedPrivileges></security></trustInfo><application xmlns="urn:schemas-microsoft-com:asm.v3"><windowsSettings><dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware></windowsSettings></application></assembly> \ No newline at end of file
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 9c90286..9eaa67e 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -22,7 +22,7 @@ add_executable (barrier WIN32
include_directories (./src)
-qt5_use_modules (barrier Core Widgets Network)
+target_link_libraries (barrier Qt5::Core Qt5::Widgets Qt5::Network)
target_compile_definitions (barrier PRIVATE -DBARRIER_VERSION_STAGE="${BARRIER_VERSION_STAGE}")
target_compile_definitions (barrier PRIVATE -DBARRIER_REVISION="${BARRIER_REVISION}")
@@ -36,8 +36,7 @@ if (WIN32)
elseif (APPLE)
find_library(APPSERVICES_LIB ApplicationServices)
target_link_libraries(barrier ${APPSERVICES_LIB})
-elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR
- ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+else()
target_link_libraries (barrier dns_sd)
endif()
diff --git a/src/gui/src/ActionDialog.cpp b/src/gui/src/ActionDialog.cpp
index e824ea3..3565cfb 100644
--- a/src/gui/src/ActionDialog.cpp
+++ b/src/gui/src/ActionDialog.cpp
@@ -25,6 +25,7 @@
#include <QtCore>
#include <QtGui>
+#include <QButtonGroup>
ActionDialog::ActionDialog(QWidget* parent, ServerConfig& config, Hotkey& hotkey, Action& action) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
diff --git a/src/gui/src/NewScreenWidget.cpp b/src/gui/src/NewScreenWidget.cpp
index 18379c0..0336249 100644
--- a/src/gui/src/NewScreenWidget.cpp
+++ b/src/gui/src/NewScreenWidget.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
diff --git a/src/gui/src/ScreenSettingsDialog.cpp b/src/gui/src/ScreenSettingsDialog.cpp
index 1e95a9c..4f294e2 100644
--- a/src/gui/src/ScreenSettingsDialog.cpp
+++ b/src/gui/src/ScreenSettingsDialog.cpp
@@ -23,6 +23,19 @@
#include <QtGui>
#include <QMessageBox>
+static const QRegExp ValidScreenName("[a-z0-9\\._-]{,255}", Qt::CaseInsensitive);
+
+static QString check_name_param(QString name)
+{
+ // after internationalization happens the default name "Unnamed" might
+ // be translated with spaces (or other chars). let's replace the spaces
+ // with dashes and just give up if that doesn't pass the regexp
+ name.replace(' ', '-');
+ if (ValidScreenName.exactMatch(name))
+ return name;
+ return "";
+}
+
ScreenSettingsDialog::ScreenSettingsDialog(QWidget* parent, Screen* pScreen) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
Ui::ScreenSettingsDialogBase(),
@@ -30,13 +43,11 @@ ScreenSettingsDialog::ScreenSettingsDialog(QWidget* parent, Screen* pScreen) :
{
setupUi(this);
- QRegExp validScreenName("[a-z0-9\\._-]{,255}", Qt::CaseInsensitive);
-
- m_pLineEditName->setText(m_pScreen->name());
- m_pLineEditName->setValidator(new QRegExpValidator(validScreenName, m_pLineEditName));
+ m_pLineEditName->setText(check_name_param(m_pScreen->name()));
+ m_pLineEditName->setValidator(new QRegExpValidator(ValidScreenName, m_pLineEditName));
m_pLineEditName->selectAll();
- m_pLineEditAlias->setValidator(new QRegExpValidator(validScreenName, m_pLineEditName));
+ m_pLineEditAlias->setValidator(new QRegExpValidator(ValidScreenName, m_pLineEditName));
for (int i = 0; i < m_pScreen->aliases().count(); i++)
new QListWidgetItem(m_pScreen->aliases()[i], m_pListAliases);
diff --git a/src/gui/src/ScreenSetupView.cpp b/src/gui/src/ScreenSetupView.cpp
index e42ae17..46e7099 100644
--- a/src/gui/src/ScreenSetupView.cpp
+++ b/src/gui/src/ScreenSetupView.cpp
@@ -22,6 +22,7 @@
#include <QtCore>
#include <QtGui>
+#include <QHeaderView>
ScreenSetupView::ScreenSetupView(QWidget* parent) :
QTableView(parent)
diff --git a/src/gui/src/SettingsDialogBase.ui b/src/gui/src/SettingsDialogBase.ui
index 432ec0d..d75c18c 100644
--- a/src/gui/src/SettingsDialogBase.ui
+++ b/src/gui/src/SettingsDialogBase.ui
@@ -167,7 +167,7 @@
<item row="1" column="0">
<widget class="QLabel" name="m_pLabel_21">
<property name="text">
- <string>&amp;Interface:</string>
+ <string>&amp;Address:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditInterface</cstring>
diff --git a/src/gui/src/SslCertificate.cpp b/src/gui/src/SslCertificate.cpp
index 9b31c5d..80fdfc2 100644
--- a/src/gui/src/SslCertificate.cpp
+++ b/src/gui/src/SslCertificate.cpp
@@ -121,7 +121,7 @@ void SslCertificate::generateCertificate()
// private key
arguments.append("-newkey");
- arguments.append("rsa:1024");
+ arguments.append("rsa:2048");
QDir sslDir(sslDirPath);
if (!sslDir.exists()) {
diff --git a/src/lib/arch/CMakeLists.txt b/src/lib/arch/CMakeLists.txt
index 113cdd9..db92634 100644
--- a/src/lib/arch/CMakeLists.txt
+++ b/src/lib/arch/CMakeLists.txt
@@ -41,7 +41,5 @@ add_library(arch STATIC ${sources})
if (UNIX)
target_link_libraries(arch ${libs})
- if (NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
- target_link_libraries(arch dl)
- endif()
+ target_link_libraries(arch ${CMAKE_DL_LIBS})
endif()
diff --git a/src/lib/barrier/ServerApp.cpp b/src/lib/barrier/ServerApp.cpp
index 6d8d7cd..ff98cc1 100644
--- a/src/lib/barrier/ServerApp.cpp
+++ b/src/lib/barrier/ServerApp.cpp
@@ -145,7 +145,7 @@ ServerApp::help()
<< std::endl
<< "If no configuration file pathname is provided then the first of the" << std::endl
<< "following to load successfully sets the configuration:" << std::endl
- << " " << PathUtilities::concat(DataDirectories::profile(), SYS_CONFIG_NAME) << std::endl
+ << " " << PathUtilities::concat(DataDirectories::profile(), USR_CONFIG_NAME) << std::endl
<< " " << PathUtilities::concat(DataDirectories::systemconfig(), SYS_CONFIG_NAME) << std::endl;
LOG((CLOG_PRINT "%s", buffer.str().c_str()));
diff --git a/src/lib/base/Unicode.cpp b/src/lib/base/Unicode.cpp
index 6a077e7..90a166f 100644
--- a/src/lib/base/Unicode.cpp
+++ b/src/lib/base/Unicode.cpp
@@ -628,25 +628,25 @@ Unicode::fromUTF8(const UInt8*& data, UInt32& n)
case 4:
c = ((static_cast<UInt32>(data[0]) & 0x07) << 18) |
((static_cast<UInt32>(data[1]) & 0x3f) << 12) |
- ((static_cast<UInt32>(data[1]) & 0x3f) << 6) |
- ((static_cast<UInt32>(data[1]) & 0x3f) );
+ ((static_cast<UInt32>(data[2]) & 0x3f) << 6) |
+ ((static_cast<UInt32>(data[3]) & 0x3f) );
break;
case 5:
c = ((static_cast<UInt32>(data[0]) & 0x03) << 24) |
((static_cast<UInt32>(data[1]) & 0x3f) << 18) |
- ((static_cast<UInt32>(data[1]) & 0x3f) << 12) |
- ((static_cast<UInt32>(data[1]) & 0x3f) << 6) |
- ((static_cast<UInt32>(data[1]) & 0x3f) );
+ ((static_cast<UInt32>(data[2]) & 0x3f) << 12) |
+ ((static_cast<UInt32>(data[3]) & 0x3f) << 6) |
+ ((static_cast<UInt32>(data[4]) & 0x3f) );
break;
case 6:
c = ((static_cast<UInt32>(data[0]) & 0x01) << 30) |
((static_cast<UInt32>(data[1]) & 0x3f) << 24) |
- ((static_cast<UInt32>(data[1]) & 0x3f) << 18) |
- ((static_cast<UInt32>(data[1]) & 0x3f) << 12) |
- ((static_cast<UInt32>(data[1]) & 0x3f) << 6) |
- ((static_cast<UInt32>(data[1]) & 0x3f) );
+ ((static_cast<UInt32>(data[2]) & 0x3f) << 18) |
+ ((static_cast<UInt32>(data[3]) & 0x3f) << 12) |
+ ((static_cast<UInt32>(data[4]) & 0x3f) << 6) |
+ ((static_cast<UInt32>(data[5]) & 0x3f) );
break;
default:
diff --git a/src/lib/platform/OSXScreen.h b/src/lib/platform/OSXScreen.h
index 27cb7df..6178529 100644
--- a/src/lib/platform/OSXScreen.h
+++ b/src/lib/platform/OSXScreen.h
@@ -144,10 +144,10 @@ private:
ButtonID mapMacButtonToBarrier(UInt16) const;
// map mac scroll wheel value to a barrier scroll wheel value
- SInt32 mapScrollWheelToBarrier(SInt32) const;
+ SInt32 mapScrollWheelToBarrier(float) const;
// map barrier scroll wheel value to a mac scroll wheel value
- SInt32 mapScrollWheelFromBarrier(SInt32) const;
+ SInt32 mapScrollWheelFromBarrier(float) const;
// get the current scroll wheel speed
double getScrollSpeed() const;
diff --git a/src/lib/platform/OSXScreen.mm b/src/lib/platform/OSXScreen.mm
index 1d80521..1e0268e 100644
--- a/src/lib/platform/OSXScreen.mm
+++ b/src/lib/platform/OSXScreen.mm
@@ -1421,7 +1421,7 @@ OSXScreen::mapMacButtonToBarrier(UInt16 macButton) const
}
SInt32
-OSXScreen::mapScrollWheelToBarrier(SInt32 x) const
+OSXScreen::mapScrollWheelToBarrier(float x) const
{
// return accelerated scrolling but not exponentially scaled as it is
// on the mac.
@@ -1430,7 +1430,7 @@ OSXScreen::mapScrollWheelToBarrier(SInt32 x) const
}
SInt32
-OSXScreen::mapScrollWheelFromBarrier(SInt32 x) const
+OSXScreen::mapScrollWheelFromBarrier(float x) const
{
// use server's acceleration with a little boost since other platforms
// take one wheel step as a larger step than the mac does.
@@ -1948,9 +1948,9 @@ OSXScreen::handleCGInputEvent(CGEventTapProxy proxy,
break;
case kCGEventScrollWheel:
screen->onMouseWheel(screen->mapScrollWheelToBarrier(
- CGEventGetIntegerValueField(event, kCGScrollWheelEventDeltaAxis2)),
+ CGEventGetIntegerValueField(event, kCGScrollWheelEventFixedPtDeltaAxis2) / 65536.0f),
screen->mapScrollWheelToBarrier(
- CGEventGetIntegerValueField(event, kCGScrollWheelEventDeltaAxis1)));
+ CGEventGetIntegerValueField(event, kCGScrollWheelEventFixedPtDeltaAxis1) / 65536.0f));
break;
case kCGEventKeyDown:
case kCGEventKeyUp:
diff --git a/src/lib/platform/XWindowsScreen.cpp b/src/lib/platform/XWindowsScreen.cpp
index 581c911..2846412 100644
--- a/src/lib/platform/XWindowsScreen.cpp
+++ b/src/lib/platform/XWindowsScreen.cpp
@@ -99,6 +99,7 @@ XWindowsScreen::XWindowsScreen(
IEventQueue* events) :
m_isPrimary(isPrimary),
m_mouseScrollDelta(mouseScrollDelta),
+ m_accumulatedScroll(0),
m_display(NULL),
m_root(None),
m_window(None),
@@ -865,9 +866,11 @@ XWindowsScreen::fakeMouseWheel(SInt32, SInt32 yDelta) const
return;
}
- // choose button depending on rotation direction
- const unsigned int xButton = mapButtonToX(static_cast<ButtonID>(
- (yDelta >= 0) ? -1 : -2));
+ int numEvents = accumulateMouseScroll(yDelta);
+
+ // choose button depending on rotation direction
+ const unsigned int xButton = mapButtonToX(static_cast<ButtonID>(
+ (numEvents >= 0) ? -1 : -2));
if (xButton == 0) {
// If we get here, then the XServer does not support the scroll
// wheel buttons, so send PageUp/PageDown keystrokes instead.
@@ -886,20 +889,14 @@ XWindowsScreen::fakeMouseWheel(SInt32, SInt32 yDelta) const
return;
}
- // now use absolute value of delta
- if (yDelta < 0) {
- yDelta = -yDelta;
- }
-
- if (yDelta < m_mouseScrollDelta) {
- LOG((CLOG_WARN "Wheel scroll delta (%d) smaller than threshold (%d)", yDelta, m_mouseScrollDelta));
- }
+ numEvents = std::abs(numEvents);
// send as many clicks as necessary
- for (; yDelta >= m_mouseScrollDelta; yDelta -= m_mouseScrollDelta) {
+ for (; numEvents > 0; numEvents--) {
XTestFakeButtonEvent(m_display, xButton, True, CurrentTime);
XTestFakeButtonEvent(m_display, xButton, False, CurrentTime);
}
+
XFlush(m_display);
}
@@ -1643,6 +1640,15 @@ XWindowsScreen::onMouseMove(const XMotionEvent& xmotion)
}
}
+int
+XWindowsScreen::accumulateMouseScroll(SInt32 yDelta) const
+{
+ m_accumulatedScroll += yDelta;
+ int numEvents = m_accumulatedScroll / m_mouseScrollDelta;
+ m_accumulatedScroll -= numEvents * m_mouseScrollDelta;
+ return numEvents;
+}
+
Cursor
XWindowsScreen::createBlankCursor() const
{
diff --git a/src/lib/platform/XWindowsScreen.h b/src/lib/platform/XWindowsScreen.h
index 35f9368..a2e3495 100644
--- a/src/lib/platform/XWindowsScreen.h
+++ b/src/lib/platform/XWindowsScreen.h
@@ -136,6 +136,10 @@ private:
void onMouseRelease(const XButtonEvent&);
void onMouseMove(const XMotionEvent&);
+ // Returns the number of scroll events needed after the current delta has
+ // been taken into account
+ int accumulateMouseScroll(SInt32 yDelta) const;
+
bool detectXI2();
#ifdef HAVE_XI2
void selectXIRawMotion();
@@ -172,8 +176,15 @@ private:
// true if screen is being used as a primary screen, false otherwise
bool m_isPrimary;
+
+ // The size of a smallest supported scroll event, in points
int m_mouseScrollDelta;
+ // Accumulates scrolls of less than m_mouseScrollDelta across multiple
+ // scroll events. We dispatch a scroll event whenever the accumulated scroll
+ // becomes larger than m_mouseScrollDelta
+ mutable int m_accumulatedScroll;
+
Display* m_display;
Window m_root;
Window m_window;