mirror of
https://github.com/debauchee/barrier.git
synced 2026-02-09 21:25:55 +08:00
rebranding symless/synergy to debauchee/barrier
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* barrier -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012-2016 Symless Ltd.
|
||||
* Copyright (C) 2004 Chris Schoeneman
|
||||
*
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
#include "synwinhk/synwinhk.h"
|
||||
#include "platform/MSWindowsScreen.h"
|
||||
#include "synergy/IScreenSaver.h"
|
||||
#include "synergy/XScreen.h"
|
||||
#include "barrier/IScreenSaver.h"
|
||||
#include "barrier/XScreen.h"
|
||||
#include "mt/Lock.h"
|
||||
#include "mt/Thread.h"
|
||||
#include "arch/win32/ArchMiscWindows.h"
|
||||
@@ -64,29 +64,29 @@
|
||||
#endif
|
||||
|
||||
// <unused>; <unused>
|
||||
#define SYNERGY_MSG_SWITCH SYNERGY_HOOK_LAST_MSG + 1
|
||||
#define BARRIER_MSG_SWITCH BARRIER_HOOK_LAST_MSG + 1
|
||||
// <unused>; <unused>
|
||||
#define SYNERGY_MSG_ENTER SYNERGY_HOOK_LAST_MSG + 2
|
||||
#define BARRIER_MSG_ENTER BARRIER_HOOK_LAST_MSG + 2
|
||||
// <unused>; <unused>
|
||||
#define SYNERGY_MSG_LEAVE SYNERGY_HOOK_LAST_MSG + 3
|
||||
#define BARRIER_MSG_LEAVE BARRIER_HOOK_LAST_MSG + 3
|
||||
// wParam = flags, HIBYTE(lParam) = virtual key, LOBYTE(lParam) = scan code
|
||||
#define SYNERGY_MSG_FAKE_KEY SYNERGY_HOOK_LAST_MSG + 4
|
||||
#define BARRIER_MSG_FAKE_KEY BARRIER_HOOK_LAST_MSG + 4
|
||||
// flags, XBUTTON id
|
||||
#define SYNERGY_MSG_FAKE_BUTTON SYNERGY_HOOK_LAST_MSG + 5
|
||||
#define BARRIER_MSG_FAKE_BUTTON BARRIER_HOOK_LAST_MSG + 5
|
||||
// x; y
|
||||
#define SYNERGY_MSG_FAKE_MOVE SYNERGY_HOOK_LAST_MSG + 6
|
||||
#define BARRIER_MSG_FAKE_MOVE BARRIER_HOOK_LAST_MSG + 6
|
||||
// xDelta; yDelta
|
||||
#define SYNERGY_MSG_FAKE_WHEEL SYNERGY_HOOK_LAST_MSG + 7
|
||||
#define BARRIER_MSG_FAKE_WHEEL BARRIER_HOOK_LAST_MSG + 7
|
||||
// POINT*; <unused>
|
||||
#define SYNERGY_MSG_CURSOR_POS SYNERGY_HOOK_LAST_MSG + 8
|
||||
#define BARRIER_MSG_CURSOR_POS BARRIER_HOOK_LAST_MSG + 8
|
||||
// IKeyState*; <unused>
|
||||
#define SYNERGY_MSG_SYNC_KEYS SYNERGY_HOOK_LAST_MSG + 9
|
||||
#define BARRIER_MSG_SYNC_KEYS BARRIER_HOOK_LAST_MSG + 9
|
||||
// install; <unused>
|
||||
#define SYNERGY_MSG_SCREENSAVER SYNERGY_HOOK_LAST_MSG + 10
|
||||
#define BARRIER_MSG_SCREENSAVER BARRIER_HOOK_LAST_MSG + 10
|
||||
// dx; dy
|
||||
#define SYNERGY_MSG_FAKE_REL_MOVE SYNERGY_HOOK_LAST_MSG + 11
|
||||
#define BARRIER_MSG_FAKE_REL_MOVE BARRIER_HOOK_LAST_MSG + 11
|
||||
// enable; <unused>
|
||||
#define SYNERGY_MSG_FAKE_INPUT SYNERGY_HOOK_LAST_MSG + 12
|
||||
#define BARRIER_MSG_FAKE_INPUT BARRIER_HOOK_LAST_MSG + 12
|
||||
|
||||
//
|
||||
// MSWindowsDesks
|
||||
@@ -170,13 +170,13 @@ MSWindowsDesks::disable()
|
||||
void
|
||||
MSWindowsDesks::enter()
|
||||
{
|
||||
sendMessage(SYNERGY_MSG_ENTER, 0, 0);
|
||||
sendMessage(BARRIER_MSG_ENTER, 0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
MSWindowsDesks::leave(HKL keyLayout)
|
||||
{
|
||||
sendMessage(SYNERGY_MSG_LEAVE, (WPARAM)keyLayout, 0);
|
||||
sendMessage(BARRIER_MSG_LEAVE, (WPARAM)keyLayout, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -199,7 +199,7 @@ MSWindowsDesks::setOptions(const OptionsList& options)
|
||||
void
|
||||
MSWindowsDesks::updateKeys()
|
||||
{
|
||||
sendMessage(SYNERGY_MSG_SYNC_KEYS, 0, 0);
|
||||
sendMessage(BARRIER_MSG_SYNC_KEYS, 0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -221,27 +221,27 @@ MSWindowsDesks::installScreensaverHooks(bool install)
|
||||
{
|
||||
if (m_isPrimary && m_screensaverNotify != install) {
|
||||
m_screensaverNotify = install;
|
||||
sendMessage(SYNERGY_MSG_SCREENSAVER, install, 0);
|
||||
sendMessage(BARRIER_MSG_SCREENSAVER, install, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MSWindowsDesks::fakeInputBegin()
|
||||
{
|
||||
sendMessage(SYNERGY_MSG_FAKE_INPUT, 1, 0);
|
||||
sendMessage(BARRIER_MSG_FAKE_INPUT, 1, 0);
|
||||
}
|
||||
|
||||
void
|
||||
MSWindowsDesks::fakeInputEnd()
|
||||
{
|
||||
sendMessage(SYNERGY_MSG_FAKE_INPUT, 0, 0);
|
||||
sendMessage(BARRIER_MSG_FAKE_INPUT, 0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
MSWindowsDesks::getCursorPos(SInt32& x, SInt32& y) const
|
||||
{
|
||||
POINT pos;
|
||||
sendMessage(SYNERGY_MSG_CURSOR_POS, reinterpret_cast<WPARAM>(&pos), 0);
|
||||
sendMessage(BARRIER_MSG_CURSOR_POS, reinterpret_cast<WPARAM>(&pos), 0);
|
||||
x = pos.x;
|
||||
y = pos.y;
|
||||
}
|
||||
@@ -259,7 +259,7 @@ MSWindowsDesks::fakeKeyEvent(
|
||||
if (!press) {
|
||||
flags |= KEYEVENTF_KEYUP;
|
||||
}
|
||||
sendMessage(SYNERGY_MSG_FAKE_KEY, flags,
|
||||
sendMessage(BARRIER_MSG_FAKE_KEY, flags,
|
||||
MAKEWORD(static_cast<BYTE>(button & 0xffu),
|
||||
static_cast<BYTE>(virtualKey & 0xffu)));
|
||||
}
|
||||
@@ -314,13 +314,13 @@ MSWindowsDesks::fakeMouseButton(ButtonID button, bool press)
|
||||
}
|
||||
|
||||
// do it
|
||||
sendMessage(SYNERGY_MSG_FAKE_BUTTON, flags, data);
|
||||
sendMessage(BARRIER_MSG_FAKE_BUTTON, flags, data);
|
||||
}
|
||||
|
||||
void
|
||||
MSWindowsDesks::fakeMouseMove(SInt32 x, SInt32 y) const
|
||||
{
|
||||
sendMessage(SYNERGY_MSG_FAKE_MOVE,
|
||||
sendMessage(BARRIER_MSG_FAKE_MOVE,
|
||||
static_cast<WPARAM>(x),
|
||||
static_cast<LPARAM>(y));
|
||||
}
|
||||
@@ -328,7 +328,7 @@ MSWindowsDesks::fakeMouseMove(SInt32 x, SInt32 y) const
|
||||
void
|
||||
MSWindowsDesks::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const
|
||||
{
|
||||
sendMessage(SYNERGY_MSG_FAKE_REL_MOVE,
|
||||
sendMessage(BARRIER_MSG_FAKE_REL_MOVE,
|
||||
static_cast<WPARAM>(dx),
|
||||
static_cast<LPARAM>(dy));
|
||||
}
|
||||
@@ -336,7 +336,7 @@ MSWindowsDesks::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const
|
||||
void
|
||||
MSWindowsDesks::fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const
|
||||
{
|
||||
sendMessage(SYNERGY_MSG_FAKE_WHEEL, xDelta, yDelta);
|
||||
sendMessage(BARRIER_MSG_FAKE_WHEEL, xDelta, yDelta);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -418,7 +418,7 @@ MSWindowsDesks::createDeskWindowClass(bool isPrimary) const
|
||||
classInfo.hCursor = m_cursor;
|
||||
classInfo.hbrBackground = NULL;
|
||||
classInfo.lpszMenuName = NULL;
|
||||
classInfo.lpszClassName = "SynergyDesk";
|
||||
classInfo.lpszClassName = "BarrierDesk";
|
||||
classInfo.hIconSm = NULL;
|
||||
return RegisterClassEx(&classInfo);
|
||||
}
|
||||
@@ -513,7 +513,7 @@ MSWindowsDesks::deskMouseRelativeMove(SInt32 dx, SInt32 dy) const
|
||||
// restore acceleration. there's a slight chance we'll end up in
|
||||
// the wrong place if the user moves the cursor using this system's
|
||||
// mouse while simultaneously moving the mouse on the server
|
||||
// system. that defeats the purpose of synergy so we'll assume
|
||||
// system. that defeats the purpose of barrier so we'll assume
|
||||
// that won't happen. even if it does, the next mouse move will
|
||||
// correct the position.
|
||||
|
||||
@@ -601,7 +601,7 @@ MSWindowsDesks::deskLeave(Desk* desk, HKL keyLayout)
|
||||
// if not using low-level hooks we have to also activate the
|
||||
// window to ensure we don't lose keyboard focus.
|
||||
// FIXME -- see if this can be avoided. if so then always
|
||||
// disable the window (see handling of SYNERGY_MSG_SWITCH).
|
||||
// disable the window (see handling of BARRIER_MSG_SWITCH).
|
||||
if (!desk->m_lowLevel) {
|
||||
SetActiveWindow(desk->m_window);
|
||||
}
|
||||
@@ -666,7 +666,7 @@ MSWindowsDesks::deskThread(void* vdesk)
|
||||
|
||||
// create a window. we use this window to hide the cursor.
|
||||
try {
|
||||
desk->m_window = createWindow(m_deskClass, "SynergyDesk");
|
||||
desk->m_window = createWindow(m_deskClass, "BarrierDesk");
|
||||
LOG((CLOG_DEBUG "desk %s window is 0x%08x", desk->m_name.c_str(), desk->m_window));
|
||||
}
|
||||
catch (...) {
|
||||
@@ -689,7 +689,7 @@ MSWindowsDesks::deskThread(void* vdesk)
|
||||
DispatchMessage(&msg);
|
||||
continue;
|
||||
|
||||
case SYNERGY_MSG_SWITCH:
|
||||
case BARRIER_MSG_SWITCH:
|
||||
if (m_isPrimary && !m_noHooks) {
|
||||
m_uninstall();
|
||||
if (m_screensaverNotify) {
|
||||
@@ -718,45 +718,45 @@ MSWindowsDesks::deskThread(void* vdesk)
|
||||
}
|
||||
break;
|
||||
|
||||
case SYNERGY_MSG_ENTER:
|
||||
case BARRIER_MSG_ENTER:
|
||||
m_isOnScreen = true;
|
||||
deskEnter(desk);
|
||||
break;
|
||||
|
||||
case SYNERGY_MSG_LEAVE:
|
||||
case BARRIER_MSG_LEAVE:
|
||||
m_isOnScreen = false;
|
||||
m_keyLayout = (HKL)msg.wParam;
|
||||
deskLeave(desk, m_keyLayout);
|
||||
break;
|
||||
|
||||
case SYNERGY_MSG_FAKE_KEY:
|
||||
case BARRIER_MSG_FAKE_KEY:
|
||||
keybd_event(HIBYTE(msg.lParam), LOBYTE(msg.lParam), (DWORD)msg.wParam, 0);
|
||||
break;
|
||||
|
||||
case SYNERGY_MSG_FAKE_BUTTON:
|
||||
case BARRIER_MSG_FAKE_BUTTON:
|
||||
if (msg.wParam != 0) {
|
||||
mouse_event((DWORD)msg.wParam, 0, 0, (DWORD)msg.lParam, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case SYNERGY_MSG_FAKE_MOVE:
|
||||
case BARRIER_MSG_FAKE_MOVE:
|
||||
deskMouseMove(static_cast<SInt32>(msg.wParam),
|
||||
static_cast<SInt32>(msg.lParam));
|
||||
break;
|
||||
|
||||
case SYNERGY_MSG_FAKE_REL_MOVE:
|
||||
case BARRIER_MSG_FAKE_REL_MOVE:
|
||||
deskMouseRelativeMove(static_cast<SInt32>(msg.wParam),
|
||||
static_cast<SInt32>(msg.lParam));
|
||||
break;
|
||||
|
||||
case SYNERGY_MSG_FAKE_WHEEL:
|
||||
case BARRIER_MSG_FAKE_WHEEL:
|
||||
// XXX -- add support for x-axis scrolling
|
||||
if (msg.lParam != 0) {
|
||||
mouse_event(MOUSEEVENTF_WHEEL, 0, 0, (DWORD)msg.lParam, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case SYNERGY_MSG_CURSOR_POS: {
|
||||
case BARRIER_MSG_CURSOR_POS: {
|
||||
POINT* pos = reinterpret_cast<POINT*>(msg.wParam);
|
||||
if (!GetCursorPos(pos)) {
|
||||
pos->x = m_xCenter;
|
||||
@@ -765,11 +765,11 @@ MSWindowsDesks::deskThread(void* vdesk)
|
||||
break;
|
||||
}
|
||||
|
||||
case SYNERGY_MSG_SYNC_KEYS:
|
||||
case BARRIER_MSG_SYNC_KEYS:
|
||||
m_updateKeys->run();
|
||||
break;
|
||||
|
||||
case SYNERGY_MSG_SCREENSAVER:
|
||||
case BARRIER_MSG_SCREENSAVER:
|
||||
if (!m_noHooks) {
|
||||
if (msg.wParam != 0) {
|
||||
m_installScreensaver();
|
||||
@@ -780,9 +780,9 @@ MSWindowsDesks::deskThread(void* vdesk)
|
||||
}
|
||||
break;
|
||||
|
||||
case SYNERGY_MSG_FAKE_INPUT:
|
||||
keybd_event(SYNERGY_HOOK_FAKE_INPUT_VIRTUAL_KEY,
|
||||
SYNERGY_HOOK_FAKE_INPUT_SCANCODE,
|
||||
case BARRIER_MSG_FAKE_INPUT:
|
||||
keybd_event(BARRIER_HOOK_FAKE_INPUT_VIRTUAL_KEY,
|
||||
BARRIER_HOOK_FAKE_INPUT_SCANCODE,
|
||||
msg.wParam ? 0 : KEYEVENTF_KEYUP, 0);
|
||||
break;
|
||||
}
|
||||
@@ -868,7 +868,7 @@ MSWindowsDesks::checkDesk()
|
||||
// show cursor on previous desk
|
||||
bool wasOnScreen = m_isOnScreen;
|
||||
if (!wasOnScreen) {
|
||||
sendMessage(SYNERGY_MSG_ENTER, 0, 0);
|
||||
sendMessage(BARRIER_MSG_ENTER, 0, 0);
|
||||
}
|
||||
|
||||
// check for desk accessibility change. we don't get events
|
||||
@@ -891,11 +891,11 @@ MSWindowsDesks::checkDesk()
|
||||
// switch desk
|
||||
m_activeDesk = desk;
|
||||
m_activeDeskName = name;
|
||||
sendMessage(SYNERGY_MSG_SWITCH, 0, 0);
|
||||
sendMessage(BARRIER_MSG_SWITCH, 0, 0);
|
||||
|
||||
// hide cursor on new desk
|
||||
if (!wasOnScreen) {
|
||||
sendMessage(SYNERGY_MSG_LEAVE, (WPARAM)m_keyLayout, 0);
|
||||
sendMessage(BARRIER_MSG_LEAVE, (WPARAM)m_keyLayout, 0);
|
||||
}
|
||||
|
||||
// update keys if necessary
|
||||
@@ -905,7 +905,7 @@ MSWindowsDesks::checkDesk()
|
||||
}
|
||||
else if (name != m_activeDeskName) {
|
||||
// screen saver might have started
|
||||
PostThreadMessage(m_threadID, SYNERGY_MSG_SCREEN_SAVER, TRUE, 0);
|
||||
PostThreadMessage(m_threadID, BARRIER_MSG_SCREEN_SAVER, TRUE, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -937,7 +937,7 @@ MSWindowsDesks::handleCheckDesk(const Event&, void*)
|
||||
if (m_isPrimary) {
|
||||
BOOL running;
|
||||
SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &running, FALSE);
|
||||
PostThreadMessage(m_threadID, SYNERGY_MSG_SCREEN_SAVER, running, 0);
|
||||
PostThreadMessage(m_threadID, BARRIER_MSG_SCREEN_SAVER, running, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user