#6151 Remove tray from core, add core deprecated warning

This commit is contained in:
Nick Bolton 2017-09-14 13:28:01 +01:00
parent c66729e187
commit ce02171eab
101 changed files with 154 additions and 1573 deletions

View File

@ -19,8 +19,6 @@ set(sources
)
if (WIN32)
file(GLOB arch_headers "MSWindows*.h")
file(GLOB arch_sources "MSWindows*.cpp")
list(APPEND sources
resource.h
synergyc.ico
@ -30,12 +28,6 @@ if (WIN32)
tb_run.ico
tb_wait.ico
)
elseif (APPLE)
file(GLOB arch_headers "OSX*.h")
file(GLOB arch_sources "OSX*.cpp")
elseif (UNIX)
file(GLOB arch_headers "XWindows*.h")
file(GLOB arch_sources "XWindows*.cpp")
endif()
list(APPEND sources ${arch_sources})
@ -47,4 +39,4 @@ endif()
add_executable(synergyc ${sources})
target_link_libraries(synergyc
arch base client common io mt net ipc platform server synlib ${libs} ${OPENSSL_LIBS})
arch base client common io mt net ipc platform server core ${libs} ${OPENSSL_LIBS})

View File

@ -1,376 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "MSWindowsClientTaskBarReceiver.h"
#include "resource.h"
#include "client/Client.h"
#include "platform/MSWindowsClipboard.h"
#include "platform/MSWindowsScreen.h"
#include "arch/win32/ArchTaskBarWindows.h"
#include "arch/win32/ArchMiscWindows.h"
#include "arch/Arch.h"
#include "base/EventQueue.h"
#include "base/log_outputters.h"
#include "base/EventTypes.h"
//
// MSWindowsClientTaskBarReceiver
//
const UINT MSWindowsClientTaskBarReceiver::s_stateToIconID[kMaxState] =
{
IDI_TASKBAR_NOT_RUNNING,
IDI_TASKBAR_NOT_WORKING,
IDI_TASKBAR_NOT_CONNECTED,
IDI_TASKBAR_NOT_CONNECTED,
IDI_TASKBAR_CONNECTED
};
MSWindowsClientTaskBarReceiver::MSWindowsClientTaskBarReceiver(
HINSTANCE appInstance, const BufferedLogOutputter* logBuffer, IEventQueue* events) :
ClientTaskBarReceiver(events),
m_appInstance(appInstance),
m_window(NULL),
m_logBuffer(logBuffer)
{
for (UInt32 i = 0; i < kMaxState; ++i) {
m_icon[i] = loadIcon(s_stateToIconID[i]);
}
m_menu = LoadMenu(m_appInstance, MAKEINTRESOURCE(IDR_TASKBAR));
// don't create the window yet. we'll create it on demand. this
// has the side benefit of being created in the thread used for
// the task bar. that's good because it means the existence of
// the window won't prevent changing the main thread's desktop.
// add ourself to the task bar
ARCH->addReceiver(this);
}
MSWindowsClientTaskBarReceiver::~MSWindowsClientTaskBarReceiver()
{
cleanup();
}
void
MSWindowsClientTaskBarReceiver::cleanup()
{
ARCH->removeReceiver(this);
for (UInt32 i = 0; i < kMaxState; ++i) {
deleteIcon(m_icon[i]);
}
DestroyMenu(m_menu);
destroyWindow();
}
void
MSWindowsClientTaskBarReceiver::showStatus()
{
// create the window
createWindow();
// lock self while getting status
lock();
// get the current status
std::string status = getToolTip();
// done getting status
unlock();
// update dialog
HWND child = GetDlgItem(m_window, IDC_TASKBAR_STATUS_STATUS);
SendMessage(child, WM_SETTEXT, 0, (LPARAM)status.c_str());
if (!IsWindowVisible(m_window)) {
// position it by the mouse
POINT cursorPos;
GetCursorPos(&cursorPos);
RECT windowRect;
GetWindowRect(m_window, &windowRect);
int x = cursorPos.x;
int y = cursorPos.y;
int fw = GetSystemMetrics(SM_CXDLGFRAME);
int fh = GetSystemMetrics(SM_CYDLGFRAME);
int ww = windowRect.right - windowRect.left;
int wh = windowRect.bottom - windowRect.top;
int sw = GetSystemMetrics(SM_CXFULLSCREEN);
int sh = GetSystemMetrics(SM_CYFULLSCREEN);
if (fw < 1) {
fw = 1;
}
if (fh < 1) {
fh = 1;
}
if (x + ww - fw > sw) {
x -= ww - fw;
}
else {
x -= fw;
}
if (x < 0) {
x = 0;
}
if (y + wh - fh > sh) {
y -= wh - fh;
}
else {
y -= fh;
}
if (y < 0) {
y = 0;
}
SetWindowPos(m_window, HWND_TOPMOST, x, y, ww, wh,
SWP_SHOWWINDOW);
}
}
void
MSWindowsClientTaskBarReceiver::runMenu(int x, int y)
{
// do popup menu. we need a window to pass to TrackPopupMenu().
// the SetForegroundWindow() and SendMessage() calls around
// TrackPopupMenu() are to get the menu to be dismissed when
// another window gets activated and are just one of those
// win32 weirdnesses.
createWindow();
SetForegroundWindow(m_window);
HMENU menu = GetSubMenu(m_menu, 0);
SetMenuDefaultItem(menu, IDC_TASKBAR_STATUS, FALSE);
HMENU logLevelMenu = GetSubMenu(menu, 3);
CheckMenuRadioItem(logLevelMenu, 0, 6,
CLOG->getFilter() - kERROR, MF_BYPOSITION);
int n = TrackPopupMenu(menu,
TPM_NONOTIFY |
TPM_RETURNCMD |
TPM_LEFTBUTTON |
TPM_RIGHTBUTTON,
x, y, 0, m_window, NULL);
SendMessage(m_window, WM_NULL, 0, 0);
// perform the requested operation
switch (n) {
case IDC_TASKBAR_STATUS:
showStatus();
break;
case IDC_TASKBAR_LOG:
copyLog();
break;
case IDC_TASKBAR_SHOW_LOG:
ARCH->showConsole(true);
break;
case IDC_TASKBAR_LOG_LEVEL_ERROR:
CLOG->setFilter(kERROR);
break;
case IDC_TASKBAR_LOG_LEVEL_WARNING:
CLOG->setFilter(kWARNING);
break;
case IDC_TASKBAR_LOG_LEVEL_NOTE:
CLOG->setFilter(kNOTE);
break;
case IDC_TASKBAR_LOG_LEVEL_INFO:
CLOG->setFilter(kINFO);
break;
case IDC_TASKBAR_LOG_LEVEL_DEBUG:
CLOG->setFilter(kDEBUG);
break;
case IDC_TASKBAR_LOG_LEVEL_DEBUG1:
CLOG->setFilter(kDEBUG1);
break;
case IDC_TASKBAR_LOG_LEVEL_DEBUG2:
CLOG->setFilter(kDEBUG2);
break;
case IDC_TASKBAR_QUIT:
quit();
break;
}
}
void
MSWindowsClientTaskBarReceiver::primaryAction()
{
showStatus();
}
const IArchTaskBarReceiver::Icon
MSWindowsClientTaskBarReceiver::getIcon() const
{
return static_cast<Icon>(m_icon[getStatus()]);
}
void
MSWindowsClientTaskBarReceiver::copyLog() const
{
if (m_logBuffer != NULL) {
// collect log buffer
String data;
for (BufferedLogOutputter::const_iterator index = m_logBuffer->begin();
index != m_logBuffer->end(); ++index) {
data += *index;
data += "\n";
}
// copy log to clipboard
if (!data.empty()) {
MSWindowsClipboard clipboard(m_window);
clipboard.open(0);
clipboard.emptyUnowned();
clipboard.add(IClipboard::kText, data);
clipboard.close();
}
}
}
void
MSWindowsClientTaskBarReceiver::onStatusChanged()
{
if (IsWindowVisible(m_window)) {
showStatus();
}
}
HICON
MSWindowsClientTaskBarReceiver::loadIcon(UINT id)
{
HANDLE icon = LoadImage(m_appInstance,
MAKEINTRESOURCE(id),
IMAGE_ICON,
0, 0,
LR_DEFAULTCOLOR);
return static_cast<HICON>(icon);
}
void
MSWindowsClientTaskBarReceiver::deleteIcon(HICON icon)
{
if (icon != NULL) {
DestroyIcon(icon);
}
}
void
MSWindowsClientTaskBarReceiver::createWindow()
{
// ignore if already created
if (m_window != NULL) {
return;
}
// get the status dialog
m_window = CreateDialogParam(m_appInstance,
MAKEINTRESOURCE(IDD_TASKBAR_STATUS),
NULL,
(DLGPROC)&MSWindowsClientTaskBarReceiver::staticDlgProc,
reinterpret_cast<LPARAM>(
static_cast<void*>(this)));
// window should appear on top of everything, including (especially)
// the task bar.
LONG_PTR style = GetWindowLongPtr(m_window, GWL_EXSTYLE);
style |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
SetWindowLongPtr(m_window, GWL_EXSTYLE, style);
// tell the task bar about this dialog
ArchTaskBarWindows::addDialog(m_window);
}
void
MSWindowsClientTaskBarReceiver::destroyWindow()
{
if (m_window != NULL) {
ArchTaskBarWindows::removeDialog(m_window);
DestroyWindow(m_window);
m_window = NULL;
}
}
BOOL
MSWindowsClientTaskBarReceiver::dlgProc(HWND hwnd,
UINT msg, WPARAM wParam, LPARAM)
{
switch (msg) {
case WM_INITDIALOG:
// use default focus
return TRUE;
case WM_ACTIVATE:
// hide when another window is activated
if (LOWORD(wParam) == WA_INACTIVE) {
ShowWindow(hwnd, SW_HIDE);
}
break;
}
return FALSE;
}
BOOL CALLBACK
MSWindowsClientTaskBarReceiver::staticDlgProc(HWND hwnd,
UINT msg, WPARAM wParam, LPARAM lParam)
{
// if msg is WM_INITDIALOG, extract the MSWindowsClientTaskBarReceiver*
// and put it in the extra window data then forward the call.
MSWindowsClientTaskBarReceiver* self = NULL;
if (msg == WM_INITDIALOG) {
self = static_cast<MSWindowsClientTaskBarReceiver*>(
reinterpret_cast<void*>(lParam));
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) lParam);
}
else {
// get the extra window data and forward the call
LONG_PTR data = GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (data != 0) {
self = (MSWindowsClientTaskBarReceiver*) data;
}
}
// forward the message
if (self != NULL) {
return self->dlgProc(hwnd, msg, wParam, lParam);
}
else {
return (msg == WM_INITDIALOG) ? TRUE : FALSE;
}
}
IArchTaskBarReceiver*
createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events)
{
ArchMiscWindows::setIcons(
(HICON)LoadImage(ArchMiscWindows::instanceWin32(),
MAKEINTRESOURCE(IDI_SYNERGY),
IMAGE_ICON,
32, 32, LR_SHARED),
(HICON)LoadImage(ArchMiscWindows::instanceWin32(),
MAKEINTRESOURCE(IDI_SYNERGY),
IMAGE_ICON,
16, 16, LR_SHARED));
return new MSWindowsClientTaskBarReceiver(
MSWindowsScreen::getWindowInstance(), logBuffer, events);
}

