Compare commits

..

18 Commits

Author SHA1 Message Date
Andrew Nelless
b70b8e0fc4 Merge pull request #6276 from symless/issue6267-linux-switch
#6267 Stop detecting mouse movement for local input
2018-03-19 11:25:17 +00:00
Andrew Nelless
47137952f4 Revert "#4288 Remove auto Alt+Printscreen on Windows"
This reverts commit 3d3b7ca881.
2018-03-15 11:27:26 +00:00
Andrew Nelless
cd403562cd Merge pull request #6268 from erikd/topic/fixes
Minor fixes reported by AddressSanitizer
2018-03-14 13:36:29 +00:00
Andrew Nelless
2204828746 Make macOS screen shape detection code more robust 2018-03-14 13:35:42 +00:00
Erik de Castro Lopo
d2f6e56e53 Fix a memory leak 2018-03-12 10:41:31 +11:00
Erik de Castro Lopo
a0616a54be Update .gitignore
Ignore generated cmake files and directories.
2018-03-12 10:41:31 +11:00
Erik de Castro Lopo
d2a331c376 Fix compile error 2018-03-12 10:41:31 +11:00
Erik de Castro Lopo
cbd742ebb5 Fix -Wreorder warnings 2018-03-11 14:00:08 +11:00
Danielle Church
ffb0a5e1ed Initialize XWindowsScreen to offscreen for secondary displays (#6249)
XWindowsScreen::m_isOnScreen currently initializes to true for all
screens, meaning that every screen assumes it currently has control of
the shared mouse pointer when it starts up. For the primary (server)
screen, this is appropriate; when synergy starts, the local mouse should
still move the cursor on the local screen.

However, for secondary screens, this is incorrect; when the client
connects, it does _not_ have control of the shared mouse pointer, as the
server's mouse still moves the server's cursor.

This doesn't make much difference in most cases, as the secondary screen
behaves almost identically whether m_isOnScreen is true or false;
however, the local input detection code will only fire if the variable
is false, meaning that once the client connects, it first has to gain
the cursor and then lose it before it will detect local input.

Since the Synergy 2.0 service relies on synergy-core's local input
detection to determine when to switch to server mode, this means that a
Linux desktop can only ever claim primary if the shared cursor has at
some point moved to that screen, then left it.

This fixes the bug so that local input on a Linux desktop can reclaim
the primary role immediately after losing it.

Fixes #6248.
2018-03-09 15:27:56 +00:00
Jerry (Xinyu Hou)
ec3e0b2f71 #6267 Stop detecting mouse movement for local input 2018-03-08 16:40:23 +00:00
Jerry (Xinyu Hou)
ea5be67b27 #6266 Tweek log level for debugging display reconfiguration on Mac 2018-03-08 16:35:03 +00:00
Steve Williams
0f2c7099c5 Merge branch 'waldyrious-patch-1' into pr_cleanup_mar18_2 2018-03-05 13:44:37 +00:00
Steve Williams
3982e74d30 issue5648 - reapply int to float changes 2018-03-05 13:43:47 +00:00
Steve Williams
2006af9143 Merge branch 'patch-1' of https://github.com/waldyrious/synergy-core into waldyrious-patch-1 2018-03-05 11:50:32 +00:00
Andrew Nelless
cbfa585fa7 Merge pull request #6261 from rombert/feature/fix-romanian
Add support for latin 's' and 't' with comma below
2018-03-03 01:59:30 +00:00
Robert Munteanu
dfb8d15010 Add support for latin 's' and 't' with comma below
These codes were not supported at all, presumably due to being introduced
only in Unicode 3.0.
2018-02-24 23:13:43 +02:00
Nick Bolton
426e81fa71 Update README.md 2018-02-07 15:53:00 +00:00
Waldir Pimenta
3d440547ee synergy.conf.example: clarify comments
instead of saying apparently absolute statements
like "Foo is to the right of Bar",
use relative phrasing "for Bar, Foo is to the right".
This makes it clearer that the configuration file
does not describe a globally consistent spatial arrangement
but rather a set of areas that can be linked in arbitrary ways.
2018-01-23 14:26:30 +00:00
12 changed files with 78 additions and 46 deletions

4
.gitignore vendored
View File

@@ -2,6 +2,7 @@ config.h
.DS_Store
*.pyc
*.o
*.a
*~
\.*.swp
*build-gui-Desktop_Qt*
@@ -20,3 +21,6 @@ src/gui/.rnd
src/setup/win32/synergy.suo
CMakeCache.txt
CMakeLists.txt.user
Makefile
cmake_install.cmake
CMakeFiles/

View File

@@ -1,3 +1,3 @@
# Synergy Core
Open source core legacy component of Synergy, keyboard and mouse sharing software
This is the open source core component of Synergy, a keyboard and mouse sharing tool.

View File

@@ -4,28 +4,29 @@
# line. comments may appear anywhere the syntax permits.
section: screens
# three hosts named: moe, larry, and curly
# three hosts, named "moe", "larry", and "curly"
moe:
larry:
curly:
end
section: links
# larry is to the right of moe and curly is above moe
# for moe, larry is to the right and curly is above.
moe:
right = larry
up = curly
# moe is to the left of larry and curly is above larry.
# note that curly is above both moe and larry and moe
# and larry have a symmetric connection (they're in
# opposite directions of each other).
# for larry, moe is to the left and curly is also above.
# note that curly is above both moe and larry
# and that the connection between moe and larry is symmetric
# (i.e. they're in opposite directions of each other).
larry:
left = moe
up = curly
# larry is below curly. if you move up from moe and then
# down, you'll end up on larry.
# for curly, larry is below.
# if you move up from moe, and then move down,
# you'll end up on larry, not back at moe.
curly:
down = larry
end

View File

@@ -150,6 +150,7 @@ ArchMultithreadPosix::~ArchMultithreadPosix()
closeMutex(m_threadMutex);
s_instance = nullptr;
delete m_mainThread;
}
void

