1 /* 2 * barrier -- mouse and keyboard sharing utility 3 * Copyright (C) 2012-2016 Symless Ltd. 4 * Copyright (C) 2002 Chris Schoeneman 5 * 6 * This package is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * found in the file LICENSE that should have accompanied this file. 9 * 10 * This package is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #include "barrier/ServerApp.h" 20 #include "arch/Arch.h" 21 #include "base/Log.h" 22 #include "base/EventQueue.h" 23 24 #if WINAPI_MSWINDOWS 25 #include "MSWindowsServerTaskBarReceiver.h" 26 #elif WINAPI_XWINDOWS 27 #include "XWindowsServerTaskBarReceiver.h" 28 #elif WINAPI_CARBON 29 #include "OSXServerTaskBarReceiver.h" 30 #else 31 #error Platform not supported. 32 #endif 33 34 int main(int argc,char ** argv)35main(int argc, char** argv) 36 { 37 #if SYSAPI_WIN32 38 // record window instance for tray icon, etc 39 ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); 40 #endif 41 42 #ifdef __APPLE__ 43 /* Silence "is calling TIS/TSM in non-main thread environment" as it is a red 44 herring that causes a lot of issues to be filed for the MacOS client/server. 45 */ 46 setenv("OS_ACTIVITY_DT_MODE", "NO", true); 47 #endif 48 49 Arch arch; 50 arch.init(); 51 52 Log log; 53 EventQueue events; 54 55 ServerApp app(&events, createTaskBarReceiver); 56 int result = app.run(argc, argv); 57 #if SYSAPI_WIN32 58 if (IsDebuggerPresent()) { 59 printf("\n\nHit a key to close...\n"); 60 getchar(); 61 } 62 #endif 63 return result; 64 } 65