View File

@ -1,68 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "synergy/ClientTaskBarReceiver.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
class BufferedLogOutputter;
class IEventQueue;
//! Implementation of ClientTaskBarReceiver for Microsoft Windows
class MSWindowsClientTaskBarReceiver : public ClientTaskBarReceiver {
public:
MSWindowsClientTaskBarReceiver(HINSTANCE, const BufferedLogOutputter*, IEventQueue* events);
virtual ~MSWindowsClientTaskBarReceiver();
// IArchTaskBarReceiver overrides
virtual void showStatus();
virtual void runMenu(int x, int y);
virtual void primaryAction();
virtual const Icon getIcon() const;
void cleanup();
protected:
void copyLog() const;
// ClientTaskBarReceiver overrides
virtual void onStatusChanged();
private:
HICON loadIcon(UINT);
void deleteIcon(HICON);
void createWindow();
void destroyWindow();
BOOL dlgProc(HWND hwnd,
UINT msg, WPARAM wParam, LPARAM lParam);
static BOOL CALLBACK
staticDlgProc(HWND hwnd,
UINT msg, WPARAM wParam, LPARAM lParam);
private:
HINSTANCE m_appInstance;
HWND m_window;
HMENU m_menu;
HICON m_icon[kMaxState];
const BufferedLogOutputter* m_logBuffer;
static const UINT s_stateToIconID[];
};

View File

@ -1,69 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "OSXClientTaskBarReceiver.h"
#include "arch/Arch.h"
//
// OSXClientTaskBarReceiver
//
OSXClientTaskBarReceiver::OSXClientTaskBarReceiver(
const BufferedLogOutputter*,
IEventQueue* events) :
ClientTaskBarReceiver(events)
{
// add ourself to the task bar
ARCH->addReceiver(this);
}
OSXClientTaskBarReceiver::~OSXClientTaskBarReceiver()
{
ARCH->removeReceiver(this);
}
void
OSXClientTaskBarReceiver::showStatus()
{
// do nothing
}
void
OSXClientTaskBarReceiver::runMenu(int, int)
{
// do nothing
}
void
OSXClientTaskBarReceiver::primaryAction()
{
// do nothing
}
const IArchTaskBarReceiver::Icon
OSXClientTaskBarReceiver::getIcon() const
{
return NULL;
}
IArchTaskBarReceiver*
createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events)
{
return new OSXClientTaskBarReceiver(logBuffer, events);
}

View File

@ -1,37 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "synergy/ClientTaskBarReceiver.h"
class BufferedLogOutputter;
class IEventQueue;
//! Implementation of ClientTaskBarReceiver for OS X
class OSXClientTaskBarReceiver : public ClientTaskBarReceiver {
public:
OSXClientTaskBarReceiver(const BufferedLogOutputter*, IEventQueue* events);
virtual ~OSXClientTaskBarReceiver();
// IArchTaskBarReceiver overrides
virtual void showStatus();
virtual void runMenu(int x, int y);
virtual void primaryAction();
virtual const Icon getIcon() const;
};

View File