View File

@@ -175,7 +175,7 @@ App::initApp(int argc, const char** argv)
// this is a simple way to allow the core process to talk to X. this avoids
// the "WARNING: primary screen unavailable: unable to open screen" error.
// a better way would be to use xauth cookie and dbus to get access to X.
if (static_cast<int>((!(argsBase().m_runAsUid) == 0 != -1))) {
if (argsBase().m_runAsUid >= 0) {
if (setuid(argsBase().m_runAsUid) == 0) {
LOG((CLOG_DEBUG "process uid was set to: %d", argsBase().m_runAsUid));
}

View File

@@ -27,10 +27,6 @@ m_stopOnDeskSwitch(false),
#else
m_daemon(true), // backward compatibility for unix (daemon by default)
#endif
#if WINAPI_XWINDOWS
m_disableXInitThreads(false),
m_runAsUid(-1),
#endif
m_backend(false),
m_restartable(true),
m_noHooks(false),
@@ -39,6 +35,10 @@ m_logFilter(nullptr),
m_logFile(nullptr),
m_display(nullptr),
m_enableDragDrop(false),
#if WINAPI_XWINDOWS
m_disableXInitThreads(false),
m_runAsUid(-1),
#endif
m_shouldExit(false),
m_profileDirectory(""),
m_pluginDirectory("")

View File

@@ -1075,6 +1075,11 @@ MSWindowsKeyState::getKeyMap(synergy::KeyMap& keyMap)
}
}
// add alt+printscreen
if (m_buttonToVK[0x54u] == 0) {
m_buttonToVK[0x54u] = VK_SNAPSHOT;
}
// set virtual key to button table
if (activeLayout == m_groups[g]) {
for (KeyButton i = 0; i < 512; ++i) {

View File

@@ -109,8 +109,8 @@ protected:
virtual IKeyState* getKeyState() const;
private:
void updateScreenShape();
void updateScreenShape(const CGDirectDisplayID, const CGDisplayChangeSummaryFlags);
bool updateScreenShape();
bool updateScreenShape(const CGDirectDisplayID, const CGDisplayChangeSummaryFlags);
void postMouseEvent(CGPoint&) const;
// convenience function to send events
@@ -118,7 +118,7 @@ private:
void sendClipboardEvent(Event::Type type, ClipboardID id) const;
// message handlers
bool onMouseMove(SInt32 mx, SInt32 my);
bool onMouseMove(CGFloat mx, CGFloat my);
// mouse button handler. pressed is true if this is a mousedown
// event, false if it is a mouseup event. macButton is the index
// of the button pressed using the mac button mapping.

View File

@@ -108,9 +108,12 @@ OSXScreen::OSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCurso
m_getDropTargetThread(NULL),
m_impl(NULL)
{
m_displayID = CGMainDisplayID();
if (!updateScreenShape(m_displayID, 0)) {
throw std::runtime_error ("failed to initialize screen shape");
}
try {
m_displayID = CGMainDisplayID();
updateScreenShape(m_displayID, 0);
m_screensaver = new OSXScreenSaver(m_events, getEventTarget());
m_keyState = new OSXKeyState(m_events);
@@ -1028,20 +1031,20 @@ OSXScreen::handleSystemEvent(const Event& event, void*)
}
bool
OSXScreen::onMouseMove(SInt32 mx, SInt32 my)
OSXScreen::onMouseMove(CGFloat mx, CGFloat my)
{
LOG((CLOG_DEBUG2 "mouse move %+d,%+d", mx, my));
LOG((CLOG_DEBUG2 "mouse move %+f,%+f", mx, my));
SInt32 x = mx - m_xCursor;
SInt32 y = my - m_yCursor;
CGFloat x = mx - m_xCursor;
CGFloat y = my - m_yCursor;
if ((x == 0 && y == 0) || (mx == m_xCenter && mx == m_yCenter)) {
return true;
}
// save position to compute delta of next motion
m_xCursor = mx;
m_yCursor = my;
m_xCursor = (SInt32)mx;
m_yCursor = (SInt32)my;
if (m_isOnScreen) {
// motion on primary screen
@@ -1070,7 +1073,21 @@ OSXScreen::onMouseMove(SInt32 mx, SInt32 my)
}
else {
// send motion
sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), MotionInfo::alloc(x, y));
// Accumulate together the move into the running total
static CGFloat m_xFractionalMove = 0;
static CGFloat m_yFractionalMove = 0;
m_xFractionalMove += x;
m_yFractionalMove += y;
// Return the integer part
SInt32 intX = (SInt32)m_xFractionalMove;
SInt32 intY = (SInt32)m_yFractionalMove;
// And keep only the fractional part
m_xFractionalMove -= intX;
m_yFractionalMove -= intY;
sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), MotionInfo::alloc(intX, intY));
}
}
@@ -1161,12 +1178,13 @@ OSXScreen::displayReconfigurationCallback(CGDirectDisplayID displayID, CGDisplay
kCGDisplayMirrorFlag | kCGDisplayUnMirrorFlag |
kCGDisplayDesktopShapeChangedFlag;
LOG((CLOG_DEBUG1 "event: display was reconfigured: %x %x %x", flags, mask, flags & mask));
LOG((CLOG_DEBUG "event: display was reconfigured: %x %x %x", flags, mask, flags & mask));
if (flags & mask) { /* Something actually did change */
LOG((CLOG_DEBUG1 "event: screen changed shape; refreshing dimensions"));
screen->updateScreenShape(displayID, flags);
if (!screen->updateScreenShape(displayID, flags)) {
LOG((CLOG_ERR "failed to update screen shape during display reconfiguration"));
}
}
}
@@ -1470,35 +1488,34 @@ OSXScreen::getKeyState() const
return m_keyState;
}
void
OSXScreen::updateScreenShape(const CGDirectDisplayID, const CGDisplayChangeSummaryFlags flags)
bool OSXScreen::updateScreenShape(const CGDirectDisplayID, const CGDisplayChangeSummaryFlags flags)
{
updateScreenShape();
return updateScreenShape();
}
void
bool
OSXScreen::updateScreenShape()
{
// get info for each display
CGDisplayCount displayCount = 0;
if (CGGetActiveDisplayList(0, NULL, &displayCount) != CGDisplayNoErr) {
return;
return false;
}
if (displayCount == 0) {
return;
return false;
}
CGDirectDisplayID* displays = new CGDirectDisplayID[displayCount];
if (displays == NULL) {
return;
return false;
}
if (CGGetActiveDisplayList(displayCount,
displays, &displayCount) != CGDisplayNoErr) {
delete[] displays;
return;
return false;
}
// get smallest rect enclosing all display rects
@@ -1527,6 +1544,8 @@ OSXScreen::updateScreenShape()
LOG((CLOG_DEBUG "screen shape: center=%d,%d size=%dx%d on %u %s",
m_x, m_y, m_w, m_h, displayCount,
(displayCount == 1) ? "display" : "displays"));
return true;
}
#pragma mark -

