mirror of
https://github.com/debauchee/barrier.git
synced 2026-02-12 22:55:53 +08:00
Compare commits
11 Commits
v2.0.7-bet
...
v2.0.8-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b70b8e0fc4 | ||
|
|
47137952f4 | ||
|
|
cd403562cd | ||
|
|
2204828746 | ||
|
|
d2f6e56e53 | ||
|
|
a0616a54be | ||
|
|
d2a331c376 | ||
|
|
cbd742ebb5 | ||
|
|
ffb0a5e1ed | ||
|
|
ec3e0b2f71 | ||
|
|
ea5be67b27 |
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/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1175,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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1484,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
|
||||
@@ -1541,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"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user