@ -1,68 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "XWindowsClientTaskBarReceiver.h"
#include "arch/Arch.h"
//
// CXWindowsClientTaskBarReceiver
//
CXWindowsClientTaskBarReceiver::CXWindowsClientTaskBarReceiver(
const BufferedLogOutputter*,
IEventQueue* events) :
ClientTaskBarReceiver(events)
{
// add ourself to the task bar
ARCH->addReceiver(this);
}
CXWindowsClientTaskBarReceiver::~CXWindowsClientTaskBarReceiver()
{
ARCH->removeReceiver(this);
}
void
CXWindowsClientTaskBarReceiver::showStatus()
{
// do nothing
}
void
CXWindowsClientTaskBarReceiver::runMenu(int, int)
{
// do nothing
}
void
CXWindowsClientTaskBarReceiver::primaryAction()
{
// do nothing
}
const IArchTaskBarReceiver::Icon
CXWindowsClientTaskBarReceiver::getIcon() const
{
return NULL;
}
IArchTaskBarReceiver*
createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events)
{
return new CXWindowsClientTaskBarReceiver(logBuffer, events);
}

View File

@ -1,38 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "synergy/ClientTaskBarReceiver.h"
class BufferedLogOutputter;
class IEventQueue;
//! Implementation of ClientTaskBarReceiver for X Windows
class CXWindowsClientTaskBarReceiver : public ClientTaskBarReceiver {
public:
CXWindowsClientTaskBarReceiver(
const BufferedLogOutputter*, IEventQueue* events);
virtual ~CXWindowsClientTaskBarReceiver();
// IArchTaskBarReceiver overrides
virtual void showStatus();
virtual void runMenu(int x, int y);
virtual void primaryAction();
virtual const Icon getIcon() const;
};

View File

@ -16,24 +16,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/ClientApp.h"
#include "core/ClientApp.h"
#include "arch/Arch.h"
#include "base/Log.h"
#include "base/EventQueue.h"
#if WINAPI_MSWINDOWS
#include "MSWindowsClientTaskBarReceiver.h"
#elif WINAPI_XWINDOWS
#include "XWindowsClientTaskBarReceiver.h"
#elif WINAPI_CARBON
#include "OSXClientTaskBarReceiver.h"
#else
#error Platform not supported.
#endif
#include <iostream>
int
main(int argc, char** argv)
{
std::cerr << "warning: synergyc is deprecated. instead, use: synergy-core --client" << std::endl;
#if SYSAPI_WIN32
// record window instance for tray icon, etc
ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
@ -45,6 +39,6 @@ main(int argc, char** argv)
Log log;
EventQueue events;
ClientApp app(&events, createTaskBarReceiver);
ClientApp app(&events);
return app.run(argc, argv);
}

View File

@ -19,8 +19,6 @@ set(sources
)
if (WIN32)
file(GLOB arch_headers "MSWindows*.h")
file(GLOB arch_sources "MSWindows*.cpp")
list(APPEND sources
resource.h
synergys.ico
@ -30,21 +28,12 @@ if (WIN32)
tb_run.ico
tb_wait.ico
)
elseif (APPLE)
file(GLOB arch_headers "OSX*.h")
file(GLOB arch_sources "OSX*.cpp")
elseif (UNIX)
file(GLOB arch_headers "XWindows*.h")
file(GLOB arch_sources "XWindows*.cpp")
endif()
list(APPEND sources ${arch_sources})
list(APPEND headers ${arch_headers})
if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
add_executable(synergys ${sources})
target_link_libraries(synergys
arch base client common io mt net ipc platform server synlib ${libs} ${OPENSSL_LIBS})
arch base client common io mt net ipc platform server core ${libs} ${OPENSSL_LIBS})

View File