View File

@@ -54,10 +54,10 @@ class EventQueueTimer { };
XWindowsEventQueueBuffer::XWindowsEventQueueBuffer(
Display* display, Window window, IEventQueue* events) :
m_events(events),
m_display(display),
m_window(window),
m_waiting(false)
m_waiting(false),
m_events(events)
{
assert(m_display != NULL);
assert(m_window != None);

View File

@@ -97,12 +97,13 @@ XWindowsScreen::XWindowsScreen(
bool disableXInitThreads,
int mouseScrollDelta,
IEventQueue* events) :
PlatformScreen(events),
m_isPrimary(isPrimary),
m_mouseScrollDelta(mouseScrollDelta),
m_display(nullptr),
m_root(None),
m_window(None),
m_isOnScreen(true),
m_isOnScreen(isPrimary),
m_x(0), m_y(0),
m_w(0), m_h(0),
m_xCenter(0), m_yCenter(0),
@@ -121,8 +122,7 @@ XWindowsScreen::XWindowsScreen(
m_xkb(false),
m_xi2detected(false),
m_xrandr(false),
m_events(events),
PlatformScreen(events)
m_events(events)
{
assert(s_screen == NULL);
@@ -1391,8 +1391,6 @@ XWindowsScreen::handleSystemEvent(const Event& event, void* /*unused*/)
case MotionNotify:
if (m_isPrimary) {
onMouseMove(xevent->xmotion);
} else if (!m_isOnScreen && (xevent->xmotion.send_event == False)) {
LOG ((CLOG_INFO "local input detected"));
}
return;
@@ -1415,8 +1413,8 @@ XWindowsScreen::handleSystemEvent(const Event& event, void* /*unused*/)
#if HAVE_X11_EXTENSIONS_XRANDR_H
if (m_xrandr) {
if (xevent->type == m_xrandrEventBase + RRScreenChangeNotify
|| xevent->type == m_xrandrEventBase + RRNotify
if ((xevent->type == m_xrandrEventBase + RRScreenChangeNotify
|| xevent->type == m_xrandrEventBase + RRNotify)
&& reinterpret_cast<XRRNotifyEvent *>(xevent)->subtype == RRNotify_CrtcChange) {
LOG((CLOG_INFO "XRRScreenChangeNotifyEvent or RRNotify_CrtcChange received"));

View File

@@ -933,6 +933,10 @@ struct codepair {
{ XK_oe, 0x0153 }, /* LATIN SMALL LIGATURE OE */
{ XK_Ydiaeresis, 0x0178 }, /* LATIN CAPITAL LETTER Y WITH DIAERESIS */
{ XK_EuroSign, 0x20ac }, /* EURO SIGN */
{ 0x1000218, 0x0218}, /* LATIN CAPITAL LETTER S WITH COMMA BELOW */
{ 0x1000219, 0x0219}, /* LATIN SMALL LETTER S WITH COMMA BELOW */
{ 0x100021a, 0x021a}, /* LATIN CAPITAL LETTER T WITH COMMA BELOW */
{ 0x100021b, 0x021b}, /* LATIN CAPITAL LETTER T WITH COMMA BELOW */
/* combining dead keys */
{ XK_dead_abovedot, 0x0307 }, /* COMBINING DOT ABOVE */