mirror of
https://github.com/debauchee/barrier.git
synced 2026-02-12 22:55:53 +08:00
Compare commits
18 Commits
v2.0.4-bet
...
v2.0.8-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b70b8e0fc4 | ||
|
|
47137952f4 | ||
|
|
cd403562cd | ||
|
|
2204828746 | ||
|
|
d2f6e56e53 | ||
|
|
a0616a54be | ||
|
|
d2a331c376 | ||
|
|
cbd742ebb5 | ||
|
|
ffb0a5e1ed | ||
|
|
ec3e0b2f71 | ||
|
|
ea5be67b27 | ||
|
|
0f2c7099c5 | ||
|
|
3982e74d30 | ||
|
|
2006af9143 | ||
|
|
cbfa585fa7 | ||
|
|
dfb8d15010 | ||
|
|
426e81fa71 | ||
|
|
3d440547ee |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -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/
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -150,6 +150,7 @@ ArchMultithreadPosix::~ArchMultithreadPosix()
|
||||
|
||||
closeMutex(m_threadMutex);
|
||||
s_instance = nullptr;
|
||||
delete m_mainThread;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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("")
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 -
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"));
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user