@ -1,408 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "MSWindowsServerTaskBarReceiver.h"
#include "resource.h"
#include "server/Server.h"
#include "platform/MSWindowsClipboard.h"
#include "platform/MSWindowsScreen.h"
#include "arch/win32/ArchTaskBarWindows.h"
#include "arch/win32/ArchMiscWindows.h"
#include "arch/Arch.h"
#include "base/EventQueue.h"
#include "base/IEventQueue.h"
#include "base/log_outputters.h"
#include "base/EventTypes.h"
//
// MSWindowsServerTaskBarReceiver
//
const UINT MSWindowsServerTaskBarReceiver::s_stateToIconID[kMaxState] =
{
IDI_TASKBAR_NOT_RUNNING,
IDI_TASKBAR_NOT_WORKING,
IDI_TASKBAR_NOT_CONNECTED,
IDI_TASKBAR_CONNECTED
};
MSWindowsServerTaskBarReceiver::MSWindowsServerTaskBarReceiver(
HINSTANCE appInstance, const BufferedLogOutputter* logBuffer, IEventQueue* events) :
ServerTaskBarReceiver(events),
m_events(events),
m_appInstance(appInstance),
m_window(NULL),
m_logBuffer(logBuffer)
{
for (UInt32 i = 0; i < kMaxState; ++i) {
m_icon[i] = loadIcon(s_stateToIconID[i]);
}
m_menu = LoadMenu(m_appInstance, MAKEINTRESOURCE(IDR_TASKBAR));
// don't create the window yet. we'll create it on demand. this
// has the side benefit of being created in the thread used for
// the task bar. that's good because it means the existence of
// the window won't prevent changing the main thread's desktop.
// add ourself to the task bar
ARCH->addReceiver(this);
}
void
MSWindowsServerTaskBarReceiver::cleanup()
{
ARCH->removeReceiver(this);
for (UInt32 i = 0; i < kMaxState; ++i) {
deleteIcon(m_icon[i]);
}
DestroyMenu(m_menu);
destroyWindow();
}
MSWindowsServerTaskBarReceiver::~MSWindowsServerTaskBarReceiver()
{
cleanup();
}
void
MSWindowsServerTaskBarReceiver::showStatus()
{
// create the window
createWindow();
// lock self while getting status
lock();
// get the current status
std::string status = getToolTip();
// get the connect clients, if any
const Clients& clients = getClients();
// done getting status
unlock();
// update dialog
HWND child = GetDlgItem(m_window, IDC_TASKBAR_STATUS_STATUS);
SendMessage(child, WM_SETTEXT, 0, (LPARAM)status.c_str());
child = GetDlgItem(m_window, IDC_TASKBAR_STATUS_CLIENTS);
SendMessage(child, LB_RESETCONTENT, 0, 0);
for (Clients::const_iterator index = clients.begin();
index != clients.end(); ) {
const char* client = index->c_str();
if (++index == clients.end()) {
SendMessage(child, LB_ADDSTRING, 0, (LPARAM)client);
}
else {
SendMessage(child, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)client);
}
}
if (!IsWindowVisible(m_window)) {
// position it by the mouse
POINT cursorPos;
GetCursorPos(&cursorPos);
RECT windowRect;
GetWindowRect(m_window, &windowRect);
int x = cursorPos.x;
int y = cursorPos.y;
int fw = GetSystemMetrics(SM_CXDLGFRAME);
int fh = GetSystemMetrics(SM_CYDLGFRAME);
int ww = windowRect.right - windowRect.left;
int wh = windowRect.bottom - windowRect.top;
int sw = GetSystemMetrics(SM_CXFULLSCREEN);
int sh = GetSystemMetrics(SM_CYFULLSCREEN);
if (fw < 1) {
fw = 1;
}
if (fh < 1) {
fh = 1;
}
if (x + ww - fw > sw) {
x -= ww - fw;
}
else {
x -= fw;
}
if (x < 0) {
x = 0;
}
if (y + wh - fh > sh) {
y -= wh - fh;
}
else {
y -= fh;
}
if (y < 0) {
y = 0;
}
SetWindowPos(m_window, HWND_TOPMOST, x, y, ww, wh,
SWP_SHOWWINDOW);
}
}
void
MSWindowsServerTaskBarReceiver::runMenu(int x, int y)
{
// do popup menu. we need a window to pass to TrackPopupMenu().
// the SetForegroundWindow() and SendMessage() calls around
// TrackPopupMenu() are to get the menu to be dismissed when
// another window gets activated and are just one of those
// win32 weirdnesses.
createWindow();
SetForegroundWindow(m_window);
HMENU menu = GetSubMenu(m_menu, 0);
SetMenuDefaultItem(menu, IDC_TASKBAR_STATUS, FALSE);
HMENU logLevelMenu = GetSubMenu(menu, 3);
CheckMenuRadioItem(logLevelMenu, 0, 6,
CLOG->getFilter() - kERROR, MF_BYPOSITION);
int n = TrackPopupMenu(menu,
TPM_NONOTIFY |
TPM_RETURNCMD |
TPM_LEFTBUTTON |
TPM_RIGHTBUTTON,
x, y, 0, m_window, NULL);
SendMessage(m_window, WM_NULL, 0, 0);
// perform the requested operation
switch (n) {
case IDC_TASKBAR_STATUS:
showStatus();
break;
case IDC_TASKBAR_LOG:
copyLog();
break;
case IDC_TASKBAR_SHOW_LOG:
ARCH->showConsole(true);
break;
case IDC_RELOAD_CONFIG:
m_events->addEvent(Event(m_events->forServerApp().reloadConfig(),
m_events->getSystemTarget()));
break;
case IDC_FORCE_RECONNECT:
m_events->addEvent(Event(m_events->forServerApp().forceReconnect(),
m_events->getSystemTarget()));
break;
case ID_SYNERGY_RESETSERVER:
m_events->addEvent(Event(m_events->forServerApp().resetServer(),
m_events->getSystemTarget()));
break;
case IDC_TASKBAR_LOG_LEVEL_ERROR:
CLOG->setFilter(kERROR);
break;
case IDC_TASKBAR_LOG_LEVEL_WARNING:
CLOG->setFilter(kWARNING);
break;
case IDC_TASKBAR_LOG_LEVEL_NOTE:
CLOG->setFilter(kNOTE);
break;
case IDC_TASKBAR_LOG_LEVEL_INFO:
CLOG->setFilter(kINFO);
break;
case IDC_TASKBAR_LOG_LEVEL_DEBUG:
CLOG->setFilter(kDEBUG);
break;
case IDC_TASKBAR_LOG_LEVEL_DEBUG1:
CLOG->setFilter(kDEBUG1);
break;
case IDC_TASKBAR_LOG_LEVEL_DEBUG2:
CLOG->setFilter(kDEBUG2);
break;
case IDC_TASKBAR_QUIT:
quit();
break;
}
}
void
MSWindowsServerTaskBarReceiver::primaryAction()
{
showStatus();
}
const IArchTaskBarReceiver::Icon
MSWindowsServerTaskBarReceiver::getIcon() const
{
return static_cast<Icon>(m_icon[getStatus()]);
}
void
MSWindowsServerTaskBarReceiver::copyLog() const
{
if (m_logBuffer != NULL) {
// collect log buffer
String data;
for (BufferedLogOutputter::const_iterator index = m_logBuffer->begin();
index != m_logBuffer->end(); ++index) {
data += *index;
data += "\n";
}
// copy log to clipboard
if (!data.empty()) {
MSWindowsClipboard clipboard(m_window);
clipboard.open(0);
clipboard.emptyUnowned();
clipboard.add(IClipboard::kText, data);
clipboard.close();
}
}
}
void
MSWindowsServerTaskBarReceiver::onStatusChanged()
{
if (IsWindowVisible(m_window)) {
showStatus();
}
}
HICON
MSWindowsServerTaskBarReceiver::loadIcon(UINT id)
{
HANDLE icon = LoadImage(m_appInstance,
MAKEINTRESOURCE(id),
IMAGE_ICON,
0, 0,
LR_DEFAULTCOLOR);
return static_cast<HICON>(icon);
}
void
MSWindowsServerTaskBarReceiver::deleteIcon(HICON icon)
{
if (icon != NULL) {
DestroyIcon(icon);
}
}
void
MSWindowsServerTaskBarReceiver::createWindow()
{
// ignore if already created
if (m_window != NULL) {
return;
}
// get the status dialog
m_window = CreateDialogParam(m_appInstance,
MAKEINTRESOURCE(IDD_TASKBAR_STATUS),
NULL,
(DLGPROC)&MSWindowsServerTaskBarReceiver::staticDlgProc,
reinterpret_cast<LPARAM>(
static_cast<void*>(this)));
// window should appear on top of everything, including (especially)
// the task bar.
LONG_PTR style = GetWindowLongPtr(m_window, GWL_EXSTYLE);
style |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
SetWindowLongPtr(m_window, GWL_EXSTYLE, style);
// tell the task bar about this dialog
ArchTaskBarWindows::addDialog(m_window);
}
void
MSWindowsServerTaskBarReceiver::destroyWindow()
{
if (m_window != NULL) {
ArchTaskBarWindows::removeDialog(m_window);
DestroyWindow(m_window);
m_window = NULL;
}
}
BOOL
MSWindowsServerTaskBarReceiver::dlgProc(HWND hwnd,
UINT msg, WPARAM wParam, LPARAM)
{
switch (msg) {
case WM_INITDIALOG:
// use default focus
return TRUE;
case WM_ACTIVATE:
// hide when another window is activated
if (LOWORD(wParam) == WA_INACTIVE) {
ShowWindow(hwnd, SW_HIDE);
}
break;
}
return FALSE;
}
BOOL CALLBACK
MSWindowsServerTaskBarReceiver::staticDlgProc(HWND hwnd,
UINT msg, WPARAM wParam, LPARAM lParam)
{
// if msg is WM_INITDIALOG, extract the MSWindowsServerTaskBarReceiver*
// and put it in the extra window data then forward the call.
MSWindowsServerTaskBarReceiver* self = NULL;
if (msg == WM_INITDIALOG) {
self = static_cast<MSWindowsServerTaskBarReceiver*>(
reinterpret_cast<void*>(lParam));
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
}
else {
// get the extra window data and forward the call
LONG_PTR data = GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (data != 0) {
self = static_cast<MSWindowsServerTaskBarReceiver*>(
reinterpret_cast<void*>(data));
}
}
// forward the message
if (self != NULL) {
return self->dlgProc(hwnd, msg, wParam, lParam);
}
else {
return (msg == WM_INITDIALOG) ? TRUE : FALSE;
}
}
IArchTaskBarReceiver*
createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events)
{
ArchMiscWindows::setIcons(
(HICON)LoadImage(ArchMiscWindows::instanceWin32(),
MAKEINTRESOURCE(IDI_SYNERGY),
IMAGE_ICON,
32, 32, LR_SHARED),
(HICON)LoadImage(ArchMiscWindows::instanceWin32(),
MAKEINTRESOURCE(IDI_SYNERGY),
IMAGE_ICON,
16, 16, LR_SHARED));
return new MSWindowsServerTaskBarReceiver(
MSWindowsScreen::getWindowInstance(), logBuffer, events);
}

View File

