Compare commits

..

14 Commits

Author SHA1 Message Date
Adrian Lucrèce Céleste
1a5eae46fe [Travis] bring up to date 2018-07-02 22:45:35 -04:00
walker0643
f65189190c Merge pull request #75 from debauchee/master
pull in recent patches from master
2018-06-30 18:51:49 -04:00
dc5dc25de7 screen settings dialog handles internationalized default name better
(ref #71)
2018-06-30 17:33:49 -04:00
walker0643
53ee9c7803 Merge pull request #64 from p12tic/osx-server-jumpy-scrolling
Improve precision of grabbed scroll events on OSX server
2018-06-30 16:40:10 -04:00
1f3a91e74e fix email in debian changelog 2018-06-30 16:32:05 -04:00
walker0643
99188fe24b Merge pull request #69 from p12tic/debian-add-fake-changelog
Add fake changelog so that debian package may be built (p
2018-06-30 16:30:32 -04:00
a956cad0da add patch from Gentoo packager to fix cmake issue (reported on Arch, too). ref #49 2018-06-30 13:44:34 -04:00
e88bc97e63 non-GUI build should not require bonjour headers 2018-06-30 13:26:18 -04:00
walker0643
f857354535 Merge pull request #68 from p12tic/linux-client-accumulate-small-scrolls
Accumulate scrolls less than supported scroll on XWindows (patch by p12tic)
2018-06-30 12:52:09 -04:00
Povilas Kanapickas
b570e57591 Add fake changelog so that debian package may be built 2018-06-21 01:13:41 +03:00
Povilas Kanapickas
76c39aaf4e Accumulate scrolls less than supported scroll on XWindows
This fixes barrier case #67 and synergy case #5670.
2018-06-21 00:50:08 +03:00
Povilas Kanapickas
a645e9a296 Improve precision of grabbed scroll events on OSX server
This is barrier issue #63, synergy issue #5672.
2018-06-21 00:13:40 +03:00
walker0643
3747ea51fd Merge pull request #48 from Johnnynator/master
use pkg-config for finding avahi include dir (patch by johnnynator)
2018-05-26 22:27:22 -04:00
John
ecb61f41dc use pkg-config for finding avahi include dir 2018-05-26 00:00:13 +02:00
12 changed files with 99 additions and 34 deletions

View File

@@ -1,10 +1,34 @@
language: cpp
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq libxtst-dev
- sudo apt-get install -qq qtdeclarative5-dev
- sudo apt-get install -qq libavahi-compat-libdnssd-dev
script: sh -x ./clean_build.sh
# skip install phase since we have a customized install package
# creation tool for each supported platform
matrix:
include:
- os: linux
sudo: false
dist: trusty
addons:
apt:
packages:
- libxtst-dev
- qtdeclarative5-dev
- libavahi-compat-libdnssd-dev
script: sh -x ./clean_build.sh
- os: osx
osx_image: xcode9
script:
- export COLUMNS=80
- curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci
- chmod +x ./macports-ci
- ./macports-ci install
- PATH="$PATH:/opt/local/bin"
- sudo port -N install qt5-qtbase openssl
- sh -x ./clean_build.sh
- os: osx
osx_image: xcode9
script:
- brew update
- brew install qt openssl
- sh -x ./clean_build.sh
install: true

View File

@@ -63,6 +63,7 @@ if (UNIX)
include (CheckIncludeFileCXX)
include (CheckSymbolExists)
include (CheckCSourceCompiles)
include (FindPkgConfig)
check_include_file_cxx (istream HAVE_ISTREAM)
check_include_file_cxx (ostream HAVE_OSTREAM)
@@ -162,6 +163,11 @@ if (UNIX)
include_directories("/usr/local/include" "/usr/local/include/avahi-compat-libdns_sd")
link_directories("/usr/local/lib")
endif()
if (${PKG_CONFIG_FOUND})
pkg_check_modules (AVAHI_COMPAT REQUIRED avahi-compat-libdns_sd)
include_directories (BEFORE SYSTEM ${AVAHI_COMPAT_INCLUDE_DIRS})
set (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${AVAHI_COMPAT_INCLUDE_DIRS}")
endif ()
set (XKBlib "X11/Xlib.h;X11/XKBlib.h")
set (CMAKE_EXTRA_INCLUDE_FILES "${XKBlib};X11/extensions/Xrandr.h")
@@ -187,7 +193,7 @@ if (UNIX)
message (FATAL_ERROR "Missing header: " ${XKBlib})
endif()
if (NOT HAVE_DNSSD)
if (BARRIER_BUILD_GUI AND NOT HAVE_DNSSD)
message (FATAL_ERROR "Missing header: dns_sd.h")
endif()

5
debian/changelog vendored Normal file
View File

@@ -0,0 +1,5 @@
barrier (2.1-1) unstable; urgency=low
* Initial release (Closes: #123456)
-- Debauchee Open Source Group <debauchee.oss@gmail.com> Sat, 01 Apr 2018 00:00:00 +0000

View File

@@ -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}")

View File

@@ -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),

View File

@@ -1,4 +1,4 @@
/*
/*
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)

View File

@@ -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);

View File

@@ -22,6 +22,7 @@
#include <QtCore>
#include <QtGui>
#include <QHeaderView>
ScreenSetupView::ScreenSetupView(QWidget* parent) :
QTableView(parent)

View File

@@ -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;

View File

@@ -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:

View File

@@ -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
{

View File

@@ -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;