@ -1,69 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "synergy/ServerTaskBarReceiver.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
class BufferedLogOutputter;
class IEventQueue;
//! Implementation of ServerTaskBarReceiver for Microsoft Windows
class MSWindowsServerTaskBarReceiver : public ServerTaskBarReceiver {
public:
MSWindowsServerTaskBarReceiver(HINSTANCE, const BufferedLogOutputter*, IEventQueue* events);
virtual ~MSWindowsServerTaskBarReceiver();
// IArchTaskBarReceiver overrides
virtual void showStatus();
virtual void runMenu(int x, int y);
virtual void primaryAction();
virtual const Icon getIcon() const;
void cleanup();
protected:
void copyLog() const;
// ServerTaskBarReceiver overrides
virtual void onStatusChanged();
private:
HICON loadIcon(UINT);
void deleteIcon(HICON);
void createWindow();
void destroyWindow();
BOOL dlgProc(HWND hwnd,
UINT msg, WPARAM wParam, LPARAM lParam);
static BOOL CALLBACK
staticDlgProc(HWND hwnd,
UINT msg, WPARAM wParam, LPARAM lParam);
private:
HINSTANCE m_appInstance;
HWND m_window;
HMENU m_menu;
HICON m_icon[kMaxState];
const BufferedLogOutputter* m_logBuffer;
IEventQueue* m_events;
static const UINT s_stateToIconID[];
};

View File

@ -1,67 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "OSXServerTaskBarReceiver.h"
#include "arch/Arch.h"
//
// OSXServerTaskBarReceiver
//
OSXServerTaskBarReceiver::OSXServerTaskBarReceiver(
const BufferedLogOutputter*, IEventQueue* events) :
ServerTaskBarReceiver(events)
{
// add ourself to the task bar
ARCH->addReceiver(this);
}
OSXServerTaskBarReceiver::~OSXServerTaskBarReceiver()
{
ARCH->removeReceiver(this);
}
void
OSXServerTaskBarReceiver::showStatus()
{
// do nothing
}
void
OSXServerTaskBarReceiver::runMenu(int, int)
{
// do nothing
}
void
OSXServerTaskBarReceiver::primaryAction()
{
// do nothing
}
const IArchTaskBarReceiver::Icon
OSXServerTaskBarReceiver::getIcon() const
{
return NULL;
}
IArchTaskBarReceiver*
createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events)
{
return new OSXServerTaskBarReceiver(logBuffer, events);
}

View File

@ -1,36 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "synergy/ServerTaskBarReceiver.h"
class BufferedLogOutputter;
//! Implementation of ServerTaskBarReceiver for OS X
class OSXServerTaskBarReceiver : public ServerTaskBarReceiver {
public:
OSXServerTaskBarReceiver(const BufferedLogOutputter*, IEventQueue* events);
virtual ~OSXServerTaskBarReceiver();
// IArchTaskBarReceiver overrides
virtual void showStatus();
virtual void runMenu(int x, int y);
virtual void primaryAction();
virtual const Icon getIcon() const;
};

View File

@ -1,67 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "XWindowsServerTaskBarReceiver.h"
#include "arch/Arch.h"
//
// CXWindowsServerTaskBarReceiver
//
CXWindowsServerTaskBarReceiver::CXWindowsServerTaskBarReceiver(
const BufferedLogOutputter*, IEventQueue* events) :
ServerTaskBarReceiver(events)
{
// add ourself to the task bar
ARCH->addReceiver(this);
}
CXWindowsServerTaskBarReceiver::~CXWindowsServerTaskBarReceiver()
{
ARCH->removeReceiver(this);
}
void
CXWindowsServerTaskBarReceiver::showStatus()
{
// do nothing
}
void
CXWindowsServerTaskBarReceiver::runMenu(int, int)
{
// do nothing
}
void
CXWindowsServerTaskBarReceiver::primaryAction()
{
// do nothing
}
const IArchTaskBarReceiver::Icon
CXWindowsServerTaskBarReceiver::getIcon() const
{
return NULL;
}
IArchTaskBarReceiver*
createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events)
{
return new CXWindowsServerTaskBarReceiver(logBuffer, events);
}

View File

@ -1,38 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "synergy/ServerTaskBarReceiver.h"
class BufferedLogOutputter;
class IEventQueue;
//! Implementation of ServerTaskBarReceiver for X Windows
class CXWindowsServerTaskBarReceiver : public ServerTaskBarReceiver {
public:
CXWindowsServerTaskBarReceiver(
const BufferedLogOutputter*, IEventQueue* events);
virtual ~CXWindowsServerTaskBarReceiver();
// IArchTaskBarReceiver overrides
virtual void showStatus();
virtual void runMenu(int x, int y);
virtual void primaryAction();
virtual const Icon getIcon() const;
};

View File

@ -16,24 +16,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/ServerApp.h"
#include "core/ServerApp.h"
#include "arch/Arch.h"
#include "base/Log.h"
#include "base/EventQueue.h"
#if WINAPI_MSWINDOWS
#include "MSWindowsServerTaskBarReceiver.h"
#elif WINAPI_XWINDOWS
#include "XWindowsServerTaskBarReceiver.h"
#elif WINAPI_CARBON
#include "OSXServerTaskBarReceiver.h"
#else
#error Platform not supported.
#endif
#include <iostream>
int
main(int argc, char** argv)
{
std::cerr << "warning: synergys is deprecated. instead, use: synergy-core --server" << std::endl;
#if SYSAPI_WIN32
// record window instance for tray icon, etc
ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
@ -45,6 +39,6 @@ main(int argc, char** argv)
Log log;
EventQueue events;
ServerApp app(&events, createTaskBarReceiver);
ServerApp app(&events);
return app.run(argc, argv);
}

View File

@ -16,17 +16,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/App.h"
#include "core/App.h"
#include "base/Log.h"
#include "common/Version.h"
#include "synergy/protocol_types.h"
#include "core/protocol_types.h"
#include "arch/Arch.h"
#include "base/XBase.h"
#include "arch/XArch.h"
#include "base/log_outputters.h"
#include "synergy/XSynergy.h"
#include "synergy/ArgsBase.h"
#include "core/XSynergy.h"
#include "core/ArgsBase.h"
#include "ipc/IpcServerProxy.h"
#include "base/TMethodEventJob.h"
#include "ipc/IpcMessage.h"
@ -56,14 +56,12 @@ App* App::s_instance = nullptr;
// App
//
App::App(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver, ArgsBase* args) :
App::App(IEventQueue* events, ArgsBase* args) :
m_bye(&exit),
m_taskBarReceiver(NULL),
m_suspended(false),
m_events(events),
m_args(args),
m_fileLog(nullptr),
m_createTaskBarReceiver(createTaskBarReceiver),
m_appUtil(events),
m_ipcClient(nullptr),
m_socketMultiplexer(nullptr)
@ -195,18 +193,6 @@ App::initApp(int argc, const char** argv)
// load configuration
loadConfig();
if (!argsBase().m_disableTray) {
// create a log buffer so we can show the latest message
// as a tray icon tooltip
BufferedLogOutputter* logBuffer = new BufferedLogOutputter(1000);
CLOG->insert(logBuffer, true);
// make the task bar receiver. the user can control this app
// through the task bar.
m_taskBarReceiver = m_createTaskBarReceiver(logBuffer, m_events);
}
}
void
@ -255,7 +241,7 @@ App::runEventsLoop(void*)
//
MinimalApp::MinimalApp() :
App(NULL, NULL, new ArgsBase())
App(NULL, new ArgsBase())
{
m_arch.init();
setEvents(m_events);

View File

@ -19,19 +19,18 @@
#pragma once
#include "ipc/IpcClient.h"
#include "synergy/IApp.h"
#include "core/IApp.h"
#include "base/String.h"
#include "base/Log.h"
#include "base/EventQueue.h"
#include "common/common.h"
#if SYSAPI_WIN32
#include "synergy/win32/AppUtilWindows.h"
#include "core/win32/AppUtilWindows.h"
#elif SYSAPI_UNIX
#include "synergy/unix/AppUtilUnix.h"
#include "core/unix/AppUtilUnix.h"
#endif
class IArchTaskBarReceiver;
class BufferedLogOutputter;
class ILogOutputter;
class FileLogOutputter;
@ -39,11 +38,9 @@ namespace synergy { class Screen; }
class IEventQueue;
class SocketMultiplexer;
typedef IArchTaskBarReceiver* (*CreateTaskBarReceiverFunc)(const BufferedLogOutputter*, IEventQueue* events);
class App : public IApp {
public:
App(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver, ArgsBase* args);
App(IEventQueue* events, ArgsBase* args);
virtual ~App();
// Returns args that are common between server and client.
@ -88,8 +85,6 @@ public:
ARCH_APP_UTIL& appUtil() { return m_appUtil; }
virtual IArchTaskBarReceiver* taskBarReceiver() const { return m_taskBarReceiver; }
virtual void setByeFunc(void(*bye)(int)) { m_bye = bye; }
virtual void bye(int error) { m_bye(error); }
@ -108,7 +103,6 @@ protected:
void cleanupIpcClient();
void runEventsLoop(void*);
IArchTaskBarReceiver* m_taskBarReceiver;
bool m_suspended;
IEventQueue* m_events;
@ -116,7 +110,6 @@ private:
ArgsBase* m_args;
static App* s_instance;
FileLogOutputter* m_fileLog;
CreateTaskBarReceiverFunc m_createTaskBarReceiver;
ARCH_APP_UTIL m_appUtil;
IpcClient* m_ipcClient;
SocketMultiplexer* m_socketMultiplexer;

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/AppUtil.h"
#include "core/AppUtil.h"
AppUtil* AppUtil::s_instance = nullptr;

View File

@ -18,8 +18,8 @@
#pragma once
#include "synergy/IAppUtil.h"
#include "synergy/XSynergy.h"
#include "core/IAppUtil.h"
#include "core/XSynergy.h"
class AppUtil : public IAppUtil {
public:

View File

@ -15,14 +15,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/ArgParser.h"
#include "core/ArgParser.h"
#include "synergy/StreamChunker.h"
#include "synergy/App.h"
#include "synergy/ServerArgs.h"
#include "synergy/ClientArgs.h"
#include "synergy/ToolArgs.h"
#include "synergy/ArgsBase.h"
#include "core/StreamChunker.h"
#include "core/App.h"
#include "core/ServerArgs.h"
#include "core/ClientArgs.h"
#include "core/ToolArgs.h"
#include "core/ArgsBase.h"
#include "base/Log.h"
#include "base/String.h"
@ -259,9 +259,6 @@ ArgParser::parseGenericArgs(int argc, const char* const* argv, int& i)
}
argsBase().m_shouldExit = true;
}
else if (isArg(i, argc, argv, NULL, "--no-tray")) {
argsBase().m_disableTray = true;
}
else if (isArg(i, argc, argv, NULL, "--ipc")) {
argsBase().m_enableIpc = true;
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/ArgsBase.h"
#include "core/ArgsBase.h"
ArgsBase::ArgsBase() :
#if SYSAPI_WIN32
@ -37,7 +37,6 @@ m_pname(NULL),
m_logFilter(NULL),
m_logFile(NULL),
m_display(NULL),
m_disableTray(false),
m_enableIpc(false),
m_enableDragDrop(false),
m_shouldExit(false),

View File

@ -35,7 +35,6 @@ public:
const char* m_logFile;
const char* m_display;
String m_name;
bool m_disableTray;
bool m_enableIpc;
bool m_enableDragDrop;
#if SYSAPI_WIN32

View File

@ -33,8 +33,8 @@ if (SYNERGY_ADD_HEADERS)
list(APPEND sources ${headers})
endif()
add_library(synlib STATIC ${sources})
add_library(core STATIC ${sources})
if (UNIX)
target_link_libraries(synlib arch client ipc net base platform mt server)
target_link_libraries(core arch client ipc net base platform mt server)
endif()

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/Chunk.h"
#include "core/Chunk.h"
#include "base/String.h"
Chunk::Chunk(size_t size): m_dataSize(0)

View File

@ -16,14 +16,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/ClientApp.h"
#include "core/ClientApp.h"
#include "client/Client.h"
#include "synergy/ArgParser.h"
#include "synergy/protocol_types.h"
#include "synergy/Screen.h"
#include "synergy/XScreen.h"
#include "synergy/ClientArgs.h"
#include "core/ArgParser.h"
#include "core/protocol_types.h"
#include "core/Screen.h"
#include "core/XScreen.h"
#include "core/ClientArgs.h"
#include "net/NetworkAddress.h"
#include "net/TCPSocketFactory.h"
#include "net/SocketMultiplexer.h"
@ -62,8 +62,8 @@
#define RETRY_TIME 1.0
ClientApp::ClientApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver) :
App(events, createTaskBarReceiver, new ClientArgs()),
ClientApp::ClientApp(IEventQueue* events) :
App(events, new ClientArgs()),
m_client(NULL),
m_clientScreen(NULL),
m_serverAddress(NULL)
@ -194,10 +194,6 @@ ClientApp::updateStatus()
void
ClientApp::updateStatus(const String& msg)
{
if (m_taskBarReceiver)
{
m_taskBarReceiver->updateStatus(m_client, msg);
}
}
@ -542,12 +538,6 @@ ClientApp::runInner(int argc, char** argv, ILogOutputter* outputter, StartupFunc
}
catch (...)
{
if (m_taskBarReceiver)
{
// done with task bar receiver
delete m_taskBarReceiver;
}
delete m_serverAddress;
throw;

View File

@ -18,7 +18,7 @@
#pragma once
#include "synergy/App.h"
#include "core/App.h"
namespace synergy { class Screen; }
class Event;
@ -29,7 +29,7 @@ class ClientArgs;
class ClientApp : public App {
public:
ClientApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver);
ClientApp(IEventQueue* events);
virtual ~ClientApp();
// Parse client specific command line arguments.

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/ClientArgs.h"
#include "core/ClientArgs.h"
ClientArgs::ClientArgs() :
m_yscroll(0)

View File

@ -17,7 +17,7 @@
#pragma once
#include "synergy/ArgsBase.h"
#include "core/ArgsBase.h"
class NetworkAddress;

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/ClientTaskBarReceiver.h"
#include "core/ClientTaskBarReceiver.h"
#include "client/Client.h"
#include "mt/Lock.h"
#include "base/String.h"

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/Clipboard.h"
#include "core/Clipboard.h"
//
// Clipboard

View File

@ -18,7 +18,7 @@
#pragma once
#include "synergy/IClipboard.h"
#include "core/IClipboard.h"
//! Memory buffer clipboard
/*!

View File

@ -15,10 +15,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/ClipboardChunk.h"
#include "core/ClipboardChunk.h"
#include "synergy/ProtocolUtil.h"
#include "synergy/protocol_types.h"
#include "core/ProtocolUtil.h"
#include "core/protocol_types.h"
#include "io/IStream.h"
#include "base/Log.h"
#include <cstring>

View File

@ -17,8 +17,8 @@
#pragma once
#include "synergy/Chunk.h"
#include "synergy/clipboard_types.h"
#include "core/Chunk.h"
#include "core/clipboard_types.h"
#include "base/String.h"
#include "common/basic_types.h"

View File

@ -19,12 +19,12 @@
// TODO: split this class into windows and unix to get rid
// of all the #ifdefs!
#include "synergy/DaemonApp.h"
#include "core/DaemonApp.h"
#include "synergy/App.h"
#include "synergy/ArgParser.h"
#include "synergy/ServerArgs.h"
#include "synergy/ClientArgs.h"
#include "core/App.h"
#include "core/ArgParser.h"
#include "core/ServerArgs.h"
#include "core/ClientArgs.h"
#include "ipc/IpcClientProxy.h"
#include "ipc/IpcMessage.h"
#include "ipc/IpcLogOutputter.h"
@ -41,7 +41,7 @@
#include "arch/win32/ArchMiscWindows.h"
#include "arch/win32/XArchWindows.h"
#include "synergy/Screen.h"
#include "core/Screen.h"
#include "platform/MSWindowsScreen.h"
#include "platform/MSWindowsDebugOutputter.h"
#include "platform/MSWindowsWatchdog.h"

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/DragInformation.h"
#include "core/DragInformation.h"
#include "base/Log.h"
#include <fstream>

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/DropHelper.h"
#include "core/DropHelper.h"
#include "base/Log.h"

View File

@ -17,7 +17,7 @@
#pragma once
#include "synergy/DragInformation.h"
#include "core/DragInformation.h"
#include "base/String.h"
class DropHelper {

View File

@ -15,10 +15,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/FileChunk.h"
#include "core/FileChunk.h"
#include "synergy/ProtocolUtil.h"
#include "synergy/protocol_types.h"
#include "core/ProtocolUtil.h"
#include "core/protocol_types.h"
#include "io/IStream.h"
#include "base/Stopwatch.h"
#include "base/Log.h"

View File

@ -17,7 +17,7 @@
#pragma once
#include "synergy/Chunk.h"
#include "core/Chunk.h"
#include "base/String.h"
#include "common/basic_types.h"

View File

@ -36,7 +36,6 @@ public:
virtual int standardStartup(int argc, char** argv) = 0;
virtual int runInner(int argc, char** argv, ILogOutputter* outputter, StartupFunc startup) = 0;
virtual void startNode() = 0;
virtual IArchTaskBarReceiver* taskBarReceiver() const = 0;
virtual void bye(int error) = 0;
virtual int mainLoop() = 0;
virtual void initApp(int argc, const char** argv) = 0;

View File

@ -19,7 +19,7 @@
#pragma once
#include "common/IInterface.h"
#include "synergy/IApp.h"
#include "core/IApp.h"
class IAppUtil : public IInterface {
public:

View File

@ -18,11 +18,11 @@
#pragma once
#include "synergy/clipboard_types.h"
#include "synergy/IScreen.h"
#include "synergy/key_types.h"
#include "synergy/mouse_types.h"
#include "synergy/option_types.h"
#include "core/clipboard_types.h"
#include "core/IScreen.h"
#include "core/key_types.h"
#include "core/mouse_types.h"
#include "core/option_types.h"
#include "base/String.h"
//! Client interface

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/IClipboard.h"
#include "core/IClipboard.h"
#include "common/stdvector.h"
//

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/IKeyState.h"
#include "core/IKeyState.h"
#include "base/EventQueue.h"
#include <cstring>

View File

@ -18,7 +18,7 @@
#pragma once
#include "synergy/key_types.h"
#include "core/key_types.h"
#include "base/Event.h"
#include "base/String.h"
#include "base/IEventQueue.h"

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/IPlatformScreen.h"
#include "core/IPlatformScreen.h"
bool
IPlatformScreen::fakeMediaKey(KeyID id)

View File

@ -18,13 +18,13 @@
#pragma once
#include "synergy/DragInformation.h"
#include "synergy/clipboard_types.h"
#include "synergy/IScreen.h"
#include "synergy/IPrimaryScreen.h"
#include "synergy/ISecondaryScreen.h"
#include "synergy/IKeyState.h"
#include "synergy/option_types.h"
#include "core/DragInformation.h"
#include "core/clipboard_types.h"
#include "core/IScreen.h"
#include "core/IPrimaryScreen.h"
#include "core/ISecondaryScreen.h"
#include "core/IKeyState.h"
#include "core/option_types.h"
class IClipboard;

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/IPrimaryScreen.h"
#include "core/IPrimaryScreen.h"
#include "base/EventQueue.h"
#include <cstdlib>

View File

@ -18,8 +18,8 @@
#pragma once
#include "synergy/key_types.h"
#include "synergy/mouse_types.h"
#include "core/key_types.h"
#include "core/mouse_types.h"
#include "base/Event.h"
#include "base/EventTypes.h"
#include "common/IInterface.h"

View File

@ -18,7 +18,7 @@
#pragma once
#include "synergy/clipboard_types.h"
#include "core/clipboard_types.h"
#include "base/Event.h"
#include "base/EventTypes.h"
#include "common/IInterface.h"

View File

@ -18,7 +18,7 @@
#pragma once
#include "synergy/mouse_types.h"
#include "core/mouse_types.h"
#include "base/Event.h"
#include "base/EventTypes.h"
#include "common/IInterface.h"

View File

@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/KeyMap.h"
#include "synergy/key_types.h"
#include "core/KeyMap.h"
#include "core/key_types.h"
#include "base/Log.h"
#include <assert.h>

View File

@ -18,7 +18,7 @@
#pragma once
#include "synergy/key_types.h"
#include "core/key_types.h"
#include "base/String.h"
#include "common/stdmap.h"
#include "common/stdset.h"

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/KeyState.h"
#include "core/KeyState.h"
#include "base/Log.h"
#include <cstring>

View File

@ -18,8 +18,8 @@
#pragma once
#include "synergy/IKeyState.h"
#include "synergy/KeyMap.h"
#include "core/IKeyState.h"
#include "core/KeyMap.h"
//! Core key state
/*!

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/PacketStreamFilter.h"
#include "core/PacketStreamFilter.h"
#include "base/IEventQueue.h"
#include "mt/Lock.h"
#include "base/TMethodEventJob.h"

View File

@ -16,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/PlatformScreen.h"
#include "synergy/App.h"
#include "synergy/ArgsBase.h"
#include "core/PlatformScreen.h"
#include "core/App.h"
#include "core/ArgsBase.h"
PlatformScreen::PlatformScreen(IEventQueue* events) :
IPlatformScreen(events),

View File

@ -18,8 +18,8 @@
#pragma once
#include "synergy/IPlatformScreen.h"
#include "synergy/DragInformation.h"
#include "core/IPlatformScreen.h"
#include "core/DragInformation.h"
#include "common/stdexcept.h"
//! Base screen implementation

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/PortableTaskBarReceiver.h"
#include "core/PortableTaskBarReceiver.h"
#include "mt/Lock.h"
#include "base/String.h"
#include "base/IEventQueue.h"

View File

@ -18,7 +18,7 @@
#pragma once
#include "synergy/INode.h"
#include "core/INode.h"
#include "arch/IArchTaskBarReceiver.h"
#include "base/log_outputters.h"
#include "base/EventTypes.h"

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/ProtocolUtil.h"
#include "core/ProtocolUtil.h"
#include "io/IStream.h"
#include "base/Log.h"
#include "common/stdvector.h"

View File

@ -16,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/Screen.h"
#include "synergy/IPlatformScreen.h"
#include "synergy/protocol_types.h"
#include "core/Screen.h"
#include "core/IPlatformScreen.h"
#include "core/protocol_types.h"
#include "base/Log.h"
#include "base/IEventQueue.h"
#include "server/ClientProxy.h"

View File

@ -18,12 +18,12 @@
#pragma once
#include "synergy/DragInformation.h"
#include "synergy/clipboard_types.h"
#include "synergy/IScreen.h"
#include "synergy/key_types.h"
#include "synergy/mouse_types.h"
#include "synergy/option_types.h"
#include "core/DragInformation.h"
#include "core/clipboard_types.h"
#include "core/IScreen.h"
#include "core/key_types.h"
#include "core/mouse_types.h"
#include "core/option_types.h"
#include "base/String.h"
class IClipboard;

View File

@ -16,17 +16,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/ServerApp.h"
#include "core/ServerApp.h"
#include "server/Server.h"
#include "server/ClientListener.h"
#include "server/ClientProxy.h"
#include "server/PrimaryClient.h"
#include "synergy/ArgParser.h"
#include "synergy/Screen.h"
#include "synergy/XScreen.h"
#include "synergy/ServerTaskBarReceiver.h"
#include "synergy/ServerArgs.h"
#include "core/ArgParser.h"
#include "core/Screen.h"
#include "core/XScreen.h"
#include "core/ServerTaskBarReceiver.h"
#include "core/ServerArgs.h"
#include "net/SocketMultiplexer.h"
#include "net/TCPSocketFactory.h"
#include "net/XSocket.h"
@ -64,8 +64,8 @@
// ServerApp
//
ServerApp::ServerApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver) :
App(events, createTaskBarReceiver, new ServerArgs()),
ServerApp::ServerApp(IEventQueue* events) :
App(events, new ServerArgs()),
m_server(NULL),
m_serverState(kUninitialized),
m_serverScreen(NULL),
@ -319,10 +319,6 @@ ServerApp::updateStatus()
void ServerApp::updateStatus(const String& msg)
{
if (m_taskBarReceiver)
{
m_taskBarReceiver->updateStatus(m_server, msg);
}
}
void
@ -799,12 +795,6 @@ ServerApp::runInner(int argc, char** argv, ILogOutputter* outputter, StartupFunc
// run
int result = startup(argc, argv);
if (m_taskBarReceiver)
{
// done with task bar receiver
delete m_taskBarReceiver;
}
delete args().m_config;
delete m_synergyAddress;
return result;

View File

@ -18,14 +18,14 @@
#pragma once
#include "synergy/ArgsBase.h"
#include "synergy/App.h"
#include "core/ArgsBase.h"
#include "core/App.h"
#include "base/String.h"
#include "server/Config.h"
#include "net/NetworkAddress.h"
#include "arch/Arch.h"
#include "arch/IArchMultithread.h"
#include "synergy/ArgsBase.h"
#include "core/ArgsBase.h"
#include "base/EventTypes.h"
#include <map>
@ -49,7 +49,7 @@ class ServerArgs;
class ServerApp : public App {
public:
ServerApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver);
ServerApp(IEventQueue* events);
virtual ~ServerApp();
// Parse server specific command line arguments.

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/ServerArgs.h"
#include "core/ServerArgs.h"
ServerArgs::ServerArgs() :
m_configFile(),

View File

@ -17,7 +17,7 @@
#pragma once
#include "synergy/ArgsBase.h"
#include "core/ArgsBase.h"
#include "shared/SerialKey.h"
class NetworkAddress;

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/ServerTaskBarReceiver.h"
#include "core/ServerTaskBarReceiver.h"
#include "server/Server.h"
#include "mt/Lock.h"
#include "base/String.h"

View File

@ -19,7 +19,7 @@
#pragma once
#include "server/Server.h"
#include "synergy/ServerApp.h"
#include "core/ServerApp.h"
#include "arch/IArchTaskBarReceiver.h"
#include "base/EventTypes.h"
#include "base/String.h"

View File

@ -15,13 +15,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/StreamChunker.h"
#include "core/StreamChunker.h"
#include "mt/Lock.h"
#include "mt/Mutex.h"
#include "synergy/FileChunk.h"
#include "synergy/ClipboardChunk.h"
#include "synergy/protocol_types.h"
#include "core/FileChunk.h"
#include "core/ClipboardChunk.h"
#include "core/protocol_types.h"
#include "base/EventTypes.h"
#include "base/Event.h"
#include "base/IEventQueue.h"

View File

@ -17,7 +17,7 @@
#pragma once
#include "synergy/clipboard_types.h"
#include "core/clipboard_types.h"
#include "base/String.h"
class IEventQueue;

View File

@ -15,9 +15,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/ToolApp.h"
#include "core/ToolApp.h"
#include "synergy/ArgParser.h"
#include "core/ArgParser.h"
#include "arch/Arch.h"
#include "base/Log.h"
#include "base/String.h"

View File

@ -17,8 +17,8 @@
#pragma once
#include "synergy/App.h"
#include "synergy/ToolArgs.h"
#include "core/App.h"
#include "core/ToolArgs.h"
#include "common/basic_types.h"
class ToolApp : public MinimalApp

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/ToolArgs.h"
#include "core/ToolArgs.h"
ToolArgs::ToolArgs() :
m_printActiveDesktopName(false),

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/XScreen.h"
#include "core/XScreen.h"
//
// XScreenOpenFailure

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/XSynergy.h"
#include "core/XSynergy.h"
#include "base/String.h"
//

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/key_types.h"
#include "core/key_types.h"
const KeyNameMapEntry kKeyNameMap[] = {
{ "AltGr", kKeyAltGr },

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/protocol_types.h"
#include "core/protocol_types.h"
const char* kMsgHello = "Synergy%2i%2i";
const char* kMsgHelloBack = "Synergy%2i%2i%s";

View File

@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/unix/AppUtilUnix.h"
#include "synergy/ArgsBase.h"
#include "core/unix/AppUtilUnix.h"
#include "core/ArgsBase.h"
AppUtilUnix::AppUtilUnix(IEventQueue* events)
{

View File

@ -18,7 +18,7 @@
#pragma once
#include "synergy/AppUtil.h"
#include "core/AppUtil.h"
#define ARCH_APP_UTIL AppUtilUnix

View File

@ -16,11 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "synergy/win32/AppUtilWindows.h"
#include "synergy/Screen.h"
#include "synergy/ArgsBase.h"
#include "synergy/App.h"
#include "synergy/XSynergy.h"
#include "core/win32/AppUtilWindows.h"
#include "core/Screen.h"
#include "core/ArgsBase.h"
#include "core/App.h"
#include "core/XSynergy.h"
#include "platform/MSWindowsScreen.h"
#include "arch/win32/XArchWindows.h"
#include "arch/win32/ArchMiscWindows.h"

Some files were not shown because too many files have changed in this diff Show More