From a71779647d0f8ec7026c9014eec7b1c957c4983e Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Fri, 23 Feb 2018 15:06:27 -0500 Subject: [PATCH 01/37] remove high-level k/m hooks and temporarily remove immune keys implementation in synwinhk --- src/lib/synwinhk/synwinhk.cpp | 236 ++++++++-------------------------- src/lib/synwinhk/synwinhk.h | 8 -- 2 files changed, 52 insertions(+), 192 deletions(-) diff --git a/src/lib/synwinhk/synwinhk.cpp b/src/lib/synwinhk/synwinhk.cpp index 6d7123c5..edee8e0e 100644 --- a/src/lib/synwinhk/synwinhk.cpp +++ b/src/lib/synwinhk/synwinhk.cpp @@ -16,6 +16,54 @@ * along with this program. If not, see . */ + +/* REMOVED ImmuneKeys for migration of synwinhk out of DLL + +// because all of our global data is shared between processes, +// allocating shared data on-the-fly is tricky. therefore let's +// store all of our immune keys in a pre-allocated array. the +// downside here is that we have to pick a maximum number of +// immune keys to store. who would ever want barrier to ignore +// more than 32 keys on their keyboard?? +struct ImmuneKeys +{ +static const std::size_t MaxKeys = 32; +DWORD list[MaxKeys]; +std::size_t count; +}; + +static ImmuneKeys g_immuneKeys{ {0}, 0 }; + +inline static +bool is_immune_key(DWORD target) +{ + for (std::size_t idx = 0; idx < g_immuneKeys.count; ++idx) { + if (g_immuneKeys.list[idx] == target) + return true; + } + return false; +} + +// allow all immune keys to pass without filtering +if (is_immune_key(static_cast(wParam))) + return false; + +// do not call this while the hooks are active! +void +setImmuneKeys(const DWORD *list, std::size_t size) +{ + if (size > ImmuneKeys::MaxKeys) + size = ImmuneKeys::MaxKeys; + g_immuneKeys.count = size; + if (size > 0) { + for (std::size_t idx = 0; idx < size; ++idx) + g_immuneKeys.list[idx] = list[idx]; + } +} + +*/ + + #include "synwinhk/synwinhk.h" #include "barrier/protocol_types.h" @@ -23,18 +71,13 @@ #include #include -#if _MSC_VER >= 1400 -// VS2005 hack - we don't use assert here because we don't want to link with the CRT. #undef assert #if _DEBUG #define assert(_X_) if (!(_X_)) __debugbreak() #else #define assert(_X_) __noop() #endif -// VS2005 is a bit more smart than VC6 and optimize simple copy loop to -// intrinsic memcpy. #pragma function(memcpy) -#endif // // debugging compile flag. when not zero the server doesn't grab @@ -44,12 +87,6 @@ // #define NO_GRAB_KEYBOARD 0 -// -// debugging compile flag. when not zero the server will not -// install low level hooks. -// -#define NO_LOWLEVEL_HOOKS 0 - // // extra mouse wheel stuff // @@ -67,37 +104,6 @@ typedef struct tagMOUSEHOOKSTRUCTWin2000 { DWORD mouseData; } MOUSEHOOKSTRUCTWin2000; -#if !defined(SM_MOUSEWHEELPRESENT) -#define SM_MOUSEWHEELPRESENT 75 -#endif - -// X button stuff -#if !defined(WM_XBUTTONDOWN) -#define WM_XBUTTONDOWN 0x020B -#define WM_XBUTTONUP 0x020C -#define WM_XBUTTONDBLCLK 0x020D -#define WM_NCXBUTTONDOWN 0x00AB -#define WM_NCXBUTTONUP 0x00AC -#define WM_NCXBUTTONDBLCLK 0x00AD -#define MOUSEEVENTF_XDOWN 0x0080 -#define MOUSEEVENTF_XUP 0x0100 -#define XBUTTON1 0x0001 -#define XBUTTON2 0x0002 -#endif - -// because all of our global data is shared between processes, -// allocating shared data on-the-fly is tricky. therefore let's -// store all of our immune keys in a pre-allocated array. the -// downside here is that we have to pick a maximum number of -// immune keys to store. who would ever want barrier to ignore -// more than 32 keys on their keyboard?? -struct ImmuneKeys -{ - static const std::size_t MaxKeys = 32; - DWORD list[MaxKeys]; - std::size_t count; -}; - // // globals // @@ -113,8 +119,6 @@ static DWORD g_processID = 0; static EWheelSupport g_wheelSupport = kWheelNone; static UINT g_wmMouseWheel = 0; static DWORD g_threadID = 0; -static HHOOK g_keyboard = NULL; -static HHOOK g_mouse = NULL; static HHOOK g_getMessage = NULL; static HHOOK g_keyboardLL = NULL; static HHOOK g_mouseLL = NULL; @@ -133,7 +137,6 @@ static BYTE g_deadKeyState[256] = { 0 }; static BYTE g_keyState[256] = { 0 }; static DWORD g_hookThread = 0; static bool g_fakeInput = false; -static ImmuneKeys g_immuneKeys{ {0}, 0 }; #if defined(_MSC_VER) #pragma data_seg() @@ -199,7 +202,7 @@ keyboardGetState(BYTE keys[256], DWORD vkCode, bool kf_up) static bool -doKeyboardHookHandler(WPARAM wParam, LPARAM lParam) +keyboardHookHandler(WPARAM wParam, LPARAM lParam) { DWORD vkCode = static_cast(wParam); bool kf_up = (lParam & (KF_UP << 16)) != 0; @@ -457,31 +460,11 @@ doKeyboardHookHandler(WPARAM wParam, LPARAM lParam) return false; } - -inline static -bool is_immune_key(DWORD target) -{ - for (std::size_t idx = 0; idx < g_immuneKeys.count; ++idx) { - if (g_immuneKeys.list[idx] == target) - return true; - } - return false; -} - -static -bool -keyboardHookHandler(WPARAM wParam, LPARAM lParam) -{ - // allow all immune keys to pass without filtering - if (is_immune_key(static_cast(wParam))) - return false; - return doKeyboardHookHandler(wParam, lParam); -} #endif static bool -doMouseHookHandler(WPARAM wParam, SInt32 x, SInt32 y, SInt32 data) +mouseHookHandler(WPARAM wParam, SInt32 x, SInt32 y, SInt32 data) { switch (wParam) { case WM_LBUTTONDOWN: @@ -581,74 +564,6 @@ doMouseHookHandler(WPARAM wParam, SInt32 x, SInt32 y, SInt32 data) return false; } -static -bool -mouseHookHandler(WPARAM wParam, SInt32 x, SInt32 y, SInt32 data) -{ - return doMouseHookHandler(wParam, x, y, data); -} - -#if !NO_GRAB_KEYBOARD -static -LRESULT CALLBACK -keyboardHook(int code, WPARAM wParam, LPARAM lParam) -{ - if (code >= 0) { - // handle the message - if (keyboardHookHandler(wParam, lParam)) { - return 1; - } - } - - return CallNextHookEx(g_keyboard, code, wParam, lParam); -} -#endif - -static -LRESULT CALLBACK -mouseHook(int code, WPARAM wParam, LPARAM lParam) -{ - if (code >= 0) { - // decode message - const MOUSEHOOKSTRUCT* info = (const MOUSEHOOKSTRUCT*)lParam; - SInt32 x = (SInt32)info->pt.x; - SInt32 y = (SInt32)info->pt.y; - SInt32 w = 0; - if (wParam == WM_MOUSEWHEEL) { - // win2k and other systems supporting WM_MOUSEWHEEL in - // the mouse hook are gratuitously different (and poorly - // documented). if a low-level mouse hook is in place - // it should capture these events so we'll never see - // them. - switch (g_wheelSupport) { - case kWheelModern: - w = static_cast(LOWORD(info->dwExtraInfo)); - break; - - case kWheelWin2000: { - const MOUSEHOOKSTRUCTWin2000* info2k = - (const MOUSEHOOKSTRUCTWin2000*)lParam; - w = static_cast(HIWORD(info2k->mouseData)); - break; - } - - default: - break; - } - } - - // handle the message. note that we don't handle X buttons - // here. that's okay because they're only supported on - // win2k and winxp and up and on those platforms we'll get - // get the mouse events through the low level hook. - if (mouseHookHandler(wParam, x, y, w)) { - return 1; - } - } - - return CallNextHookEx(g_mouse, code, wParam, lParam); -} - static LRESULT CALLBACK getMessageHook(int code, WPARAM wParam, LPARAM lParam) @@ -681,8 +596,6 @@ getMessageHook(int code, WPARAM wParam, LPARAM lParam) return CallNextHookEx(g_getMessage, code, wParam, lParam); } -#if (_WIN32_WINNT >= 0x0400) && defined(_MSC_VER) && !NO_LOWLEVEL_HOOKS - // // low-level keyboard hook -- this allows us to capture and handle // alt+tab, alt+esc, ctrl+esc, and windows key hot keys. on the down @@ -748,8 +661,6 @@ mouseLLHook(int code, WPARAM wParam, LPARAM lParam) return CallNextHookEx(g_mouseLL, code, wParam, lParam); } -#endif - static EWheelSupport getWheelSupport() @@ -922,8 +833,6 @@ init(DWORD threadID) g_processID = GetCurrentProcessId(); g_wheelSupport = kWheelNone; g_threadID = 0; - g_keyboard = NULL; - g_mouse = NULL; g_getMessage = NULL; g_keyboardLL = NULL; g_mouseLL = NULL; @@ -962,8 +871,6 @@ EHookResult install() { assert(g_hinstance != NULL); - assert(g_keyboard == NULL); - assert(g_mouse == NULL); assert(g_getMessage == NULL || g_screenSaver); // must be initialized @@ -990,7 +897,6 @@ install() } // install low-level hooks. we require that they both get installed. -#if (_WIN32_WINNT >= 0x0400) && defined(_MSC_VER) && !NO_LOWLEVEL_HOOKS g_mouseLL = SetWindowsHookEx(WH_MOUSE_LL, &mouseLLHook, g_hinstance, @@ -1011,30 +917,13 @@ install() } } #endif -#endif - - // install regular hooks - if (g_mouseLL == NULL) { - g_mouse = SetWindowsHookEx(WH_MOUSE, - &mouseHook, - g_hinstance, - 0); - } -#if !NO_GRAB_KEYBOARD - if (g_keyboardLL == NULL) { - g_keyboard = SetWindowsHookEx(WH_KEYBOARD, - &keyboardHook, - g_hinstance, - 0); - } -#endif // check that we got all the hooks we wanted if ((g_getMessage == NULL && g_wheelSupport == kWheelOld) || #if !NO_GRAB_KEYBOARD - (g_keyboardLL == NULL && g_keyboard == NULL) || + (g_keyboardLL == NULL) || #endif - (g_mouseLL == NULL && g_mouse == NULL)) { + (g_mouseLL == NULL)) { uninstall(); return kHOOK_FAILED; } @@ -1065,14 +954,6 @@ uninstall(void) UnhookWindowsHookEx(g_mouseLL); g_mouseLL = NULL; } - if (g_keyboard != NULL) { - UnhookWindowsHookEx(g_keyboard); - g_keyboard = NULL; - } - if (g_mouse != NULL) { - UnhookWindowsHookEx(g_mouse); - g_mouse = NULL; - } if (g_getMessage != NULL && !g_screenSaver) { UnhookWindowsHookEx(g_getMessage); g_getMessage = NULL; @@ -1149,17 +1030,4 @@ setMode(EHookMode mode) g_mode = mode; } -// do not call this while the hooks are active! -void -setImmuneKeys(const DWORD *list, std::size_t size) -{ - if (size > ImmuneKeys::MaxKeys) - size = ImmuneKeys::MaxKeys; - g_immuneKeys.count = size; - if (size > 0) { - for (std::size_t idx = 0; idx < size; ++idx) - g_immuneKeys.list[idx] = list[idx]; - } -} - } diff --git a/src/lib/synwinhk/synwinhk.h b/src/lib/synwinhk/synwinhk.h index 32d1068c..4a9df5be 100644 --- a/src/lib/synwinhk/synwinhk.h +++ b/src/lib/synwinhk/synwinhk.h @@ -18,14 +18,6 @@ #pragma once -// hack: vs2005 doesn't declare _WIN32_WINNT, so we need to hard code it. -// however, some say that this should be hard coded since it defines the -// target system, but since this is suposed to compile on pre-XP, maybe -// we should just leave it like this. -#if _MSC_VER == 1400 -#define _WIN32_WINNT 0x0400 -#endif - #include "base/EventTypes.h" #define WIN32_LEAN_AND_MEAN From 30304255ead958a33da563fe29f05a2482f07474 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Fri, 23 Feb 2018 15:42:09 -0500 Subject: [PATCH 02/37] remove *very* old support code for mouse wheels --- src/lib/synwinhk/synwinhk.cpp | 84 ++--------------------------------- 1 file changed, 4 insertions(+), 80 deletions(-) diff --git a/src/lib/synwinhk/synwinhk.cpp b/src/lib/synwinhk/synwinhk.cpp index edee8e0e..559e6302 100644 --- a/src/lib/synwinhk/synwinhk.cpp +++ b/src/lib/synwinhk/synwinhk.cpp @@ -68,7 +68,6 @@ setImmuneKeys(const DWORD *list, std::size_t size) #include "barrier/protocol_types.h" -#include #include #undef assert @@ -93,7 +92,6 @@ setImmuneKeys(const DWORD *list, std::size_t size) enum EWheelSupport { kWheelNone, - kWheelOld, kWheelWin2000, kWheelModern }; @@ -116,8 +114,6 @@ typedef struct tagMOUSEHOOKSTRUCTWin2000 { static HINSTANCE g_hinstance = NULL; static DWORD g_processID = 0; -static EWheelSupport g_wheelSupport = kWheelNone; -static UINT g_wmMouseWheel = 0; static DWORD g_threadID = 0; static HHOOK g_getMessage = NULL; static HHOOK g_keyboardLL = NULL; @@ -578,19 +574,6 @@ getMessageHook(int code, WPARAM wParam, LPARAM lParam) BARRIER_MSG_SCREEN_SAVER, TRUE, 0); } } - if (g_mode == kHOOK_RELAY_EVENTS) { - MSG* msg = reinterpret_cast(lParam); - if (g_wheelSupport == kWheelOld && msg->message == g_wmMouseWheel) { - // post message to our window - PostThreadMessage(g_threadID, - BARRIER_MSG_MOUSE_WHEEL, - static_cast(msg->wParam & 0xffffu), 0); - - // zero out the delta in the message so it's (hopefully) - // ignored - msg->wParam = 0; - } - } } return CallNextHookEx(g_getMessage, code, wParam, lParam); @@ -661,52 +644,6 @@ mouseLLHook(int code, WPARAM wParam, LPARAM lParam) return CallNextHookEx(g_mouseLL, code, wParam, lParam); } -static -EWheelSupport -getWheelSupport() -{ - // see if modern wheel is present - if (GetSystemMetrics(SM_MOUSEWHEELPRESENT)) { - OSVERSIONINFOEX osvi; - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - osvi.dwPlatformId = VER_PLATFORM_WIN32_NT; - osvi.dwMajorVersion = 5; - osvi.dwMinorVersion = 0; - ULONGLONG condMask = 0; - VER_SET_CONDITION (condMask, VER_MAJORVERSION, VER_EQUAL); - VER_SET_CONDITION (condMask, VER_MINORVERSION, VER_EQUAL); - VER_SET_CONDITION (condMask, VER_PLATFORMID, VER_EQUAL); - if (VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION | - VER_PLATFORMID, condMask)) { - return kWheelWin2000; - } - return kWheelModern; - } - - // not modern. see if we've got old-style support. -#if defined(MSH_WHEELSUPPORT) - UINT wheelSupportMsg = RegisterWindowMessage(MSH_WHEELSUPPORT); - HWND wheelSupportWindow = FindWindow(MSH_WHEELMODULE_CLASS, - MSH_WHEELMODULE_TITLE); - if (wheelSupportWindow != NULL && wheelSupportMsg != 0) { - if (SendMessage(wheelSupportWindow, wheelSupportMsg, 0, 0) != 0) { - g_wmMouseWheel = RegisterWindowMessage(MSH_MOUSEWHEEL); - if (g_wmMouseWheel != 0) { - return kWheelOld; - } - } - } -#endif - - // assume modern. we don't do anything special in this case - // except respond to WM_MOUSEWHEEL messages. GetSystemMetrics() - // can apparently return FALSE even if a mouse wheel is present - // though i'm not sure exactly when it does that (WinME returns - // FALSE for my logitech USB trackball). - return kWheelModern; -} - - // // external functions // @@ -831,7 +768,6 @@ init(DWORD threadID) // removed the hooks so we just need to reset our state. g_hinstance = GetModuleHandle(_T("synwinhk")); g_processID = GetCurrentProcessId(); - g_wheelSupport = kWheelNone; g_threadID = 0; g_getMessage = NULL; g_keyboardLL = NULL; @@ -885,17 +821,6 @@ install() // reset fake input flag g_fakeInput = false; - // check for mouse wheel support - g_wheelSupport = getWheelSupport(); - - // install GetMessage hook (unless already installed) - if (g_wheelSupport == kWheelOld && g_getMessage == NULL) { - g_getMessage = SetWindowsHookEx(WH_GETMESSAGE, - &getMessageHook, - g_hinstance, - 0); - } - // install low-level hooks. we require that they both get installed. g_mouseLL = SetWindowsHookEx(WH_MOUSE_LL, &mouseLLHook, @@ -919,11 +844,11 @@ install() #endif // check that we got all the hooks we wanted - if ((g_getMessage == NULL && g_wheelSupport == kWheelOld) || + if ((g_mouseLL == NULL) || #if !NO_GRAB_KEYBOARD - (g_keyboardLL == NULL) || + (g_keyboardLL == NULL) #endif - (g_mouseLL == NULL)) { + ) { uninstall(); return kHOOK_FAILED; } @@ -958,7 +883,6 @@ uninstall(void) UnhookWindowsHookEx(g_getMessage); g_getMessage = NULL; } - g_wheelSupport = kWheelNone; return 1; } @@ -993,7 +917,7 @@ uninstallScreenSaver(void) assert(g_hinstance != NULL); // uninstall hook unless the mouse wheel hook is installed - if (g_getMessage != NULL && g_wheelSupport != kWheelOld) { + if (g_getMessage != NULL) { UnhookWindowsHookEx(g_getMessage); g_getMessage = NULL; } From b1be8227d28f6f9e363375f8e41c4c1152c7079b Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Fri, 23 Feb 2018 16:24:01 -0500 Subject: [PATCH 03/37] missed a couple things: EWheelSupport and immunekeys stuff in header --- src/lib/synwinhk/synwinhk.cpp | 10 ---------- src/lib/synwinhk/synwinhk.h | 7 ++++++- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/lib/synwinhk/synwinhk.cpp b/src/lib/synwinhk/synwinhk.cpp index 559e6302..6b07cbe5 100644 --- a/src/lib/synwinhk/synwinhk.cpp +++ b/src/lib/synwinhk/synwinhk.cpp @@ -86,16 +86,6 @@ setImmuneKeys(const DWORD *list, std::size_t size) // #define NO_GRAB_KEYBOARD 0 -// -// extra mouse wheel stuff -// - -enum EWheelSupport { - kWheelNone, - kWheelWin2000, - kWheelModern -}; - // declare extended mouse hook struct. useable on win2k typedef struct tagMOUSEHOOKSTRUCTWin2000 { MOUSEHOOKSTRUCT mhs; diff --git a/src/lib/synwinhk/synwinhk.h b/src/lib/synwinhk/synwinhk.h index 4a9df5be..92bba7b4 100644 --- a/src/lib/synwinhk/synwinhk.h +++ b/src/lib/synwinhk/synwinhk.h @@ -68,7 +68,6 @@ typedef int (*UninstallScreenSaverFunc)(void); typedef void (*SetSidesFunc)(UInt32); typedef void (*SetZoneFunc)(SInt32, SInt32, SInt32, SInt32, SInt32); typedef void (*SetModeFunc)(int); -typedef void (*SetImmuneKeysFunc)(const DWORD*, std::size_t); CBARRIERHOOK_API int init(DWORD); CBARRIERHOOK_API int cleanup(void); @@ -81,7 +80,13 @@ CBARRIERHOOK_API void setZone(SInt32 x, SInt32 y, SInt32 w, SInt32 h, SInt32 jumpZoneSize); CBARRIERHOOK_API void setMode(EHookMode mode); +/* REMOVED ImmuneKeys for migration of synwinhk out of DLL + +typedef void (*SetImmuneKeysFunc)(const DWORD*, std::size_t); + // do not call setImmuneKeys() while the hooks are active! CBARRIERHOOK_API void setImmuneKeys(const DWORD *list, std::size_t size); +*/ + } From d169555b2825b9f1eecf0f45e6331e51ff375a5d Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Fri, 23 Feb 2018 16:27:56 -0500 Subject: [PATCH 04/37] remove references to immunekeys functions from outside synwinhk --- src/lib/platform/MSWindowsDesks.cpp | 8 ++++---- src/lib/platform/MSWindowsDesks.h | 2 +- src/lib/synwinhk/synwinhk.cpp | 6 ------ 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/lib/platform/MSWindowsDesks.cpp b/src/lib/platform/MSWindowsDesks.cpp index dead5eeb..f5c9ee2a 100644 --- a/src/lib/platform/MSWindowsDesks.cpp +++ b/src/lib/platform/MSWindowsDesks.cpp @@ -369,7 +369,7 @@ MSWindowsDesks::queryHookLibrary(HINSTANCE hookLibrary) if (m_isPrimary && !m_noHooks) { m_install = (InstallFunc)GetProcAddress(hookLibrary, "install"); m_uninstall = (UninstallFunc)GetProcAddress(hookLibrary, "uninstall"); - m_setImmuneKeys = (SetImmuneKeysFunc)GetProcAddress(hookLibrary, "setImmuneKeys"); + //m_setImmuneKeys = (SetImmuneKeysFunc)GetProcAddress(hookLibrary, "setImmuneKeys"); m_installScreensaver = (InstallScreenSaverFunc)GetProcAddress( hookLibrary, "installScreenSaver"); @@ -379,7 +379,7 @@ MSWindowsDesks::queryHookLibrary(HINSTANCE hookLibrary) if (m_install == NULL || m_uninstall == NULL || - m_setImmuneKeys == NULL || + //m_setImmuneKeys == NULL || m_installScreensaver == NULL || m_uninstallScreensaver == NULL) { LOG((CLOG_ERR "Invalid hook library")); @@ -389,7 +389,7 @@ MSWindowsDesks::queryHookLibrary(HINSTANCE hookLibrary) else { m_install = NULL; m_uninstall = NULL; - m_setImmuneKeys = NULL; + //m_setImmuneKeys = NULL; m_installScreensaver = NULL; m_uninstallScreensaver = NULL; } @@ -718,7 +718,7 @@ MSWindowsDesks::deskThread(void* vdesk) // before the hooks are activated auto list = immune_keys_list(); LOG((CLOG_DEBUG "Found %u immune keys", list.size())); - m_setImmuneKeys(list.data(), list.size()); + //m_setImmuneKeys(list.data(), list.size()); switch (m_install()) { case kHOOK_FAILED: // we won't work on this desk diff --git a/src/lib/platform/MSWindowsDesks.h b/src/lib/platform/MSWindowsDesks.h index 6fde3537..11073005 100644 --- a/src/lib/platform/MSWindowsDesks.h +++ b/src/lib/platform/MSWindowsDesks.h @@ -286,7 +286,7 @@ private: // hook library stuff InstallFunc m_install; UninstallFunc m_uninstall; - SetImmuneKeysFunc m_setImmuneKeys; + //SetImmuneKeysFunc m_setImmuneKeys; InstallScreenSaverFunc m_installScreensaver; UninstallScreenSaverFunc diff --git a/src/lib/synwinhk/synwinhk.cpp b/src/lib/synwinhk/synwinhk.cpp index 6b07cbe5..a2102978 100644 --- a/src/lib/synwinhk/synwinhk.cpp +++ b/src/lib/synwinhk/synwinhk.cpp @@ -86,12 +86,6 @@ setImmuneKeys(const DWORD *list, std::size_t size) // #define NO_GRAB_KEYBOARD 0 -// declare extended mouse hook struct. useable on win2k -typedef struct tagMOUSEHOOKSTRUCTWin2000 { - MOUSEHOOKSTRUCT mhs; - DWORD mouseData; -} MOUSEHOOKSTRUCTWin2000; - // // globals // From a3ec43999fbc75cbf6cbbbd528acf380dbc52597 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Fri, 23 Feb 2018 16:30:44 -0500 Subject: [PATCH 05/37] remove local memcpy from synwinhk --- src/lib/synwinhk/synwinhk.cpp | 68 ----------------------------------- 1 file changed, 68 deletions(-) diff --git a/src/lib/synwinhk/synwinhk.cpp b/src/lib/synwinhk/synwinhk.cpp index a2102978..013f2b64 100644 --- a/src/lib/synwinhk/synwinhk.cpp +++ b/src/lib/synwinhk/synwinhk.cpp @@ -76,7 +76,6 @@ setImmuneKeys(const DWORD *list, std::size_t size) #else #define assert(_X_) __noop() #endif -#pragma function(memcpy) // // debugging compile flag. when not zero the server doesn't grab @@ -655,79 +654,12 @@ DllMain(HINSTANCE instance, DWORD reason, LPVOID) extern "C" { -// VS2005 hack to not link with the CRT -#if _MSC_VER >= 1400 BOOL WINAPI _DllMainCRTStartup( HINSTANCE instance, DWORD reason, LPVOID lpreserved) { return DllMain(instance, reason, lpreserved); } -// VS2005 is a bit more bright than VC6 and optimize simple copy loop to -// intrinsic memcpy. -void * __cdecl memcpy(void * _Dst, const void * _Src, size_t _MaxCount) -{ - void * _DstBackup = _Dst; - switch (_MaxCount & 3) { - case 3: - ((char*)_Dst)[0] = ((char*)_Src)[0]; - ++(char*&)_Dst; - ++(char*&)_Src; - --_MaxCount; - case 2: - ((char*)_Dst)[0] = ((char*)_Src)[0]; - ++(char*&)_Dst; - ++(char*&)_Src; - --_MaxCount; - case 1: - ((char*)_Dst)[0] = ((char*)_Src)[0]; - ++(char*&)_Dst; - ++(char*&)_Src; - --_MaxCount; - break; - case 0: - break; - - default: - __assume(0); - break; - } - - // I think it's faster on intel to deference than modify the pointer. - const size_t max = _MaxCount / sizeof(UINT_PTR); - for (size_t i = 0; i < max; ++i) { - ((UINT_PTR*)_Dst)[i] = ((UINT_PTR*)_Src)[i]; - } - - (UINT_PTR*&)_Dst += max; - (UINT_PTR*&)_Src += max; - - switch (_MaxCount & 3) { - case 3: - ((char*)_Dst)[0] = ((char*)_Src)[0]; - ++(char*&)_Dst; - ++(char*&)_Src; - case 2: - ((char*)_Dst)[0] = ((char*)_Src)[0]; - ++(char*&)_Dst; - ++(char*&)_Src; - case 1: - ((char*)_Dst)[0] = ((char*)_Src)[0]; - ++(char*&)_Dst; - ++(char*&)_Src; - break; - case 0: - break; - - default: - __assume(0); - break; - } - - return _DstBackup; -} -#endif - int init(DWORD threadID) { From be0fab1775431aa8a4f2e2467add213047af1fcf Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Fri, 23 Feb 2018 18:06:17 -0500 Subject: [PATCH 06/37] migrate k/m hook handlers from synwinhk to platform/MSWindowsHook and delete synwinhk.dll. for ever and ever. --- src/lib/CMakeLists.txt | 4 - src/lib/platform/CMakeLists.txt | 2 +- src/lib/platform/MSWindowsDesks.cpp | 52 +- src/lib/platform/MSWindowsDesks.h | 15 +- src/lib/platform/MSWindowsHook.cpp | 740 +++++++++++++-- src/lib/platform/MSWindowsHook.h | 15 +- src/lib/platform/MSWindowsScreen.cpp | 2 +- src/lib/platform/MSWindowsScreen.h | 3 +- src/lib/{synwinhk => platform}/synwinhk.h | 22 +- src/lib/synwinhk/CMakeLists.txt | 27 - src/lib/synwinhk/synwinhk.cpp | 873 ------------------ .../platform/MSWindowsKeyStateTests.cpp | 2 +- 12 files changed, 706 insertions(+), 1051 deletions(-) rename src/lib/{synwinhk => platform}/synwinhk.h (70%) delete mode 100644 src/lib/synwinhk/CMakeLists.txt delete mode 100644 src/lib/synwinhk/synwinhk.cpp diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 922e3237..70a0629e 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -25,7 +25,3 @@ add_subdirectory(net) add_subdirectory(platform) add_subdirectory(server) add_subdirectory(barrier) - -if (WIN32) - add_subdirectory(synwinhk) -endif() diff --git a/src/lib/platform/CMakeLists.txt b/src/lib/platform/CMakeLists.txt index 7d11d210..a1718a11 100644 --- a/src/lib/platform/CMakeLists.txt +++ b/src/lib/platform/CMakeLists.txt @@ -15,7 +15,7 @@ # along with this program. If not, see . if (WIN32) - file(GLOB headers "MSWindows*.h" "ImmuneKeysReader.h") + file(GLOB headers "MSWindows*.h" "ImmuneKeysReader.h" "synwinhk.h") file(GLOB sources "MSWindows*.cpp" "ImmuneKeysReader.cpp") elseif (APPLE) file(GLOB headers "OSX*.h" "IOSX*.h") diff --git a/src/lib/platform/MSWindowsDesks.cpp b/src/lib/platform/MSWindowsDesks.cpp index f5c9ee2a..fa8257d1 100644 --- a/src/lib/platform/MSWindowsDesks.cpp +++ b/src/lib/platform/MSWindowsDesks.cpp @@ -1,5 +1,6 @@ /* * barrier -- mouse and keyboard sharing utility + * Copyright (C) 2018 Debauchee Open Source Group * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2004 Chris Schoeneman * @@ -18,7 +19,6 @@ #include "platform/MSWindowsDesks.h" -#include "synwinhk/synwinhk.h" #include "platform/MSWindowsScreen.h" #include "platform/ImmuneKeysReader.h" #include "barrier/IScreenSaver.h" @@ -105,7 +105,7 @@ static std::vector immune_keys_list() // MSWindowsDesks::MSWindowsDesks( - bool isPrimary, bool noHooks, HINSTANCE hookLibrary, + bool isPrimary, bool noHooks, const IScreenSaver* screensaver, IEventQueue* events, IJob* updateKeys, bool stopOnDeskSwitch) : m_isPrimary(isPrimary), @@ -128,9 +128,6 @@ MSWindowsDesks::MSWindowsDesks( { LOG((CLOG_DEBUG "Immune Keys Path: %s", ImmuneKeysPath.c_str())); - if (hookLibrary != NULL) - queryHookLibrary(hookLibrary); - m_cursor = createBlankCursor(); m_deskClass = createDeskWindowClass(m_isPrimary); m_keyLayout = GetKeyboardLayout(GetCurrentThreadId()); @@ -362,39 +359,6 @@ MSWindowsDesks::sendMessage(UINT msg, WPARAM wParam, LPARAM lParam) const } } -void -MSWindowsDesks::queryHookLibrary(HINSTANCE hookLibrary) -{ - // look up functions - if (m_isPrimary && !m_noHooks) { - m_install = (InstallFunc)GetProcAddress(hookLibrary, "install"); - m_uninstall = (UninstallFunc)GetProcAddress(hookLibrary, "uninstall"); - //m_setImmuneKeys = (SetImmuneKeysFunc)GetProcAddress(hookLibrary, "setImmuneKeys"); - m_installScreensaver = - (InstallScreenSaverFunc)GetProcAddress( - hookLibrary, "installScreenSaver"); - m_uninstallScreensaver = - (UninstallScreenSaverFunc)GetProcAddress( - hookLibrary, "uninstallScreenSaver"); - - if (m_install == NULL || - m_uninstall == NULL || - //m_setImmuneKeys == NULL || - m_installScreensaver == NULL || - m_uninstallScreensaver == NULL) { - LOG((CLOG_ERR "Invalid hook library")); - throw XScreenOpenFailure(); - } - } - else { - m_install = NULL; - m_uninstall = NULL; - //m_setImmuneKeys = NULL; - m_installScreensaver = NULL; - m_uninstallScreensaver = NULL; - } -} - HCURSOR MSWindowsDesks::createBlankCursor() const { @@ -709,17 +673,17 @@ MSWindowsDesks::deskThread(void* vdesk) case BARRIER_MSG_SWITCH: if (m_isPrimary && !m_noHooks) { - m_uninstall(); + MSWindowsHook::uninstall(); if (m_screensaverNotify) { - m_uninstallScreensaver(); - m_installScreensaver(); + MSWindowsHook::uninstallScreenSaver(); + MSWindowsHook::installScreenSaver(); } // populate immune keys list in the DLL's shared memory // before the hooks are activated auto list = immune_keys_list(); LOG((CLOG_DEBUG "Found %u immune keys", list.size())); //m_setImmuneKeys(list.data(), list.size()); - switch (m_install()) { + switch (MSWindowsHook::install()) { case kHOOK_FAILED: // we won't work on this desk desk->m_lowLevel = false; @@ -795,10 +759,10 @@ MSWindowsDesks::deskThread(void* vdesk) case BARRIER_MSG_SCREENSAVER: if (!m_noHooks) { if (msg.wParam != 0) { - m_installScreensaver(); + MSWindowsHook::installScreenSaver(); } else { - m_uninstallScreensaver(); + MSWindowsHook::uninstallScreenSaver(); } } break; diff --git a/src/lib/platform/MSWindowsDesks.h b/src/lib/platform/MSWindowsDesks.h index 11073005..da93c34a 100644 --- a/src/lib/platform/MSWindowsDesks.h +++ b/src/lib/platform/MSWindowsDesks.h @@ -1,5 +1,6 @@ /* * barrier -- mouse and keyboard sharing utility + * Copyright (C) 2018 Debauchee Open Source Group * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2004 Chris Schoeneman * @@ -18,7 +19,7 @@ #pragma once -#include "synwinhk/synwinhk.h" +#include "platform/synwinhk.h" #include "barrier/key_types.h" #include "barrier/mouse_types.h" #include "barrier/option_types.h" @@ -65,7 +66,7 @@ public: \p hookLibrary must be a handle to the hook library. */ MSWindowsDesks( - bool isPrimary, bool noHooks, HINSTANCE hookLibrary, + bool isPrimary, bool noHooks, const IScreenSaver* screensaver, IEventQueue* events, IJob* updateKeys, bool stopOnDeskSwitch); ~MSWindowsDesks(); @@ -206,7 +207,6 @@ private: typedef std::map Desks; // initialization and shutdown operations - void queryHookLibrary(HINSTANCE hookLibrary); HCURSOR createBlankCursor() const; void destroyCursor(HCURSOR cursor) const; ATOM createDeskWindowClass(bool isPrimary) const; @@ -283,15 +283,6 @@ private: CondVar m_deskReady; Desks m_desks; - // hook library stuff - InstallFunc m_install; - UninstallFunc m_uninstall; - //SetImmuneKeysFunc m_setImmuneKeys; - InstallScreenSaverFunc - m_installScreensaver; - UninstallScreenSaverFunc - m_uninstallScreensaver; - // keyboard stuff IJob* m_updateKeys; HKL m_keyLayout; diff --git a/src/lib/platform/MSWindowsHook.cpp b/src/lib/platform/MSWindowsHook.cpp index 23cdb75e..c9952e9d 100644 --- a/src/lib/platform/MSWindowsHook.cpp +++ b/src/lib/platform/MSWindowsHook.cpp @@ -1,5 +1,6 @@ /* * barrier -- mouse and keyboard sharing utility + * Copyright (C) 2018 Debauchee Open Source Group * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2011 Chris Schoeneman * @@ -17,19 +18,43 @@ */ #include "platform/MSWindowsHook.h" - +#include "barrier/protocol_types.h" #include "barrier/XScreen.h" #include "base/Log.h" + // + // debugging compile flag. when not zero the server doesn't grab + // the keyboard when the mouse leaves the server screen. this + // makes it possible to use the debugger (via the keyboard) when + // all user input would normally be caught by the hook procedures. + // +#define NO_GRAB_KEYBOARD 0 + static const char* g_name = "synwinhk"; -MSWindowsHook::MSWindowsHook() : - m_initFunc(NULL), - m_cleanupFunc(NULL), - m_setSidesFunc(NULL), - m_setZoneFunc(NULL), - m_setModeFunc(NULL), - m_instance(NULL) +static DWORD g_processID = 0; +static DWORD g_threadID = 0; +static HHOOK g_getMessage = NULL; +static HHOOK g_keyboardLL = NULL; +static HHOOK g_mouseLL = NULL; +static bool g_screenSaver = false; +static EHookMode g_mode = kHOOK_DISABLE; +static UInt32 g_zoneSides = 0; +static SInt32 g_zoneSize = 0; +static SInt32 g_xScreen = 0; +static SInt32 g_yScreen = 0; +static SInt32 g_wScreen = 0; +static SInt32 g_hScreen = 0; +static WPARAM g_deadVirtKey = 0; +static WPARAM g_deadRelease = 0; +static LPARAM g_deadLParam = 0; +static BYTE g_deadKeyState[256] = { 0 }; +static BYTE g_keyState[256] = { 0 }; +static DWORD g_hookThread = 0; +static bool g_fakeServerInput = false; +static BOOL g_isPrimary = TRUE; + +MSWindowsHook::MSWindowsHook() { } @@ -37,92 +62,693 @@ MSWindowsHook::~MSWindowsHook() { cleanup(); - if (m_instance != NULL) { - FreeLibrary(m_instance); + if (g_processID == GetCurrentProcessId()) { + uninstall(); + uninstallScreenSaver(); + g_processID = 0; } } void MSWindowsHook::loadLibrary() { - // load library - m_instance = LoadLibrary(g_name); - if (m_instance == NULL) { - LOG((CLOG_ERR "failed to load hook library, %s.dll is missing or invalid", g_name)); - throw XScreenOpenFailure(); + if (g_processID == 0) { + g_processID = GetCurrentProcessId(); } - - // look up functions - m_setSidesFunc = (SetSidesFunc)GetProcAddress(m_instance, "setSides"); - m_setZoneFunc = (SetZoneFunc)GetProcAddress(m_instance, "setZone"); - m_setModeFunc = (SetModeFunc)GetProcAddress(m_instance, "setMode"); - m_initFunc = (InitFunc)GetProcAddress(m_instance, "init"); - m_cleanupFunc = (CleanupFunc)GetProcAddress(m_instance, "cleanup"); - - if (m_setSidesFunc == NULL || - m_setZoneFunc == NULL || - m_setModeFunc == NULL || - m_initFunc == NULL || - m_cleanupFunc == NULL) { - LOG((CLOG_ERR "failed to load hook function, %s.dll could be out of date", g_name)); - throw XScreenOpenFailure(); - } - - // initialize library if (init(GetCurrentThreadId()) == 0) { - LOG((CLOG_ERR "failed to init %s.dll, another program may be using it", g_name)); - LOG((CLOG_INFO "restarting your computer may solve this error")); + LOG((CLOG_ERR "failed to init hooks handler")); throw XScreenOpenFailure(); } } -HINSTANCE -MSWindowsHook::getInstance() const -{ - return m_instance; -} - int MSWindowsHook::init(DWORD threadID) { - if (m_initFunc == NULL) { - return NULL; + // try to open process that last called init() to see if it's + // still running or if it died without cleaning up. + if (g_processID != 0 && g_processID != GetCurrentProcessId()) { + HANDLE process = OpenProcess(STANDARD_RIGHTS_REQUIRED, + FALSE, g_processID); + if (process != NULL) { + // old process (probably) still exists so refuse to + // reinitialize this DLL (and thus steal it from the + // old process). + int result = CloseHandle(process); + if (result == false) { + return 0; + } + } + + // clean up after old process. the system should've already + // removed the hooks so we just need to reset our state. + g_processID = GetCurrentProcessId(); + g_threadID = 0; + g_getMessage = NULL; + g_keyboardLL = NULL; + g_mouseLL = NULL; + g_screenSaver = false; } - return m_initFunc(threadID); + + // save thread id. we'll post messages to this thread's + // message queue. + g_threadID = threadID; + + // set defaults + g_mode = kHOOK_DISABLE; + g_zoneSides = 0; + g_zoneSize = 0; + g_xScreen = 0; + g_yScreen = 0; + g_wScreen = 0; + g_hScreen = 0; + + return 1; } int MSWindowsHook::cleanup() { - if (m_cleanupFunc == NULL) { - return NULL; + if (g_processID == GetCurrentProcessId()) { + g_threadID = 0; } - return m_cleanupFunc(); + + return 1; } void MSWindowsHook::setSides(UInt32 sides) { - if (m_setSidesFunc == NULL) { - return; - } - m_setSidesFunc(sides); + g_zoneSides = sides; } void MSWindowsHook::setZone(SInt32 x, SInt32 y, SInt32 w, SInt32 h, SInt32 jumpZoneSize) { - if (m_setZoneFunc == NULL) { - return; - } - m_setZoneFunc(x, y, w, h, jumpZoneSize); + g_zoneSize = jumpZoneSize; + g_xScreen = x; + g_yScreen = y; + g_wScreen = w; + g_hScreen = h; } void MSWindowsHook::setMode(EHookMode mode) { - if (m_setModeFunc == NULL) { + g_mode = mode; +} + +#if !NO_GRAB_KEYBOARD +static +void +keyboardGetState(BYTE keys[256], DWORD vkCode, bool kf_up) +{ + // we have to use GetAsyncKeyState() rather than GetKeyState() because + // we don't pass through most keys so the event synchronous state + // doesn't get updated. we do that because certain modifier keys have + // side effects, like alt and the windows key. + if (vkCode < 0 || vkCode >= 256) { return; } - m_setModeFunc(mode); + + // Keep track of key state on our own in case GetAsyncKeyState() fails + g_keyState[vkCode] = kf_up ? 0 : 0x80; + g_keyState[VK_SHIFT] = g_keyState[VK_LSHIFT] | g_keyState[VK_RSHIFT]; + + SHORT key; + // Test whether GetAsyncKeyState() is being honest with us + key = GetAsyncKeyState(vkCode); + + if (key & 0x80) { + // The only time we know for sure that GetAsyncKeyState() is working + // is when it tells us that the current key is down. + // In this case, update g_keyState to reflect what GetAsyncKeyState() + // is telling us, just in case we have gotten out of sync + + for (int i = 0; i < 256; ++i) { + key = GetAsyncKeyState(i); + g_keyState[i] = (BYTE)((key < 0) ? 0x80u : 0); + } + } + + // copy g_keyState to keys + for (int i = 0; i < 256; ++i) { + keys[i] = g_keyState[i]; + } + + key = GetKeyState(VK_CAPITAL); + keys[VK_CAPITAL] = (BYTE)(((key < 0) ? 0x80 : 0) | (key & 1)); } + +static +WPARAM +makeKeyMsg(UINT virtKey, char c, bool noAltGr) +{ + return MAKEWPARAM(MAKEWORD(virtKey & 0xff, (BYTE)c), noAltGr ? 1 : 0); +} + +static +bool +keyboardHookHandler(WPARAM wParam, LPARAM lParam) +{ + DWORD vkCode = static_cast(wParam); + bool kf_up = (lParam & (KF_UP << 16)) != 0; + + // check for special events indicating if we should start or stop + // passing events through and not report them to the server. this + // is used to allow the server to synthesize events locally but + // not pick them up as user events. + if (wParam == BARRIER_HOOK_FAKE_INPUT_VIRTUAL_KEY && + ((lParam >> 16) & 0xffu) == BARRIER_HOOK_FAKE_INPUT_SCANCODE) { + // update flag + g_fakeServerInput = ((lParam & 0x80000000u) == 0); + PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG, + 0xff000000u | wParam, lParam); + + // discard event + return true; + } + + // if we're expecting fake input then just pass the event through + // and do not forward to the server + if (g_fakeServerInput) { + PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG, + 0xfe000000u | wParam, lParam); + return false; + } + + // VK_RSHIFT may be sent with an extended scan code but right shift + // is not an extended key so we reset that bit. + if (wParam == VK_RSHIFT) { + lParam &= ~0x01000000u; + } + + // tell server about event + PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG, wParam, lParam); + + // ignore dead key release + if ((g_deadVirtKey == wParam || g_deadRelease == wParam) && + (lParam & 0x80000000u) != 0) { + g_deadRelease = 0; + PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG, + wParam | 0x04000000, lParam); + return false; + } + + // we need the keyboard state for ToAscii() + BYTE keys[256]; + keyboardGetState(keys, vkCode, kf_up); + + // ToAscii() maps ctrl+letter to the corresponding control code + // and ctrl+backspace to delete. we don't want those translations + // so clear the control modifier state. however, if we want to + // simulate AltGr (which is ctrl+alt) then we must not clear it. + UINT control = keys[VK_CONTROL] | keys[VK_LCONTROL] | keys[VK_RCONTROL]; + UINT menu = keys[VK_MENU] | keys[VK_LMENU] | keys[VK_RMENU]; + if ((control & 0x80) == 0 || (menu & 0x80) == 0) { + keys[VK_LCONTROL] = 0; + keys[VK_RCONTROL] = 0; + keys[VK_CONTROL] = 0; + } else { + keys[VK_LCONTROL] = 0x80; + keys[VK_RCONTROL] = 0x80; + keys[VK_CONTROL] = 0x80; + keys[VK_LMENU] = 0x80; + keys[VK_RMENU] = 0x80; + keys[VK_MENU] = 0x80; + } + + // ToAscii() needs to know if a menu is active for some reason. + // we don't know and there doesn't appear to be any way to find + // out. so we'll just assume a menu is active if the menu key + // is down. + // FIXME -- figure out some way to check if a menu is active + UINT flags = 0; + if ((menu & 0x80) != 0) + flags |= 1; + + // if we're on the server screen then just pass numpad keys with alt + // key down as-is. we won't pick up the resulting character but the + // local app will. if on a client screen then grab keys as usual; + // if the client is a windows system it'll synthesize the expected + // character. if not then it'll probably just do nothing. + if (g_mode != kHOOK_RELAY_EVENTS) { + // we don't use virtual keys because we don't know what the + // state of the numlock key is. we'll hard code the scan codes + // instead. hopefully this works across all keyboards. + UINT sc = (lParam & 0x01ff0000u) >> 16; + if (menu && + (sc >= 0x47u && sc <= 0x52u && sc != 0x4au && sc != 0x4eu)) { + return false; + } + } + + WORD c = 0; + + // map the key event to a character. we have to put the dead + // key back first and this has the side effect of removing it. + if (g_deadVirtKey != 0) { + if (ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16, + g_deadKeyState, &c, flags) == 2) { + // If ToAscii returned 2, it means that we accidentally removed + // a double dead key instead of restoring it. Thus, we call + // ToAscii again with the same parameters to restore the + // internal dead key state. + ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16, + g_deadKeyState, &c, flags); + + // We need to keep track of this because g_deadVirtKey will be + // cleared later on; this would cause the dead key release to + // incorrectly restore the dead key state. + g_deadRelease = g_deadVirtKey; + } + } + + UINT scanCode = ((lParam & 0x10ff0000u) >> 16); + int n = ToAscii((UINT)wParam, scanCode, keys, &c, flags); + + // if mapping failed and ctrl and alt are pressed then try again + // with both not pressed. this handles the case where ctrl and + // alt are being used as individual modifiers rather than AltGr. + // we note that's the case in the message sent back to barrier + // because there's no simple way to deduce it after the fact. + // we have to put the dead key back first, if there was one. + bool noAltGr = false; + if (n == 0 && (control & 0x80) != 0 && (menu & 0x80) != 0) { + noAltGr = true; + PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG, + wParam | 0x05000000, lParam); + if (g_deadVirtKey != 0) { + if (ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16, + g_deadKeyState, &c, flags) == 2) { + ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16, + g_deadKeyState, &c, flags); + g_deadRelease = g_deadVirtKey; + } + } + BYTE keys2[256]; + for (size_t i = 0; i < sizeof(keys) / sizeof(keys[0]); ++i) { + keys2[i] = keys[i]; + } + keys2[VK_LCONTROL] = 0; + keys2[VK_RCONTROL] = 0; + keys2[VK_CONTROL] = 0; + keys2[VK_LMENU] = 0; + keys2[VK_RMENU] = 0; + keys2[VK_MENU] = 0; + n = ToAscii((UINT)wParam, scanCode, keys2, &c, flags); + } + + PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG, + wParam | ((c & 0xff) << 8) | + ((n & 0xff) << 16) | 0x06000000, + lParam); + WPARAM charAndVirtKey = 0; + bool clearDeadKey = false; + switch (n) { + default: + // key is a dead key + + if (lParam & 0x80000000u) + // This handles the obscure situation where a key has been + // pressed which is both a dead key and a normal character + // depending on which modifiers have been pressed. We + // break here to prevent it from being considered a dead + // key. + break; + + g_deadVirtKey = wParam; + g_deadLParam = lParam; + for (size_t i = 0; i < sizeof(keys) / sizeof(keys[0]); ++i) { + g_deadKeyState[i] = keys[i]; + } + break; + + case 0: + // key doesn't map to a character. this can happen if + // non-character keys are pressed after a dead key. + charAndVirtKey = makeKeyMsg((UINT)wParam, (char)0, noAltGr); + break; + + case 1: + // key maps to a character composed with dead key + charAndVirtKey = makeKeyMsg((UINT)wParam, (char)LOBYTE(c), noAltGr); + clearDeadKey = true; + break; + + case 2: { + // previous dead key not composed. send a fake key press + // and release for the dead key to our window. + WPARAM deadCharAndVirtKey = + makeKeyMsg((UINT)g_deadVirtKey, (char)LOBYTE(c), noAltGr); + PostThreadMessage(g_threadID, BARRIER_MSG_KEY, + deadCharAndVirtKey, g_deadLParam & 0x7fffffffu); + PostThreadMessage(g_threadID, BARRIER_MSG_KEY, + deadCharAndVirtKey, g_deadLParam | 0x80000000u); + + // use uncomposed character + charAndVirtKey = makeKeyMsg((UINT)wParam, (char)HIBYTE(c), noAltGr); + clearDeadKey = true; + break; + } + } + + // put back the dead key, if any, for the application to use + if (g_deadVirtKey != 0) { + ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16, + g_deadKeyState, &c, flags); + } + + // clear out old dead key state + if (clearDeadKey) { + g_deadVirtKey = 0; + g_deadLParam = 0; + } + + // forward message to our window. do this whether or not we're + // forwarding events to clients because this'll keep our thread's + // key state table up to date. that's important for querying + // the scroll lock toggle state. + // XXX -- with hot keys for actions we may only need to do this when + // forwarding. + if (charAndVirtKey != 0) { + PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG, + charAndVirtKey | 0x07000000, lParam); + PostThreadMessage(g_threadID, BARRIER_MSG_KEY, charAndVirtKey, lParam); + } + + if (g_mode == kHOOK_RELAY_EVENTS) { + // let certain keys pass through + switch (wParam) { + case VK_CAPITAL: + case VK_NUMLOCK: + case VK_SCROLL: + // pass event on. we want to let these through to + // the window proc because otherwise the keyboard + // lights may not stay synchronized. + break; + + case VK_HANGUL: + // pass these modifiers if using a low level hook, discard + // them if not. + if (g_hookThread == 0) { + return true; + } + break; + + default: + // discard + return true; + } + } + + return false; +} + +static +LRESULT CALLBACK +keyboardLLHook(int code, WPARAM wParam, LPARAM lParam) +{ + if (code >= 0) { + // decode the message + KBDLLHOOKSTRUCT* info = reinterpret_cast(lParam); + WPARAM wParam = info->vkCode; + LPARAM lParam = 1; // repeat code + lParam |= (info->scanCode << 16); // scan code + if (info->flags & LLKHF_EXTENDED) { + lParam |= (1lu << 24); // extended key + } + if (info->flags & LLKHF_ALTDOWN) { + lParam |= (1lu << 29); // context code + } + if (info->flags & LLKHF_UP) { + lParam |= (1lu << 31); // transition + } + // FIXME -- bit 30 should be set if key was already down but + // we don't know that info. as a result we'll never generate + // key repeat events. + + // handle the message + if (keyboardHookHandler(wParam, lParam)) { + return 1; + } + } + + return CallNextHookEx(g_keyboardLL, code, wParam, lParam); +} +#endif // !NO_GRAB_KEYBOARD + +static +bool +mouseHookHandler(WPARAM wParam, SInt32 x, SInt32 y, SInt32 data) +{ + switch (wParam) { + case WM_LBUTTONDOWN: + case WM_MBUTTONDOWN: + case WM_RBUTTONDOWN: + case WM_XBUTTONDOWN: + case WM_LBUTTONDBLCLK: + case WM_MBUTTONDBLCLK: + case WM_RBUTTONDBLCLK: + case WM_XBUTTONDBLCLK: + case WM_LBUTTONUP: + case WM_MBUTTONUP: + case WM_RBUTTONUP: + case WM_XBUTTONUP: + case WM_NCLBUTTONDOWN: + case WM_NCMBUTTONDOWN: + case WM_NCRBUTTONDOWN: + case WM_NCXBUTTONDOWN: + case WM_NCLBUTTONDBLCLK: + case WM_NCMBUTTONDBLCLK: + case WM_NCRBUTTONDBLCLK: + case WM_NCXBUTTONDBLCLK: + case WM_NCLBUTTONUP: + case WM_NCMBUTTONUP: + case WM_NCRBUTTONUP: + case WM_NCXBUTTONUP: + // always relay the event. eat it if relaying. + PostThreadMessage(g_threadID, BARRIER_MSG_MOUSE_BUTTON, wParam, data); + return (g_mode == kHOOK_RELAY_EVENTS); + + case WM_MOUSEWHEEL: + if (g_mode == kHOOK_RELAY_EVENTS) { + // relay event + PostThreadMessage(g_threadID, BARRIER_MSG_MOUSE_WHEEL, data, 0); + } + return (g_mode == kHOOK_RELAY_EVENTS); + + case WM_NCMOUSEMOVE: + case WM_MOUSEMOVE: + if (g_mode == kHOOK_RELAY_EVENTS) { + // relay and eat event + PostThreadMessage(g_threadID, BARRIER_MSG_MOUSE_MOVE, x, y); + return true; + } else if (g_mode == kHOOK_WATCH_JUMP_ZONE) { + // low level hooks can report bogus mouse positions that are + // outside of the screen. jeez. naturally we end up getting + // fake motion in the other direction to get the position back + // on the screen, which plays havoc with switch on double tap. + // Server deals with that. we'll clamp positions onto the + // screen. also, if we discard events for positions outside + // of the screen then the mouse appears to get a bit jerky + // near the edge. we can either accept that or pass the bogus + // events. we'll try passing the events. + bool bogus = false; + if (x < g_xScreen) { + x = g_xScreen; + bogus = true; + } else if (x >= g_xScreen + g_wScreen) { + x = g_xScreen + g_wScreen - 1; + bogus = true; + } + if (y < g_yScreen) { + y = g_yScreen; + bogus = true; + } else if (y >= g_yScreen + g_hScreen) { + y = g_yScreen + g_hScreen - 1; + bogus = true; + } + + // check for mouse inside jump zone + bool inside = false; + if (!inside && (g_zoneSides & kLeftMask) != 0) { + inside = (x < g_xScreen + g_zoneSize); + } + if (!inside && (g_zoneSides & kRightMask) != 0) { + inside = (x >= g_xScreen + g_wScreen - g_zoneSize); + } + if (!inside && (g_zoneSides & kTopMask) != 0) { + inside = (y < g_yScreen + g_zoneSize); + } + if (!inside && (g_zoneSides & kBottomMask) != 0) { + inside = (y >= g_yScreen + g_hScreen - g_zoneSize); + } + + // relay the event + PostThreadMessage(g_threadID, BARRIER_MSG_MOUSE_MOVE, x, y); + + // if inside and not bogus then eat the event + return inside && !bogus; + } + } + + // pass the event + return false; +} + +static +LRESULT CALLBACK +mouseLLHook(int code, WPARAM wParam, LPARAM lParam) +{ + if (code >= 0) { + // decode the message + MSLLHOOKSTRUCT* info = reinterpret_cast(lParam); + SInt32 x = static_cast(info->pt.x); + SInt32 y = static_cast(info->pt.y); + SInt32 w = static_cast(HIWORD(info->mouseData)); + + // handle the message + if (mouseHookHandler(wParam, x, y, w)) { + return 1; + } + } + + return CallNextHookEx(g_mouseLL, code, wParam, lParam); +} + +EHookResult +MSWindowsHook::install() +{ + assert(g_getMessage == NULL || g_screenSaver); + + // must be initialized + if (g_threadID == 0) { + return kHOOK_FAILED; + } + + // discard old dead keys + g_deadVirtKey = 0; + g_deadLParam = 0; + + // reset fake input flag + g_fakeServerInput = false; + + // install low-level hooks. we require that they both get installed. + g_mouseLL = SetWindowsHookEx(WH_MOUSE_LL, + &mouseLLHook, + NULL, + 0); +#if !NO_GRAB_KEYBOARD + g_keyboardLL = SetWindowsHookEx(WH_KEYBOARD_LL, + &keyboardLLHook, + NULL, + 0); + if (g_mouseLL == NULL || g_keyboardLL == NULL) { + if (g_keyboardLL != NULL) { + UnhookWindowsHookEx(g_keyboardLL); + g_keyboardLL = NULL; + } + if (g_mouseLL != NULL) { + UnhookWindowsHookEx(g_mouseLL); + g_mouseLL = NULL; + } + } +#endif + + // check that we got all the hooks we wanted + if ((g_mouseLL == NULL) +#if !NO_GRAB_KEYBOARD + || (g_keyboardLL == NULL) +#endif + ) { + uninstall(); + return kHOOK_FAILED; + } + + if (g_keyboardLL != NULL || g_mouseLL != NULL) { + g_hookThread = GetCurrentThreadId(); + return kHOOK_OKAY_LL; + } + + return kHOOK_OKAY; +} + +int +MSWindowsHook::uninstall() +{ + // discard old dead keys + g_deadVirtKey = 0; + g_deadLParam = 0; + + // uninstall hooks + if (g_keyboardLL != NULL) { + UnhookWindowsHookEx(g_keyboardLL); + g_keyboardLL = NULL; + } + if (g_mouseLL != NULL) { + UnhookWindowsHookEx(g_mouseLL); + g_mouseLL = NULL; + } + if (g_getMessage != NULL && !g_screenSaver) { + UnhookWindowsHookEx(g_getMessage); + g_getMessage = NULL; + } + + return 1; +} + +static +LRESULT CALLBACK +getMessageHook(int code, WPARAM wParam, LPARAM lParam) +{ + if (code >= 0) { + if (g_screenSaver) { + MSG* msg = reinterpret_cast(lParam); + if (msg->message == WM_SYSCOMMAND && + msg->wParam == SC_SCREENSAVE) { + // broadcast screen saver started message + PostThreadMessage(g_threadID, + BARRIER_MSG_SCREEN_SAVER, TRUE, 0); + } + } + } + + return CallNextHookEx(g_getMessage, code, wParam, lParam); +} + +int +MSWindowsHook::installScreenSaver() +{ + // must be initialized + if (g_threadID == 0) { + return 0; + } + + // generate screen saver messages + g_screenSaver = true; + + // install hook unless it's already installed + if (g_getMessage == NULL) { + g_getMessage = SetWindowsHookEx(WH_GETMESSAGE, + &getMessageHook, + NULL, + 0); + } + + return (g_getMessage != NULL) ? 1 : 0; +} + +int +MSWindowsHook::uninstallScreenSaver() +{ + // uninstall hook unless the mouse wheel hook is installed + if (g_getMessage != NULL) { + UnhookWindowsHookEx(g_getMessage); + g_getMessage = NULL; + } + + // screen saver hook is no longer installed + g_screenSaver = false; + + return 1; +} \ No newline at end of file diff --git a/src/lib/platform/MSWindowsHook.h b/src/lib/platform/MSWindowsHook.h index fa836c73..ba551c7f 100644 --- a/src/lib/platform/MSWindowsHook.h +++ b/src/lib/platform/MSWindowsHook.h @@ -1,5 +1,6 @@ /* * barrier -- mouse and keyboard sharing utility + * Copyright (C) 2018 Debauchee Open Source Group * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2011 Chris Schoeneman * @@ -18,7 +19,7 @@ #pragma once -#include "synwinhk/synwinhk.h" +#include "platform/synwinhk.h" #define WIN32_LEAN_AND_MEAN #include @@ -31,18 +32,14 @@ public: virtual ~MSWindowsHook(); void loadLibrary(); - HINSTANCE getInstance() const; int init(DWORD threadID); int cleanup(); void setSides(UInt32 sides); void setZone(SInt32 x, SInt32 y, SInt32 w, SInt32 h, SInt32 jumpZoneSize); void setMode(EHookMode mode); -private: - InitFunc m_initFunc; - CleanupFunc m_cleanupFunc; - SetSidesFunc m_setSidesFunc; - SetZoneFunc m_setZoneFunc; - SetModeFunc m_setModeFunc; - HINSTANCE m_instance; + static EHookResult install(); + static int uninstall(); + static int installScreenSaver(); + static int uninstallScreenSaver(); }; diff --git a/src/lib/platform/MSWindowsScreen.cpp b/src/lib/platform/MSWindowsScreen.cpp index 18e7a972..62c6d620 100644 --- a/src/lib/platform/MSWindowsScreen.cpp +++ b/src/lib/platform/MSWindowsScreen.cpp @@ -1,5 +1,6 @@ /* * barrier -- mouse and keyboard sharing utility + * Copyright (C) 2018 Debauchee Open Source Group * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2002 Chris Schoeneman * @@ -136,7 +137,6 @@ MSWindowsScreen::MSWindowsScreen( m_desks = new MSWindowsDesks( m_isPrimary, m_noHooks, - m_hook.getInstance(), m_screensaver, m_events, new TMethodJob( diff --git a/src/lib/platform/MSWindowsScreen.h b/src/lib/platform/MSWindowsScreen.h index 56c497f6..4245d6c3 100644 --- a/src/lib/platform/MSWindowsScreen.h +++ b/src/lib/platform/MSWindowsScreen.h @@ -1,5 +1,6 @@ /* * barrier -- mouse and keyboard sharing utility + * Copyright (C) 2018 Debauchee Open Source Group * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2002 Chris Schoeneman * @@ -21,7 +22,7 @@ #include "platform/MSWindowsHook.h" #include "barrier/PlatformScreen.h" #include "barrier/DragInformation.h" -#include "synwinhk/synwinhk.h" +#include "platform/synwinhk.h" #include "mt/CondVar.h" #include "mt/Mutex.h" #include "base/String.h" diff --git a/src/lib/synwinhk/synwinhk.h b/src/lib/platform/synwinhk.h similarity index 70% rename from src/lib/synwinhk/synwinhk.h rename to src/lib/platform/synwinhk.h index 92bba7b4..57bb9c65 100644 --- a/src/lib/synwinhk/synwinhk.h +++ b/src/lib/platform/synwinhk.h @@ -1,5 +1,6 @@ /* * barrier -- mouse and keyboard sharing utility + * Copyright (C) 2018 Debauchee Open Source Group * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2002 Chris Schoeneman * @@ -59,27 +60,6 @@ enum EHookMode { kHOOK_RELAY_EVENTS }; -typedef int (*InitFunc)(DWORD targetQueueThreadID); -typedef int (*CleanupFunc)(void); -typedef EHookResult (*InstallFunc)(void); -typedef int (*UninstallFunc)(void); -typedef int (*InstallScreenSaverFunc)(void); -typedef int (*UninstallScreenSaverFunc)(void); -typedef void (*SetSidesFunc)(UInt32); -typedef void (*SetZoneFunc)(SInt32, SInt32, SInt32, SInt32, SInt32); -typedef void (*SetModeFunc)(int); - -CBARRIERHOOK_API int init(DWORD); -CBARRIERHOOK_API int cleanup(void); -CBARRIERHOOK_API EHookResult install(void); -CBARRIERHOOK_API int uninstall(void); -CBARRIERHOOK_API int installScreenSaver(void); -CBARRIERHOOK_API int uninstallScreenSaver(void); -CBARRIERHOOK_API void setSides(UInt32 sides); -CBARRIERHOOK_API void setZone(SInt32 x, SInt32 y, SInt32 w, SInt32 h, - SInt32 jumpZoneSize); -CBARRIERHOOK_API void setMode(EHookMode mode); - /* REMOVED ImmuneKeys for migration of synwinhk out of DLL typedef void (*SetImmuneKeysFunc)(const DWORD*, std::size_t); diff --git a/src/lib/synwinhk/CMakeLists.txt b/src/lib/synwinhk/CMakeLists.txt deleted file mode 100644 index 16eaa500..00000000 --- a/src/lib/synwinhk/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -# barrier -- mouse and keyboard sharing utility -# Copyright (C) 2013-2016 Symless Ltd. -# -# 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 . - -file(GLOB headers "*.h") -file(GLOB sources "*.cpp") - -if (BARRIER_ADD_HEADERS) - list(APPEND sources ${headers}) -endif() - -add_library(synwinhk SHARED ${sources}) - -if (NOT MSVC_VERSION VERSION_LESS 1900) - target_link_libraries(synwinhk libucrt) -endif() diff --git a/src/lib/synwinhk/synwinhk.cpp b/src/lib/synwinhk/synwinhk.cpp deleted file mode 100644 index 013f2b64..00000000 --- a/src/lib/synwinhk/synwinhk.cpp +++ /dev/null @@ -1,873 +0,0 @@ -/* - * barrier -- mouse and keyboard sharing utility - * Copyright (C) 2012-2016 Symless Ltd. - * Copyright (C) 2002 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 . - */ - - -/* REMOVED ImmuneKeys for migration of synwinhk out of DLL - -// because all of our global data is shared between processes, -// allocating shared data on-the-fly is tricky. therefore let's -// store all of our immune keys in a pre-allocated array. the -// downside here is that we have to pick a maximum number of -// immune keys to store. who would ever want barrier to ignore -// more than 32 keys on their keyboard?? -struct ImmuneKeys -{ -static const std::size_t MaxKeys = 32; -DWORD list[MaxKeys]; -std::size_t count; -}; - -static ImmuneKeys g_immuneKeys{ {0}, 0 }; - -inline static -bool is_immune_key(DWORD target) -{ - for (std::size_t idx = 0; idx < g_immuneKeys.count; ++idx) { - if (g_immuneKeys.list[idx] == target) - return true; - } - return false; -} - -// allow all immune keys to pass without filtering -if (is_immune_key(static_cast(wParam))) - return false; - -// do not call this while the hooks are active! -void -setImmuneKeys(const DWORD *list, std::size_t size) -{ - if (size > ImmuneKeys::MaxKeys) - size = ImmuneKeys::MaxKeys; - g_immuneKeys.count = size; - if (size > 0) { - for (std::size_t idx = 0; idx < size; ++idx) - g_immuneKeys.list[idx] = list[idx]; - } -} - -*/ - - -#include "synwinhk/synwinhk.h" - -#include "barrier/protocol_types.h" - -#include - -#undef assert -#if _DEBUG -#define assert(_X_) if (!(_X_)) __debugbreak() -#else -#define assert(_X_) __noop() -#endif - -// -// debugging compile flag. when not zero the server doesn't grab -// the keyboard when the mouse leaves the server screen. this -// makes it possible to use the debugger (via the keyboard) when -// all user input would normally be caught by the hook procedures. -// -#define NO_GRAB_KEYBOARD 0 - -// -// globals -// - -#if defined(_MSC_VER) -#pragma comment(linker, "-section:shared,rws") -#pragma data_seg("shared") -#endif -// all data in this shared section *must* be initialized - -static HINSTANCE g_hinstance = NULL; -static DWORD g_processID = 0; -static DWORD g_threadID = 0; -static HHOOK g_getMessage = NULL; -static HHOOK g_keyboardLL = NULL; -static HHOOK g_mouseLL = NULL; -static bool g_screenSaver = false; -static EHookMode g_mode = kHOOK_DISABLE; -static UInt32 g_zoneSides = 0; -static SInt32 g_zoneSize = 0; -static SInt32 g_xScreen = 0; -static SInt32 g_yScreen = 0; -static SInt32 g_wScreen = 0; -static SInt32 g_hScreen = 0; -static WPARAM g_deadVirtKey = 0; -static WPARAM g_deadRelease = 0; -static LPARAM g_deadLParam = 0; -static BYTE g_deadKeyState[256] = { 0 }; -static BYTE g_keyState[256] = { 0 }; -static DWORD g_hookThread = 0; -static bool g_fakeInput = false; - -#if defined(_MSC_VER) -#pragma data_seg() -#endif - -// keep linker quiet about floating point stuff. we don't use any -// floating point operations but our includes may define some -// (unused) floating point values. -#ifndef _DEBUG -extern "C" { -int _fltused=0; -} -#endif - -#if !NO_GRAB_KEYBOARD -static -WPARAM -makeKeyMsg(UINT virtKey, char c, bool noAltGr) -{ - return MAKEWPARAM(MAKEWORD(virtKey & 0xff, (BYTE)c), noAltGr ? 1 : 0); -} - -static -void -keyboardGetState(BYTE keys[256], DWORD vkCode, bool kf_up) -{ - // we have to use GetAsyncKeyState() rather than GetKeyState() because - // we don't pass through most keys so the event synchronous state - // doesn't get updated. we do that because certain modifier keys have - // side effects, like alt and the windows key. - if (vkCode < 0 || vkCode >= 256) { - return; - } - - // Keep track of key state on our own in case GetAsyncKeyState() fails - g_keyState[vkCode] = kf_up ? 0 : 0x80; - g_keyState[VK_SHIFT] = g_keyState[VK_LSHIFT] | g_keyState[VK_RSHIFT]; - - SHORT key; - // Test whether GetAsyncKeyState() is being honest with us - key = GetAsyncKeyState(vkCode); - - if (key & 0x80) { - // The only time we know for sure that GetAsyncKeyState() is working - // is when it tells us that the current key is down. - // In this case, update g_keyState to reflect what GetAsyncKeyState() - // is telling us, just in case we have gotten out of sync - - for (int i = 0; i < 256; ++i) { - key = GetAsyncKeyState(i); - g_keyState[i] = (BYTE)((key < 0) ? 0x80u : 0); - } - } - - // copy g_keyState to keys - for (int i = 0; i < 256; ++i) { - keys[i] = g_keyState[i]; - } - - key = GetKeyState(VK_CAPITAL); - keys[VK_CAPITAL] = (BYTE)(((key < 0) ? 0x80 : 0) | (key & 1)); -} - -static -bool -keyboardHookHandler(WPARAM wParam, LPARAM lParam) -{ - DWORD vkCode = static_cast(wParam); - bool kf_up = (lParam & (KF_UP << 16)) != 0; - - // check for special events indicating if we should start or stop - // passing events through and not report them to the server. this - // is used to allow the server to synthesize events locally but - // not pick them up as user events. - if (wParam == BARRIER_HOOK_FAKE_INPUT_VIRTUAL_KEY && - ((lParam >> 16) & 0xffu) == BARRIER_HOOK_FAKE_INPUT_SCANCODE) { - // update flag - g_fakeInput = ((lParam & 0x80000000u) == 0); - PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG, - 0xff000000u | wParam, lParam); - - // discard event - return true; - } - - // if we're expecting fake input then just pass the event through - // and do not forward to the server - if (g_fakeInput) { - PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG, - 0xfe000000u | wParam, lParam); - return false; - } - - // VK_RSHIFT may be sent with an extended scan code but right shift - // is not an extended key so we reset that bit. - if (wParam == VK_RSHIFT) { - lParam &= ~0x01000000u; - } - - // tell server about event - PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG, wParam, lParam); - - // ignore dead key release - if ((g_deadVirtKey == wParam || g_deadRelease == wParam) && - (lParam & 0x80000000u) != 0) { - g_deadRelease = 0; - PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG, - wParam | 0x04000000, lParam); - return false; - } - - // we need the keyboard state for ToAscii() - BYTE keys[256]; - keyboardGetState(keys, vkCode, kf_up); - - // ToAscii() maps ctrl+letter to the corresponding control code - // and ctrl+backspace to delete. we don't want those translations - // so clear the control modifier state. however, if we want to - // simulate AltGr (which is ctrl+alt) then we must not clear it. - UINT control = keys[VK_CONTROL] | keys[VK_LCONTROL] | keys[VK_RCONTROL]; - UINT menu = keys[VK_MENU] | keys[VK_LMENU] | keys[VK_RMENU]; - if ((control & 0x80) == 0 || (menu & 0x80) == 0) { - keys[VK_LCONTROL] = 0; - keys[VK_RCONTROL] = 0; - keys[VK_CONTROL] = 0; - } - else { - keys[VK_LCONTROL] = 0x80; - keys[VK_RCONTROL] = 0x80; - keys[VK_CONTROL] = 0x80; - keys[VK_LMENU] = 0x80; - keys[VK_RMENU] = 0x80; - keys[VK_MENU] = 0x80; - } - - // ToAscii() needs to know if a menu is active for some reason. - // we don't know and there doesn't appear to be any way to find - // out. so we'll just assume a menu is active if the menu key - // is down. - // FIXME -- figure out some way to check if a menu is active - UINT flags = 0; - if ((menu & 0x80) != 0) - flags |= 1; - - // if we're on the server screen then just pass numpad keys with alt - // key down as-is. we won't pick up the resulting character but the - // local app will. if on a client screen then grab keys as usual; - // if the client is a windows system it'll synthesize the expected - // character. if not then it'll probably just do nothing. - if (g_mode != kHOOK_RELAY_EVENTS) { - // we don't use virtual keys because we don't know what the - // state of the numlock key is. we'll hard code the scan codes - // instead. hopefully this works across all keyboards. - UINT sc = (lParam & 0x01ff0000u) >> 16; - if (menu && - (sc >= 0x47u && sc <= 0x52u && sc != 0x4au && sc != 0x4eu)) { - return false; - } - } - - WORD c = 0; - - // map the key event to a character. we have to put the dead - // key back first and this has the side effect of removing it. - if (g_deadVirtKey != 0) { - if (ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16, - g_deadKeyState, &c, flags) == 2) - { - // If ToAscii returned 2, it means that we accidentally removed - // a double dead key instead of restoring it. Thus, we call - // ToAscii again with the same parameters to restore the - // internal dead key state. - ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16, - g_deadKeyState, &c, flags); - - // We need to keep track of this because g_deadVirtKey will be - // cleared later on; this would cause the dead key release to - // incorrectly restore the dead key state. - g_deadRelease = g_deadVirtKey; - } - } - - UINT scanCode = ((lParam & 0x10ff0000u) >> 16); - int n = ToAscii((UINT)wParam, scanCode, keys, &c, flags); - - // if mapping failed and ctrl and alt are pressed then try again - // with both not pressed. this handles the case where ctrl and - // alt are being used as individual modifiers rather than AltGr. - // we note that's the case in the message sent back to barrier - // because there's no simple way to deduce it after the fact. - // we have to put the dead key back first, if there was one. - bool noAltGr = false; - if (n == 0 && (control & 0x80) != 0 && (menu & 0x80) != 0) { - noAltGr = true; - PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG, - wParam | 0x05000000, lParam); - if (g_deadVirtKey != 0) { - if (ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16, - g_deadKeyState, &c, flags) == 2) - { - ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16, - g_deadKeyState, &c, flags); - g_deadRelease = g_deadVirtKey; - } - } - BYTE keys2[256]; - for (size_t i = 0; i < sizeof(keys) / sizeof(keys[0]); ++i) { - keys2[i] = keys[i]; - } - keys2[VK_LCONTROL] = 0; - keys2[VK_RCONTROL] = 0; - keys2[VK_CONTROL] = 0; - keys2[VK_LMENU] = 0; - keys2[VK_RMENU] = 0; - keys2[VK_MENU] = 0; - n = ToAscii((UINT)wParam, scanCode, keys2, &c, flags); - } - - PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG, - wParam | ((c & 0xff) << 8) | - ((n & 0xff) << 16) | 0x06000000, - lParam); - WPARAM charAndVirtKey = 0; - bool clearDeadKey = false; - switch (n) { - default: - // key is a dead key - - if (lParam & 0x80000000u) - // This handles the obscure situation where a key has been - // pressed which is both a dead key and a normal character - // depending on which modifiers have been pressed. We - // break here to prevent it from being considered a dead - // key. - break; - - g_deadVirtKey = wParam; - g_deadLParam = lParam; - for (size_t i = 0; i < sizeof(keys) / sizeof(keys[0]); ++i) { - g_deadKeyState[i] = keys[i]; - } - break; - - case 0: - // key doesn't map to a character. this can happen if - // non-character keys are pressed after a dead key. - charAndVirtKey = makeKeyMsg((UINT)wParam, (char)0, noAltGr); - break; - - case 1: - // key maps to a character composed with dead key - charAndVirtKey = makeKeyMsg((UINT)wParam, (char)LOBYTE(c), noAltGr); - clearDeadKey = true; - break; - - case 2: { - // previous dead key not composed. send a fake key press - // and release for the dead key to our window. - WPARAM deadCharAndVirtKey = - makeKeyMsg((UINT)g_deadVirtKey, (char)LOBYTE(c), noAltGr); - PostThreadMessage(g_threadID, BARRIER_MSG_KEY, - deadCharAndVirtKey, g_deadLParam & 0x7fffffffu); - PostThreadMessage(g_threadID, BARRIER_MSG_KEY, - deadCharAndVirtKey, g_deadLParam | 0x80000000u); - - // use uncomposed character - charAndVirtKey = makeKeyMsg((UINT)wParam, (char)HIBYTE(c), noAltGr); - clearDeadKey = true; - break; - } - } - - // put back the dead key, if any, for the application to use - if (g_deadVirtKey != 0) { - ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16, - g_deadKeyState, &c, flags); - } - - // clear out old dead key state - if (clearDeadKey) { - g_deadVirtKey = 0; - g_deadLParam = 0; - } - - // forward message to our window. do this whether or not we're - // forwarding events to clients because this'll keep our thread's - // key state table up to date. that's important for querying - // the scroll lock toggle state. - // XXX -- with hot keys for actions we may only need to do this when - // forwarding. - if (charAndVirtKey != 0) { - PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG, - charAndVirtKey | 0x07000000, lParam); - PostThreadMessage(g_threadID, BARRIER_MSG_KEY, charAndVirtKey, lParam); - } - - if (g_mode == kHOOK_RELAY_EVENTS) { - // let certain keys pass through - switch (wParam) { - case VK_CAPITAL: - case VK_NUMLOCK: - case VK_SCROLL: - // pass event on. we want to let these through to - // the window proc because otherwise the keyboard - // lights may not stay synchronized. - break; - - case VK_HANGUL: - // pass these modifiers if using a low level hook, discard - // them if not. - if (g_hookThread == 0) { - return true; - } - break; - - default: - // discard - return true; - } - } - - return false; -} -#endif - -static -bool -mouseHookHandler(WPARAM wParam, SInt32 x, SInt32 y, SInt32 data) -{ - switch (wParam) { - case WM_LBUTTONDOWN: - case WM_MBUTTONDOWN: - case WM_RBUTTONDOWN: - case WM_XBUTTONDOWN: - case WM_LBUTTONDBLCLK: - case WM_MBUTTONDBLCLK: - case WM_RBUTTONDBLCLK: - case WM_XBUTTONDBLCLK: - case WM_LBUTTONUP: - case WM_MBUTTONUP: - case WM_RBUTTONUP: - case WM_XBUTTONUP: - case WM_NCLBUTTONDOWN: - case WM_NCMBUTTONDOWN: - case WM_NCRBUTTONDOWN: - case WM_NCXBUTTONDOWN: - case WM_NCLBUTTONDBLCLK: - case WM_NCMBUTTONDBLCLK: - case WM_NCRBUTTONDBLCLK: - case WM_NCXBUTTONDBLCLK: - case WM_NCLBUTTONUP: - case WM_NCMBUTTONUP: - case WM_NCRBUTTONUP: - case WM_NCXBUTTONUP: - // always relay the event. eat it if relaying. - PostThreadMessage(g_threadID, BARRIER_MSG_MOUSE_BUTTON, wParam, data); - return (g_mode == kHOOK_RELAY_EVENTS); - - case WM_MOUSEWHEEL: - if (g_mode == kHOOK_RELAY_EVENTS) { - // relay event - PostThreadMessage(g_threadID, BARRIER_MSG_MOUSE_WHEEL, data, 0); - } - return (g_mode == kHOOK_RELAY_EVENTS); - - case WM_NCMOUSEMOVE: - case WM_MOUSEMOVE: - if (g_mode == kHOOK_RELAY_EVENTS) { - // relay and eat event - PostThreadMessage(g_threadID, BARRIER_MSG_MOUSE_MOVE, x, y); - return true; - } - else if (g_mode == kHOOK_WATCH_JUMP_ZONE) { - // low level hooks can report bogus mouse positions that are - // outside of the screen. jeez. naturally we end up getting - // fake motion in the other direction to get the position back - // on the screen, which plays havoc with switch on double tap. - // Server deals with that. we'll clamp positions onto the - // screen. also, if we discard events for positions outside - // of the screen then the mouse appears to get a bit jerky - // near the edge. we can either accept that or pass the bogus - // events. we'll try passing the events. - bool bogus = false; - if (x < g_xScreen) { - x = g_xScreen; - bogus = true; - } - else if (x >= g_xScreen + g_wScreen) { - x = g_xScreen + g_wScreen - 1; - bogus = true; - } - if (y < g_yScreen) { - y = g_yScreen; - bogus = true; - } - else if (y >= g_yScreen + g_hScreen) { - y = g_yScreen + g_hScreen - 1; - bogus = true; - } - - // check for mouse inside jump zone - bool inside = false; - if (!inside && (g_zoneSides & kLeftMask) != 0) { - inside = (x < g_xScreen + g_zoneSize); - } - if (!inside && (g_zoneSides & kRightMask) != 0) { - inside = (x >= g_xScreen + g_wScreen - g_zoneSize); - } - if (!inside && (g_zoneSides & kTopMask) != 0) { - inside = (y < g_yScreen + g_zoneSize); - } - if (!inside && (g_zoneSides & kBottomMask) != 0) { - inside = (y >= g_yScreen + g_hScreen - g_zoneSize); - } - - // relay the event - PostThreadMessage(g_threadID, BARRIER_MSG_MOUSE_MOVE, x, y); - - // if inside and not bogus then eat the event - return inside && !bogus; - } - } - - // pass the event - return false; -} - -static -LRESULT CALLBACK -getMessageHook(int code, WPARAM wParam, LPARAM lParam) -{ - if (code >= 0) { - if (g_screenSaver) { - MSG* msg = reinterpret_cast(lParam); - if (msg->message == WM_SYSCOMMAND && - msg->wParam == SC_SCREENSAVE) { - // broadcast screen saver started message - PostThreadMessage(g_threadID, - BARRIER_MSG_SCREEN_SAVER, TRUE, 0); - } - } - } - - return CallNextHookEx(g_getMessage, code, wParam, lParam); -} - -// -// low-level keyboard hook -- this allows us to capture and handle -// alt+tab, alt+esc, ctrl+esc, and windows key hot keys. on the down -// side, key repeats are not reported to us. -// - -#if !NO_GRAB_KEYBOARD -static -LRESULT CALLBACK -keyboardLLHook(int code, WPARAM wParam, LPARAM lParam) -{ - if (code >= 0) { - // decode the message - KBDLLHOOKSTRUCT* info = reinterpret_cast(lParam); - WPARAM wParam = info->vkCode; - LPARAM lParam = 1; // repeat code - lParam |= (info->scanCode << 16); // scan code - if (info->flags & LLKHF_EXTENDED) { - lParam |= (1lu << 24); // extended key - } - if (info->flags & LLKHF_ALTDOWN) { - lParam |= (1lu << 29); // context code - } - if (info->flags & LLKHF_UP) { - lParam |= (1lu << 31); // transition - } - // FIXME -- bit 30 should be set if key was already down but - // we don't know that info. as a result we'll never generate - // key repeat events. - - // handle the message - if (keyboardHookHandler(wParam, lParam)) { - return 1; - } - } - - return CallNextHookEx(g_keyboardLL, code, wParam, lParam); -} -#endif - -// -// low-level mouse hook -- this allows us to capture and handle mouse -// events very early. the earlier the better. -// - -static -LRESULT CALLBACK -mouseLLHook(int code, WPARAM wParam, LPARAM lParam) -{ - if (code >= 0) { - // decode the message - MSLLHOOKSTRUCT* info = reinterpret_cast(lParam); - SInt32 x = static_cast(info->pt.x); - SInt32 y = static_cast(info->pt.y); - SInt32 w = static_cast(HIWORD(info->mouseData)); - - // handle the message - if (mouseHookHandler(wParam, x, y, w)) { - return 1; - } - } - - return CallNextHookEx(g_mouseLL, code, wParam, lParam); -} - -// -// external functions -// - -BOOL WINAPI -DllMain(HINSTANCE instance, DWORD reason, LPVOID) -{ - if (reason == DLL_PROCESS_ATTACH) { - DisableThreadLibraryCalls(instance); - if (g_processID == 0) { - g_hinstance = instance; - g_processID = GetCurrentProcessId(); - } - } - else if (reason == DLL_PROCESS_DETACH) { - if (g_processID == GetCurrentProcessId()) { - uninstall(); - uninstallScreenSaver(); - g_processID = 0; - g_hinstance = NULL; - } - } - return TRUE; -} - -extern "C" { - -BOOL WINAPI _DllMainCRTStartup( - HINSTANCE instance, DWORD reason, LPVOID lpreserved) -{ - return DllMain(instance, reason, lpreserved); -} - -int -init(DWORD threadID) -{ - assert(g_hinstance != NULL); - - // try to open process that last called init() to see if it's - // still running or if it died without cleaning up. - if (g_processID != 0 && g_processID != GetCurrentProcessId()) { - HANDLE process = OpenProcess(STANDARD_RIGHTS_REQUIRED, - FALSE, g_processID); - if (process != NULL) { - // old process (probably) still exists so refuse to - // reinitialize this DLL (and thus steal it from the - // old process). - int result = CloseHandle(process); - if (result == false) { - return 0; - } - } - - // clean up after old process. the system should've already - // removed the hooks so we just need to reset our state. - g_hinstance = GetModuleHandle(_T("synwinhk")); - g_processID = GetCurrentProcessId(); - g_threadID = 0; - g_getMessage = NULL; - g_keyboardLL = NULL; - g_mouseLL = NULL; - g_screenSaver = false; - } - - // save thread id. we'll post messages to this thread's - // message queue. - g_threadID = threadID; - - // set defaults - g_mode = kHOOK_DISABLE; - g_zoneSides = 0; - g_zoneSize = 0; - g_xScreen = 0; - g_yScreen = 0; - g_wScreen = 0; - g_hScreen = 0; - - return 1; -} - -int -cleanup(void) -{ - assert(g_hinstance != NULL); - - if (g_processID == GetCurrentProcessId()) { - g_threadID = 0; - } - - return 1; -} - -EHookResult -install() -{ - assert(g_hinstance != NULL); - assert(g_getMessage == NULL || g_screenSaver); - - // must be initialized - if (g_threadID == 0) { - return kHOOK_FAILED; - } - - // discard old dead keys - g_deadVirtKey = 0; - g_deadLParam = 0; - - // reset fake input flag - g_fakeInput = false; - - // install low-level hooks. we require that they both get installed. - g_mouseLL = SetWindowsHookEx(WH_MOUSE_LL, - &mouseLLHook, - g_hinstance, - 0); -#if !NO_GRAB_KEYBOARD - g_keyboardLL = SetWindowsHookEx(WH_KEYBOARD_LL, - &keyboardLLHook, - g_hinstance, - 0); - if (g_mouseLL == NULL || g_keyboardLL == NULL) { - if (g_keyboardLL != NULL) { - UnhookWindowsHookEx(g_keyboardLL); - g_keyboardLL = NULL; - } - if (g_mouseLL != NULL) { - UnhookWindowsHookEx(g_mouseLL); - g_mouseLL = NULL; - } - } -#endif - - // check that we got all the hooks we wanted - if ((g_mouseLL == NULL) || -#if !NO_GRAB_KEYBOARD - (g_keyboardLL == NULL) -#endif - ) { - uninstall(); - return kHOOK_FAILED; - } - - if (g_keyboardLL != NULL || g_mouseLL != NULL) { - g_hookThread = GetCurrentThreadId(); - return kHOOK_OKAY_LL; - } - - return kHOOK_OKAY; -} - -int -uninstall(void) -{ - assert(g_hinstance != NULL); - - // discard old dead keys - g_deadVirtKey = 0; - g_deadLParam = 0; - - // uninstall hooks - if (g_keyboardLL != NULL) { - UnhookWindowsHookEx(g_keyboardLL); - g_keyboardLL = NULL; - } - if (g_mouseLL != NULL) { - UnhookWindowsHookEx(g_mouseLL); - g_mouseLL = NULL; - } - if (g_getMessage != NULL && !g_screenSaver) { - UnhookWindowsHookEx(g_getMessage); - g_getMessage = NULL; - } - - return 1; -} - -int -installScreenSaver(void) -{ - assert(g_hinstance != NULL); - - // must be initialized - if (g_threadID == 0) { - return 0; - } - - // generate screen saver messages - g_screenSaver = true; - - // install hook unless it's already installed - if (g_getMessage == NULL) { - g_getMessage = SetWindowsHookEx(WH_GETMESSAGE, - &getMessageHook, - g_hinstance, - 0); - } - - return (g_getMessage != NULL) ? 1 : 0; -} - -int -uninstallScreenSaver(void) -{ - assert(g_hinstance != NULL); - - // uninstall hook unless the mouse wheel hook is installed - if (g_getMessage != NULL) { - UnhookWindowsHookEx(g_getMessage); - g_getMessage = NULL; - } - - // screen saver hook is no longer installed - g_screenSaver = false; - - return 1; -} - -void -setSides(UInt32 sides) -{ - g_zoneSides = sides; -} - -void -setZone(SInt32 x, SInt32 y, SInt32 w, SInt32 h, SInt32 jumpZoneSize) -{ - g_zoneSize = jumpZoneSize; - g_xScreen = x; - g_yScreen = y; - g_wScreen = w; - g_hScreen = h; -} - -void -setMode(EHookMode mode) -{ - if (mode == g_mode) { - // no change - return; - } - g_mode = mode; -} - -} diff --git a/src/test/integtests/platform/MSWindowsKeyStateTests.cpp b/src/test/integtests/platform/MSWindowsKeyStateTests.cpp index 474a0b86..f3f9e32c 100644 --- a/src/test/integtests/platform/MSWindowsKeyStateTests.cpp +++ b/src/test/integtests/platform/MSWindowsKeyStateTests.cpp @@ -52,7 +52,7 @@ protected: MSWindowsDesks* newDesks(IEventQueue* eventQueue) { return new MSWindowsDesks( - true, false, m_hook.getInstance(), m_screensaver, eventQueue, + true, false, m_screensaver, eventQueue, new TMethodJob( this, &MSWindowsKeyStateTests::updateKeysCB), false); } From 0e5ed7a3051b72f56439190bf1c91d84ea6aa01d Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Fri, 23 Feb 2018 20:56:12 -0500 Subject: [PATCH 07/37] clean up the hook management code --- src/lib/platform/MSWindowsDesks.cpp | 76 ++----- src/lib/platform/MSWindowsHook.cpp | 233 ++++----------------- src/lib/platform/MSWindowsHook.h | 14 +- src/lib/platform/MSWindowsHookResource.cpp | 33 +++ src/lib/platform/MSWindowsHookResource.h | 20 ++ src/lib/platform/MSWindowsScreen.cpp | 4 - src/lib/platform/synwinhk.h | 6 - 7 files changed, 118 insertions(+), 268 deletions(-) create mode 100644 src/lib/platform/MSWindowsHookResource.cpp create mode 100644 src/lib/platform/MSWindowsHookResource.h diff --git a/src/lib/platform/MSWindowsDesks.cpp b/src/lib/platform/MSWindowsDesks.cpp index fa8257d1..8a4f3b7c 100644 --- a/src/lib/platform/MSWindowsDesks.cpp +++ b/src/lib/platform/MSWindowsDesks.cpp @@ -547,7 +547,7 @@ MSWindowsDesks::deskEnter(Desk* desk) AttachThreadInput(thatThread, thisThread, TRUE); SetForegroundWindow(desk->m_foregroundWindow); AttachThreadInput(thatThread, thisThread, FALSE); - EnableWindow(desk->m_window, desk->m_lowLevel ? FALSE : TRUE); + EnableWindow(desk->m_window, FALSE); desk->m_foregroundWindow = NULL; } @@ -560,35 +560,16 @@ MSWindowsDesks::deskLeave(Desk* desk, HKL keyLayout) // layout we choose rather than the keyboard layout of the last // active window. int x, y, w, h; - if (desk->m_lowLevel) { - // with a low level hook the cursor will never budge so - // just a 1x1 window is sufficient. - x = m_xCenter; - y = m_yCenter; - w = 1; - h = 1; - } - else { - // with regular hooks the cursor will jitter as it's moved - // by the user then back to the center by us. to be sure - // we never lose it, cover all the monitors with the window. - x = m_x; - y = m_y; - w = m_w; - h = m_h; - } + // with a low level hook the cursor will never budge so + // just a 1x1 window is sufficient. + x = m_xCenter; + y = m_yCenter; + w = 1; + h = 1; SetWindowPos(desk->m_window, HWND_TOP, x, y, w, h, SWP_NOACTIVATE | SWP_SHOWWINDOW); - // 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 BARRIER_MSG_SWITCH). - if (!desk->m_lowLevel) { - SetActiveWindow(desk->m_window); - } - - // if using low-level hooks then disable the foreground window + // since we're using low-level hooks, disable the foreground window // so it can't mess up any of our keyboard events. the console // program, for example, will cause characters to be reported as // unshifted, regardless of the shift key state. interestingly @@ -596,19 +577,17 @@ MSWindowsDesks::deskLeave(Desk* desk, HKL keyLayout) // // note that we must enable the window to activate it and we // need to disable the window on deskEnter. - else { - desk->m_foregroundWindow = getForegroundWindow(); - if (desk->m_foregroundWindow != NULL) { - EnableWindow(desk->m_window, TRUE); - SetActiveWindow(desk->m_window); - DWORD thisThread = - GetWindowThreadProcessId(desk->m_window, NULL); - DWORD thatThread = - GetWindowThreadProcessId(desk->m_foregroundWindow, NULL); - AttachThreadInput(thatThread, thisThread, TRUE); - SetForegroundWindow(desk->m_window); - AttachThreadInput(thatThread, thisThread, FALSE); - } + desk->m_foregroundWindow = getForegroundWindow(); + if (desk->m_foregroundWindow != NULL) { + EnableWindow(desk->m_window, TRUE); + SetActiveWindow(desk->m_window); + DWORD thisThread = + GetWindowThreadProcessId(desk->m_window, NULL); + DWORD thatThread = + GetWindowThreadProcessId(desk->m_foregroundWindow, NULL); + AttachThreadInput(thatThread, thisThread, TRUE); + SetForegroundWindow(desk->m_window); + AttachThreadInput(thatThread, thisThread, FALSE); } // switch to requested keyboard layout @@ -683,25 +662,14 @@ MSWindowsDesks::deskThread(void* vdesk) auto list = immune_keys_list(); LOG((CLOG_DEBUG "Found %u immune keys", list.size())); //m_setImmuneKeys(list.data(), list.size()); - switch (MSWindowsHook::install()) { - case kHOOK_FAILED: + if (!MSWindowsHook::install()) { // we won't work on this desk - desk->m_lowLevel = false; - break; - - case kHOOK_OKAY: - desk->m_lowLevel = false; - break; - - case kHOOK_OKAY_LL: - desk->m_lowLevel = true; - break; + LOG((CLOG_DEBUG "Cannot hook on this desk")); } - // a window on the primary screen with low-level hooks // should never activate. if (desk->m_window) - EnableWindow(desk->m_window, desk->m_lowLevel ? FALSE : TRUE); + EnableWindow(desk->m_window, FALSE); } break; diff --git a/src/lib/platform/MSWindowsHook.cpp b/src/lib/platform/MSWindowsHook.cpp index c9952e9d..a27ef981 100644 --- a/src/lib/platform/MSWindowsHook.cpp +++ b/src/lib/platform/MSWindowsHook.cpp @@ -18,6 +18,7 @@ */ #include "platform/MSWindowsHook.h" +#include "platform/MSWindowsHookResource.h" #include "barrier/protocol_types.h" #include "barrier/XScreen.h" #include "base/Log.h" @@ -30,14 +31,11 @@ // #define NO_GRAB_KEYBOARD 0 -static const char* g_name = "synwinhk"; +static const DWORD g_threadID = GetCurrentThreadId(); -static DWORD g_processID = 0; -static DWORD g_threadID = 0; -static HHOOK g_getMessage = NULL; -static HHOOK g_keyboardLL = NULL; -static HHOOK g_mouseLL = NULL; -static bool g_screenSaver = false; +static WindowsHookResource g_hkMessage; +static WindowsHookResource g_hkKeyboard; +static WindowsHookResource g_hkMouse; static EHookMode g_mode = kHOOK_DISABLE; static UInt32 g_zoneSides = 0; static SInt32 g_zoneSize = 0; @@ -50,90 +48,7 @@ static WPARAM g_deadRelease = 0; static LPARAM g_deadLParam = 0; static BYTE g_deadKeyState[256] = { 0 }; static BYTE g_keyState[256] = { 0 }; -static DWORD g_hookThread = 0; static bool g_fakeServerInput = false; -static BOOL g_isPrimary = TRUE; - -MSWindowsHook::MSWindowsHook() -{ -} - -MSWindowsHook::~MSWindowsHook() -{ - cleanup(); - - if (g_processID == GetCurrentProcessId()) { - uninstall(); - uninstallScreenSaver(); - g_processID = 0; - } -} - -void -MSWindowsHook::loadLibrary() -{ - if (g_processID == 0) { - g_processID = GetCurrentProcessId(); - } - if (init(GetCurrentThreadId()) == 0) { - LOG((CLOG_ERR "failed to init hooks handler")); - throw XScreenOpenFailure(); - } -} - -int -MSWindowsHook::init(DWORD threadID) -{ - // try to open process that last called init() to see if it's - // still running or if it died without cleaning up. - if (g_processID != 0 && g_processID != GetCurrentProcessId()) { - HANDLE process = OpenProcess(STANDARD_RIGHTS_REQUIRED, - FALSE, g_processID); - if (process != NULL) { - // old process (probably) still exists so refuse to - // reinitialize this DLL (and thus steal it from the - // old process). - int result = CloseHandle(process); - if (result == false) { - return 0; - } - } - - // clean up after old process. the system should've already - // removed the hooks so we just need to reset our state. - g_processID = GetCurrentProcessId(); - g_threadID = 0; - g_getMessage = NULL; - g_keyboardLL = NULL; - g_mouseLL = NULL; - g_screenSaver = false; - } - - // save thread id. we'll post messages to this thread's - // message queue. - g_threadID = threadID; - - // set defaults - g_mode = kHOOK_DISABLE; - g_zoneSides = 0; - g_zoneSize = 0; - g_xScreen = 0; - g_yScreen = 0; - g_wScreen = 0; - g_hScreen = 0; - - return 1; -} - -int -MSWindowsHook::cleanup() -{ - if (g_processID == GetCurrentProcessId()) { - g_threadID = 0; - } - - return 1; -} void MSWindowsHook::setSides(UInt32 sides) @@ -445,14 +360,9 @@ keyboardHookHandler(WPARAM wParam, LPARAM lParam) // pass event on. we want to let these through to // the window proc because otherwise the keyboard // lights may not stay synchronized. - break; - case VK_HANGUL: - // pass these modifiers if using a low level hook, discard - // them if not. - if (g_hookThread == 0) { - return true; - } + // pass event on because we're using a low level hook + break; default: @@ -493,7 +403,7 @@ keyboardLLHook(int code, WPARAM wParam, LPARAM lParam) } } - return CallNextHookEx(g_keyboardLL, code, wParam, lParam); + return CallNextHookEx(g_hkKeyboard, code, wParam, lParam); } #endif // !NO_GRAB_KEYBOARD @@ -613,19 +523,12 @@ mouseLLHook(int code, WPARAM wParam, LPARAM lParam) } } - return CallNextHookEx(g_mouseLL, code, wParam, lParam); + return CallNextHookEx(g_hkMouse, code, wParam, lParam); } -EHookResult +bool MSWindowsHook::install() { - assert(g_getMessage == NULL || g_screenSaver); - - // must be initialized - if (g_threadID == 0) { - return kHOOK_FAILED; - } - // discard old dead keys g_deadVirtKey = 0; g_deadLParam = 0; @@ -633,68 +536,34 @@ MSWindowsHook::install() // reset fake input flag g_fakeServerInput = false; - // install low-level hooks. we require that they both get installed. - g_mouseLL = SetWindowsHookEx(WH_MOUSE_LL, - &mouseLLHook, - NULL, - 0); -#if !NO_GRAB_KEYBOARD - g_keyboardLL = SetWindowsHookEx(WH_KEYBOARD_LL, - &keyboardLLHook, - NULL, - 0); - if (g_mouseLL == NULL || g_keyboardLL == NULL) { - if (g_keyboardLL != NULL) { - UnhookWindowsHookEx(g_keyboardLL); - g_keyboardLL = NULL; - } - if (g_mouseLL != NULL) { - UnhookWindowsHookEx(g_mouseLL); - g_mouseLL = NULL; - } +#if NO_GRAB_KEYBOARD + // we only need the mouse hook + if (!g_hkMouse.set(WH_MOUSE_LL, &mouseLLHook, NULL, 0)) + return false; +#else + // we need both hooks. if either fails, discard the other + if (!g_hkMouse.set(WH_MOUSE_LL, &mouseLLHook, NULL, 0) || + !g_hkKeyboard.set(WH_KEYBOARD_LL, &keyboardLLHook, NULL, 0)) { + g_hkMouse.unset(); + g_hkKeyboard.unset(); + return false; } #endif - // check that we got all the hooks we wanted - if ((g_mouseLL == NULL) -#if !NO_GRAB_KEYBOARD - || (g_keyboardLL == NULL) -#endif - ) { - uninstall(); - return kHOOK_FAILED; - } - - if (g_keyboardLL != NULL || g_mouseLL != NULL) { - g_hookThread = GetCurrentThreadId(); - return kHOOK_OKAY_LL; - } - - return kHOOK_OKAY; + return true; } -int +void MSWindowsHook::uninstall() { // discard old dead keys g_deadVirtKey = 0; g_deadLParam = 0; - // uninstall hooks - if (g_keyboardLL != NULL) { - UnhookWindowsHookEx(g_keyboardLL); - g_keyboardLL = NULL; - } - if (g_mouseLL != NULL) { - UnhookWindowsHookEx(g_mouseLL); - g_mouseLL = NULL; - } - if (g_getMessage != NULL && !g_screenSaver) { - UnhookWindowsHookEx(g_getMessage); - g_getMessage = NULL; - } + g_hkMouse.unset(); + g_hkKeyboard.unset(); - return 1; + uninstallScreenSaver(); } static @@ -702,53 +571,29 @@ LRESULT CALLBACK getMessageHook(int code, WPARAM wParam, LPARAM lParam) { if (code >= 0) { - if (g_screenSaver) { - MSG* msg = reinterpret_cast(lParam); - if (msg->message == WM_SYSCOMMAND && - msg->wParam == SC_SCREENSAVE) { - // broadcast screen saver started message - PostThreadMessage(g_threadID, - BARRIER_MSG_SCREEN_SAVER, TRUE, 0); - } + MSG* msg = reinterpret_cast(lParam); + if (msg->message == WM_SYSCOMMAND && + msg->wParam == SC_SCREENSAVE) { + // broadcast screen saver started message + PostThreadMessage(g_threadID, + BARRIER_MSG_SCREEN_SAVER, TRUE, 0); } } - return CallNextHookEx(g_getMessage, code, wParam, lParam); + return CallNextHookEx(g_hkMessage, code, wParam, lParam); } -int +bool MSWindowsHook::installScreenSaver() { - // must be initialized - if (g_threadID == 0) { - return 0; - } - - // generate screen saver messages - g_screenSaver = true; - // install hook unless it's already installed - if (g_getMessage == NULL) { - g_getMessage = SetWindowsHookEx(WH_GETMESSAGE, - &getMessageHook, - NULL, - 0); - } - - return (g_getMessage != NULL) ? 1 : 0; + if (g_hkMessage.is_set()) + return true; + return g_hkMessage.set(WH_GETMESSAGE, &getMessageHook, NULL, 0); } -int +void MSWindowsHook::uninstallScreenSaver() { - // uninstall hook unless the mouse wheel hook is installed - if (g_getMessage != NULL) { - UnhookWindowsHookEx(g_getMessage); - g_getMessage = NULL; - } - - // screen saver hook is no longer installed - g_screenSaver = false; - - return 1; + g_hkMessage.unset(); } \ No newline at end of file diff --git a/src/lib/platform/MSWindowsHook.h b/src/lib/platform/MSWindowsHook.h index ba551c7f..7b2121c4 100644 --- a/src/lib/platform/MSWindowsHook.h +++ b/src/lib/platform/MSWindowsHook.h @@ -28,18 +28,12 @@ class MSWindowsHook { public: - MSWindowsHook(); - virtual ~MSWindowsHook(); - - void loadLibrary(); - int init(DWORD threadID); - int cleanup(); void setSides(UInt32 sides); void setZone(SInt32 x, SInt32 y, SInt32 w, SInt32 h, SInt32 jumpZoneSize); void setMode(EHookMode mode); - static EHookResult install(); - static int uninstall(); - static int installScreenSaver(); - static int uninstallScreenSaver(); + static bool install(); + static void uninstall(); + static bool installScreenSaver(); + static void uninstallScreenSaver(); }; diff --git a/src/lib/platform/MSWindowsHookResource.cpp b/src/lib/platform/MSWindowsHookResource.cpp new file mode 100644 index 00000000..ced5ff12 --- /dev/null +++ b/src/lib/platform/MSWindowsHookResource.cpp @@ -0,0 +1,33 @@ +#include "MSWindowsHookResource.h" + +WindowsHookResource::WindowsHookResource() : + _hook(NULL) +{ +} + +WindowsHookResource::~WindowsHookResource() +{ + unset(); +} + +bool WindowsHookResource::set(int idHook, HOOKPROC lpfn, HINSTANCE hmod, DWORD dwThreadId) +{ + if (is_set()) + return false; + _hook = SetWindowsHookEx(idHook, lpfn, hmod, dwThreadId); + return is_set(); +} + +bool WindowsHookResource::unset() +{ + if (is_set()) { + if (UnhookWindowsHookEx(_hook) == 0) { + return false; + } + _hook = NULL; + } + return true; +} + +bool WindowsHookResource::is_set() const { return _hook != NULL; } +WindowsHookResource::operator HHOOK() const { return _hook; } \ No newline at end of file diff --git a/src/lib/platform/MSWindowsHookResource.h b/src/lib/platform/MSWindowsHookResource.h new file mode 100644 index 00000000..b66c4b8c --- /dev/null +++ b/src/lib/platform/MSWindowsHookResource.h @@ -0,0 +1,20 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN +#include + +class WindowsHookResource +{ +public: + explicit WindowsHookResource(); + ~WindowsHookResource(); + + bool set(int idHook, HOOKPROC lpfn, HINSTANCE hmod, DWORD dwThreadId); + bool unset(); + + bool is_set() const; + operator HHOOK() const; + +private: + HHOOK _hook; +}; \ No newline at end of file diff --git a/src/lib/platform/MSWindowsScreen.cpp b/src/lib/platform/MSWindowsScreen.cpp index 62c6d620..5246f963 100644 --- a/src/lib/platform/MSWindowsScreen.cpp +++ b/src/lib/platform/MSWindowsScreen.cpp @@ -129,10 +129,6 @@ MSWindowsScreen::MSWindowsScreen( s_screen = this; try { - if (m_isPrimary && !m_noHooks) { - m_hook.loadLibrary(); - } - m_screensaver = new MSWindowsScreenSaver(); m_desks = new MSWindowsDesks( m_isPrimary, diff --git a/src/lib/platform/synwinhk.h b/src/lib/platform/synwinhk.h index 57bb9c65..4b2d8e3f 100644 --- a/src/lib/platform/synwinhk.h +++ b/src/lib/platform/synwinhk.h @@ -48,12 +48,6 @@ extern "C" { -enum EHookResult { - kHOOK_FAILED, - kHOOK_OKAY, - kHOOK_OKAY_LL -}; - enum EHookMode { kHOOK_DISABLE, kHOOK_WATCH_JUMP_ZONE, From 06d5080b42002773e15f825d5394fc9d02bea4ed Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Fri, 23 Feb 2018 21:31:05 -0500 Subject: [PATCH 08/37] reimplement immune keys --- src/lib/platform/MSWindowsDesks.cpp | 19 --------------- src/lib/platform/MSWindowsHook.cpp | 38 ++++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/src/lib/platform/MSWindowsDesks.cpp b/src/lib/platform/MSWindowsDesks.cpp index 8a4f3b7c..b43a218c 100644 --- a/src/lib/platform/MSWindowsDesks.cpp +++ b/src/lib/platform/MSWindowsDesks.cpp @@ -20,7 +20,6 @@ #include "platform/MSWindowsDesks.h" #include "platform/MSWindowsScreen.h" -#include "platform/ImmuneKeysReader.h" #include "barrier/IScreenSaver.h" #include "barrier/XScreen.h" #include "mt/Lock.h" @@ -89,17 +88,6 @@ // enable; #define BARRIER_MSG_FAKE_INPUT BARRIER_HOOK_LAST_MSG + 12 -static const std::string ImmuneKeysPath = ArchFileWindows().getProfileDirectory() + "\\ImmuneKeys.txt"; - -static std::vector immune_keys_list() -{ - std::vector keys; - std::string badLine; - if (!ImmuneKeysReader::get_list(ImmuneKeysPath.c_str(), keys, badLine)) - LOG((CLOG_ERR "Reading immune keys stopped at: %s", badLine.c_str())); - return keys; -} - // // MSWindowsDesks // @@ -126,8 +114,6 @@ MSWindowsDesks::MSWindowsDesks( m_events(events), m_stopOnDeskSwitch(stopOnDeskSwitch) { - LOG((CLOG_DEBUG "Immune Keys Path: %s", ImmuneKeysPath.c_str())); - m_cursor = createBlankCursor(); m_deskClass = createDeskWindowClass(m_isPrimary); m_keyLayout = GetKeyboardLayout(GetCurrentThreadId()); @@ -657,11 +643,6 @@ MSWindowsDesks::deskThread(void* vdesk) MSWindowsHook::uninstallScreenSaver(); MSWindowsHook::installScreenSaver(); } - // populate immune keys list in the DLL's shared memory - // before the hooks are activated - auto list = immune_keys_list(); - LOG((CLOG_DEBUG "Found %u immune keys", list.size())); - //m_setImmuneKeys(list.data(), list.size()); if (!MSWindowsHook::install()) { // we won't work on this desk LOG((CLOG_DEBUG "Cannot hook on this desk")); diff --git a/src/lib/platform/MSWindowsHook.cpp b/src/lib/platform/MSWindowsHook.cpp index a27ef981..929888e4 100644 --- a/src/lib/platform/MSWindowsHook.cpp +++ b/src/lib/platform/MSWindowsHook.cpp @@ -19,6 +19,7 @@ #include "platform/MSWindowsHook.h" #include "platform/MSWindowsHookResource.h" +#include "platform/ImmuneKeysReader.h" #include "barrier/protocol_types.h" #include "barrier/XScreen.h" #include "base/Log.h" @@ -49,6 +50,28 @@ static LPARAM g_deadLParam = 0; static BYTE g_deadKeyState[256] = { 0 }; static BYTE g_keyState[256] = { 0 }; static bool g_fakeServerInput = false; +static std::vector g_immuneKeys; + +static const std::string ImmuneKeysPath = ArchFileWindows().getProfileDirectory() + "\\ImmuneKeys.txt"; + +static std::vector immune_keys_list() +{ + std::vector keys; + std::string badLine; + if (!ImmuneKeysReader::get_list(ImmuneKeysPath.c_str(), keys, badLine)) + LOG((CLOG_ERR "Reading immune keys stopped at: %s", badLine.c_str())); + return keys; +} + +inline static +bool is_immune_key(DWORD target) +{ + for (auto key : g_immuneKeys) { + if (key == target) + return true; + } + return false; +} void MSWindowsHook::setSides(UInt32 sides) @@ -378,9 +401,11 @@ static LRESULT CALLBACK keyboardLLHook(int code, WPARAM wParam, LPARAM lParam) { - if (code >= 0) { - // decode the message - KBDLLHOOKSTRUCT* info = reinterpret_cast(lParam); + // decode the message + KBDLLHOOKSTRUCT* info = reinterpret_cast(lParam); + + // do not filter non-action events nor immune keys + if (code == HC_ACTION && !is_immune_key(info->vkCode)) { WPARAM wParam = info->vkCode; LPARAM lParam = 1; // repeat code lParam |= (info->scanCode << 16); // scan code @@ -510,7 +535,8 @@ static LRESULT CALLBACK mouseLLHook(int code, WPARAM wParam, LPARAM lParam) { - if (code >= 0) { + // do not filter non-action events + if (code == HC_ACTION) { // decode the message MSLLHOOKSTRUCT* info = reinterpret_cast(lParam); SInt32 x = static_cast(info->pt.x); @@ -536,6 +562,10 @@ MSWindowsHook::install() // reset fake input flag g_fakeServerInput = false; + // setup immune keys + g_immuneKeys = immune_keys_list(); + LOG((CLOG_DEBUG "Found %u immune keys in %s", g_immuneKeys.size(), ImmuneKeysPath.c_str())); + #if NO_GRAB_KEYBOARD // we only need the mouse hook if (!g_hkMouse.set(WH_MOUSE_LL, &mouseLLHook, NULL, 0)) From 45805bbdcb1431a54b247b10e810201412176300 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sat, 24 Feb 2018 13:05:17 -0500 Subject: [PATCH 09/37] fix cmake3 detection in barebones environments --- clean_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clean_build.sh b/clean_build.sh index 290d570e..c78a03a8 100755 --- a/clean_build.sh +++ b/clean_build.sh @@ -5,7 +5,7 @@ mkdir build || exit 1 cd build || exit 1 # some environments have cmake v2 as 'cmake' and v3 as 'cmake3' # check for cmake3 first then fallback to just cmake -B_CMAKE=`which cmake3 2>/dev/null` +B_CMAKE=`type cmake3 2>/dev/null | cut -d' ' -f3` [ $? -ne 0 -o "x$B_CMAKE" = "x" ] && B_CMAKE=cmake # default build configuration B_BUILD_TYPE=${B_BUILD_TYPE:-Debug} From cfc13f1f046c2c05730654587cd7dec151d73cc3 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sat, 24 Feb 2018 14:10:14 -0500 Subject: [PATCH 10/37] add travis support --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..cc0f410d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +script: sh ./clean_build.sh +# skip install phase since we have a customized install package +# creation tool for each supported platform +install: true From ec1d68912dc279d683d0085081d5cb72b63d4b6f Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sat, 24 Feb 2018 14:27:47 -0500 Subject: [PATCH 11/37] working on travis-ci --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cc0f410d..61f9b491 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ -script: sh ./clean_build.sh +language: cpp +script: sh -x ./clean_build.sh # skip install phase since we have a customized install package # creation tool for each supported platform install: true From 87ff075c15b119a1288fba81086f8567f5f8601c Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sat, 24 Feb 2018 14:39:30 -0500 Subject: [PATCH 12/37] fix clean_build.sh on travis --- clean_build.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/clean_build.sh b/clean_build.sh index c78a03a8..e82fb5a3 100755 --- a/clean_build.sh +++ b/clean_build.sh @@ -5,8 +5,14 @@ mkdir build || exit 1 cd build || exit 1 # some environments have cmake v2 as 'cmake' and v3 as 'cmake3' # check for cmake3 first then fallback to just cmake -B_CMAKE=`type cmake3 2>/dev/null | cut -d' ' -f3` -[ $? -ne 0 -o "x$B_CMAKE" = "x" ] && B_CMAKE=cmake +B_CMAKE=`type cmake3 2>/dev/null` +if [ $? -eq 0 ]; then + B_CMAKE=`echo $B_CMAKE | cut -d' ' -f3` +else + B_CMAKE=cmake +fi +echo CMAKE=$B_CMAKE +exit 0 # default build configuration B_BUILD_TYPE=${B_BUILD_TYPE:-Debug} if [ "$(uname)" = "Darwin" ]; then From cfe8719982055d6f481cc5e192700de807623a06 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sat, 24 Feb 2018 14:56:30 -0500 Subject: [PATCH 13/37] remove debug statements --- clean_build.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/clean_build.sh b/clean_build.sh index e82fb5a3..f5438598 100755 --- a/clean_build.sh +++ b/clean_build.sh @@ -11,8 +11,6 @@ if [ $? -eq 0 ]; then else B_CMAKE=cmake fi -echo CMAKE=$B_CMAKE -exit 0 # default build configuration B_BUILD_TYPE=${B_BUILD_TYPE:-Debug} if [ "$(uname)" = "Darwin" ]; then From dc15dc6081469384043815e17817375a1ffa7954 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sat, 24 Feb 2018 15:01:39 -0500 Subject: [PATCH 14/37] add libxtst-dev to travis --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 61f9b491..28360d5a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,7 @@ language: cpp +before_install: + sudo apt-get update -qq + sudo apt-get install -qq libxtst-dev script: sh -x ./clean_build.sh # skip install phase since we have a customized install package # creation tool for each supported platform From b36a91a363b8f4dc2fc6d1b4086040663b2670f3 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sat, 24 Feb 2018 15:05:42 -0500 Subject: [PATCH 15/37] fix travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 28360d5a..63cf5f4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: cpp before_install: - sudo apt-get update -qq - sudo apt-get install -qq libxtst-dev +- sudo apt-get update -qq +- sudo apt-get install -qq libxtst-dev script: sh -x ./clean_build.sh # skip install phase since we have a customized install package # creation tool for each supported platform From 0f42f8243935736dd28fba44c1de2ef8790b2d3b Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sat, 24 Feb 2018 15:14:20 -0500 Subject: [PATCH 16/37] add qt5 dev package to travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 63cf5f4e..05224486 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: cpp before_install: - sudo apt-get update -qq - sudo apt-get install -qq libxtst-dev +- sudo apt-get install -qq qtdeclarative5-dev script: sh -x ./clean_build.sh # skip install phase since we have a customized install package # creation tool for each supported platform From 15c83eca48a0a40e8a8472e21c6dbec78e010d38 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sat, 24 Feb 2018 15:23:53 -0500 Subject: [PATCH 17/37] add libavahi to travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 05224486..82f36c5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ before_install: - sudo apt-get update -qq - sudo apt-get install -qq libxtst-dev - sudo apt-get install -qq qtdeclarative5-dev +- sudo apt-get install -qq libavahi-compat-libdnssd-dev script: sh -x ./clean_build.sh # skip install phase since we have a customized install package # creation tool for each supported platform From 60d121aed36fb0b43354d40365c70f2f048acf75 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sat, 24 Feb 2018 17:41:28 -0500 Subject: [PATCH 18/37] reduce size of clipboard buffer. fixes #15 --- src/lib/barrier/StreamChunker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/barrier/StreamChunker.cpp b/src/lib/barrier/StreamChunker.cpp index 73689187..8b8971c0 100644 --- a/src/lib/barrier/StreamChunker.cpp +++ b/src/lib/barrier/StreamChunker.cpp @@ -35,7 +35,7 @@ using namespace std; -static const size_t g_chunkSize = 512 * 1024; //512kb +static const size_t g_chunkSize = 32 * 1024; //32kb bool StreamChunker::s_isChunkingFile = false; bool StreamChunker::s_interruptFile = false; From b994c94a908f1d3b57f93ef2517bf5c2a9e820c4 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sat, 24 Feb 2018 18:20:14 -0500 Subject: [PATCH 19/37] fix build for libressl. thanks to truatpasteurdotfr for the patch --- src/lib/net/SecureSocket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/net/SecureSocket.cpp b/src/lib/net/SecureSocket.cpp index 7128fd66..bf6f52e8 100644 --- a/src/lib/net/SecureSocket.cpp +++ b/src/lib/net/SecureSocket.cpp @@ -814,7 +814,7 @@ SecureSocket::showSecureCipherInfo() showCipherStackDesc(sStack); } -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) // m_ssl->m_ssl->session->ciphers is not forward compatable, // In future release of OpenSSL, it's not visible, STACK_OF(SSL_CIPHER) * cStack = m_ssl->m_ssl->session->ciphers; From 916b08547482d7dcd2cb56cb1faa2a6c4df31622 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sat, 24 Feb 2018 19:37:30 -0500 Subject: [PATCH 20/37] better resource management for SecureSocket buffer. fixes #16 --- src/lib/net/SecureSocket.cpp | 49 ++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/src/lib/net/SecureSocket.cpp b/src/lib/net/SecureSocket.cpp index bf6f52e8..83a69080 100644 --- a/src/lib/net/SecureSocket.cpp +++ b/src/lib/net/SecureSocket.cpp @@ -30,6 +30,7 @@ #include #include #include +#include // // SecureSocket @@ -206,45 +207,43 @@ SecureSocket::doWrite() { static bool s_retry = false; static int s_retrySize = 0; - static void* s_staticBuffer = NULL; + static std::unique_ptr s_staticBuffer; + static std::size_t s_staticBufferSize = 0; // write data int bufferSize = 0; int bytesWrote = 0; int status = 0; - + + if (!isSecureReady()) + return kRetry; + if (s_retry) { bufferSize = s_retrySize; - } - else { + } else { bufferSize = m_outputBuffer.getSize(); - s_staticBuffer = malloc(bufferSize); - memcpy(s_staticBuffer, m_outputBuffer.peek(bufferSize), bufferSize); + if (bufferSize > s_staticBufferSize) { + s_staticBuffer.reset(new char[bufferSize]); + s_staticBufferSize = bufferSize; + } + if (bufferSize > 0) { + memcpy(s_staticBuffer.get(), m_outputBuffer.peek(bufferSize), bufferSize); + } } if (bufferSize == 0) { return kRetry; } - if (isSecureReady()) { - status = secureWrite(s_staticBuffer, bufferSize, bytesWrote); - if (status > 0) { - s_retry = false; - bufferSize = 0; - free(s_staticBuffer); - s_staticBuffer = NULL; - } - else if (status < 0) { - return kBreak; - } - else if (status == 0) { - s_retry = true; - s_retrySize = bufferSize; - return kNew; - } - } - else { - return kRetry; + status = secureWrite(s_staticBuffer.get(), bufferSize, bytesWrote); + if (status > 0) { + s_retry = false; + } else if (status < 0) { + return kBreak; + } else if (status == 0) { + s_retry = true; + s_retrySize = bufferSize; + return kNew; } if (bytesWrote > 0) { From 1648c1d51a1526d34105089cfa45e0a470751320 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sat, 24 Feb 2018 19:39:04 -0500 Subject: [PATCH 21/37] build checks unixbuild_env.sh for environmental overrides --- .gitignore | 1 + clean_build.sh | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index ba5df6d8..4000ad56 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ winbuild_env.bat +unixbuild_env.sh config.h .DS_Store *.pyc diff --git a/clean_build.sh b/clean_build.sh index f5438598..cdd81fbd 100755 --- a/clean_build.sh +++ b/clean_build.sh @@ -1,8 +1,5 @@ #!/bin/sh cd "$(dirname $0)" || exit 1 -rm -rf build -mkdir build || exit 1 -cd build || exit 1 # some environments have cmake v2 as 'cmake' and v3 as 'cmake3' # check for cmake3 first then fallback to just cmake B_CMAKE=`type cmake3 2>/dev/null` @@ -16,10 +13,15 @@ B_BUILD_TYPE=${B_BUILD_TYPE:-Debug} if [ "$(uname)" = "Darwin" ]; then # OSX needs a lot of extra help, poor thing # run the osx_environment.sh script to fix paths - [ -r ../osx_environment.sh ] && source ../osx_environment.sh + source ./osx_environment.sh B_CMAKE_FLAGS="-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 $B_CMAKE_FLAGS" fi B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE $B_CMAKE_FLAGS" +# allow local customizations to build environment +[ -r ./unixbuild_env.sh ] && source ./unixbuild_env.sh +rm -rf build +mkdir build || exit 1 +cd build || exit 1 echo Starting Barrier $B_BUILD_TYPE build... $B_CMAKE $B_CMAKE_FLAGS .. || exit 1 make || exit 1 From 65b9d795cf6ae0db7782c4201e68746d4fa7837d Mon Sep 17 00:00:00 2001 From: walker0643 Date: Sun, 25 Feb 2018 12:35:41 -0500 Subject: [PATCH 22/37] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a92eee0d..fe101386 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Eliminate the barrier between your machines. +Master branch build status:   [![Build Status](https://travis-ci.org/debauchee/barrier.svg?branch=master)](https://travis-ci.org/debauchee/barrier) + ### What is it? Barrier is KVM software forked from Symless's synergy 1.9 codebase. Synergy was a commercialized reimplementation of the original CosmoSynergy written by Chris Schoeneman. @@ -26,4 +28,4 @@ For short and simple questions or to just say hello find us on the Freenode IRC ### Contributions -At this time we are looking for developers to help fix the issues found in the issue tracker. Submit pull requests once you've polished up your patch and if we use it you will be appropriately credited in the log. +At this time we are looking for developers to help fix the issues found in the issue tracker. Submit pull requests once you've polished up your patch and we'll review and possibly merge it. From c1827bde5108d1f4709072739f25276c03b827da Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sun, 25 Feb 2018 13:37:29 -0500 Subject: [PATCH 23/37] redo GUI menu a bit; remove unused items --- src/gui/src/MainWindow.cpp | 66 +++++++---------------------------- src/gui/src/MainWindow.h | 13 +------ src/gui/src/MainWindowBase.ui | 51 --------------------------- 3 files changed, 14 insertions(+), 116 deletions(-) diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 83dbd548..c9292144 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -85,9 +85,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) : m_pTrayIconMenu(NULL), m_AlreadyHidden(false), m_pMenuBar(NULL), - m_pMenuFile(NULL), - m_pMenuEdit(NULL), - m_pMenuWindow(NULL), + m_pMenuBarrier(NULL), m_pMenuHelp(NULL), m_pZeroconfService(NULL), m_pDataDownloader(NULL), @@ -105,8 +103,6 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) : loadSettings(); initConnections(); - m_pWidgetUpdate->hide(); - m_VersionChecker.setApp(appPath(appConfig.barriercName())); m_pLabelScreenName->setText(getScreenName()); m_pLabelIpAddresses->setText(getIPAddresses()); @@ -136,9 +132,6 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) : sslToggled(appConfig.getCryptoEnabled()); - connect (this, SIGNAL(windowShown()), - this, SLOT(on_windowShown()), Qt::QueuedConnection); - connect (m_AppConfig, SIGNAL(sslToggled(bool)), this, SLOT(sslToggled(bool)), Qt::QueuedConnection); } @@ -175,8 +168,6 @@ void MainWindow::open() showNormal(); } - m_VersionChecker.checkLatest(); - if (!appConfig().autoConfigPrompted()) { promptAutoConfig(); } @@ -223,37 +214,25 @@ void MainWindow::createTrayIcon() void MainWindow::retranslateMenuBar() { - m_pMenuFile->setTitle(tr("&File")); - m_pMenuEdit->setTitle(tr("&Edit")); - m_pMenuWindow->setTitle(tr("&Window")); + m_pMenuBarrier->setTitle(tr("&Barrier")); m_pMenuHelp->setTitle(tr("&Help")); } void MainWindow::createMenuBar() { m_pMenuBar = new QMenuBar(this); - m_pMenuFile = new QMenu("", m_pMenuBar); - m_pMenuEdit = new QMenu("", m_pMenuBar); - m_pMenuWindow = new QMenu("", m_pMenuBar); + m_pMenuBarrier = new QMenu("", m_pMenuBar); m_pMenuHelp = new QMenu("", m_pMenuBar); retranslateMenuBar(); - m_pMenuBar->addAction(m_pMenuFile->menuAction()); - m_pMenuBar->addAction(m_pMenuEdit->menuAction()); -#if !defined(Q_OS_MAC) - m_pMenuBar->addAction(m_pMenuWindow->menuAction()); -#endif + m_pMenuBar->addAction(m_pMenuBarrier->menuAction()); m_pMenuBar->addAction(m_pMenuHelp->menuAction()); - m_pMenuFile->addAction(m_pActionStartBarrier); - m_pMenuFile->addAction(m_pActionStopBarrier); - m_pMenuFile->addSeparator(); - m_pMenuFile->addAction(m_pActionSave); - m_pMenuFile->addSeparator(); - m_pMenuFile->addAction(m_pActionQuit); - m_pMenuEdit->addAction(m_pActionSettings); - m_pMenuWindow->addAction(m_pActionMinimize); - m_pMenuWindow->addAction(m_pActionRestore); + m_pMenuBarrier->addAction(m_pActionSave); + m_pMenuBarrier->addSeparator(); + m_pMenuBarrier->addAction(m_pActionSettings); + m_pMenuBarrier->addSeparator(); + m_pMenuBarrier->addAction(m_pActionQuit); m_pMenuHelp->addAction(m_pActionAbout); setMenuBar(m_pMenuBar); @@ -279,7 +258,6 @@ void MainWindow::initConnections() connect(m_pActionStartBarrier, SIGNAL(triggered()), this, SLOT(startBarrier())); connect(m_pActionStopBarrier, SIGNAL(triggered()), this, SLOT(stopBarrier())); connect(m_pActionQuit, SIGNAL(triggered()), qApp, SLOT(quit())); - connect(&m_VersionChecker, SIGNAL(updateFound(const QString&)), this, SLOT(updateFound(const QString&))); } void MainWindow::saveSettings() @@ -343,16 +321,6 @@ void MainWindow::logError() } } -void MainWindow::updateFound(const QString &version) -{ - m_pWidgetUpdate->show(); - m_pLabelUpdate->setText( - tr("

Your version of Barrier is out of date. " - "Version %1 is now available to " - "download.

") - .arg(version).arg(DOWNLOAD_URL)); -} - void MainWindow::appendLogInfo(const QString& text) { appendLogRaw(getTimeStamp() + " INFO: " + text); @@ -470,12 +438,6 @@ void MainWindow::proofreadInfo() setBarrierState((qBarrierState)oldState); } -void MainWindow::showEvent(QShowEvent* event) -{ - QMainWindow::showEvent(event); - emit windowShown(); -} - void MainWindow::clearLog() { m_pLogOutput->clear(); @@ -1119,12 +1081,15 @@ bool MainWindow::isServiceRunning(QString name) return true; } } + + return false; +} #else bool MainWindow::isServiceRunning() { -#endif return false; } +#endif bool MainWindow::isBonjourRunning() { @@ -1298,11 +1263,6 @@ void MainWindow::bonjourInstallFinished() m_pCheckBoxAutoConfig->setChecked(true); } -void MainWindow::on_windowShown() -{ - // removed activation garbage; leaving stub to be optimized out -} - QString MainWindow::getProfileRootForArg() { CoreInterface coreInterface; diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index 74313796..725b7ed9 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -136,7 +136,6 @@ public slots: void stopBarrier(); void logOutput(); void logError(); - void updateFound(const QString& version); void bonjourInstallFinished(); protected: @@ -146,17 +145,14 @@ public slots: void setBarrierProcess(QProcess* p) { m_pBarrier = p; } void initConnections(); void createMenuBar(); - void createStatusBar(); void createTrayIcon(); void loadSettings(); void saveSettings(); void setIcon(qBarrierState state); void setBarrierState(qBarrierState state); - bool checkForApp(int which, QString& app); bool clientArgs(QStringList& args, QString& app); bool serverArgs(QStringList& args, QString& app); void setStatus(const QString& status); - void sendIpcMessage(qIpcMessageType type, const char* buffer, bool showErrors); void updateFromLogLine(const QString& line); QString getIPAddresses(); void stopService(); @@ -178,8 +174,6 @@ public slots: void restartBarrier(); void proofreadInfo(); - void showEvent (QShowEvent*); - void windowStateChanged(); @@ -196,9 +190,7 @@ public slots: VersionChecker m_VersionChecker; IpcClient m_IpcClient; QMenuBar* m_pMenuBar; - QMenu* m_pMenuFile; - QMenu* m_pMenuEdit; - QMenu* m_pMenuWindow; + QMenu* m_pMenuBarrier; QMenu* m_pMenuHelp; ZeroconfService* m_pZeroconfService; DataDownloader* m_pDataDownloader; @@ -218,10 +210,7 @@ private slots: void on_m_pComboServerList_currentIndexChanged(QString ); void on_m_pButtonApply_clicked(); void installBonjour(); - void on_windowShown(); -signals: - void windowShown(); }; #endif diff --git a/src/gui/src/MainWindowBase.ui b/src/gui/src/MainWindowBase.ui index 16f85dfe..8ac00713 100644 --- a/src/gui/src/MainWindowBase.ui +++ b/src/gui/src/MainWindowBase.ui @@ -27,57 +27,6 @@ - - - - - 2 - - - 0 - - - 0 - - - 8 - - - - - - - - :/res/icons/16x16/warning.png - - - - - - - m_pLabelUpdate - - - true - - - - - - - Qt::Horizontal - - - - 469 - 20 - - - - - - - From b55fe3237aaee365e01cfcb46117f7b11ddd7d6a Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sun, 25 Feb 2018 16:22:10 -0500 Subject: [PATCH 24/37] clean up AppConfig; eliminate unnecessary UI changes to MainWindow; MainWindow starts at smaller size --- src/gui/src/AppConfig.cpp | 24 ++++----------- src/gui/src/AppConfig.h | 4 --- src/gui/src/MainWindow.cpp | 55 +++++++++++----------------------- src/gui/src/MainWindow.h | 5 +--- src/gui/src/MainWindowBase.ui | 4 +-- src/gui/src/SettingsDialog.cpp | 42 ++++++++++---------------- src/gui/src/SettingsDialog.h | 3 -- 7 files changed, 41 insertions(+), 96 deletions(-) diff --git a/src/gui/src/AppConfig.cpp b/src/gui/src/AppConfig.cpp index ef191376..2f8779d0 100644 --- a/src/gui/src/AppConfig.cpp +++ b/src/gui/src/AppConfig.cpp @@ -206,35 +206,21 @@ void AppConfig::setStartedBefore(bool b) { m_StartedBefore = b; } void AppConfig::setElevateMode(ElevateMode em) { m_ElevateMode = em; } -void AppConfig::setAutoConfig(bool autoConfig) -{ - m_AutoConfig = autoConfig; -} +void AppConfig::setAutoConfig(bool autoConfig) { m_AutoConfig = autoConfig; } bool AppConfig::autoConfigPrompted() { return m_AutoConfigPrompted; } -void AppConfig::setAutoConfigPrompted(bool prompted) -{ - m_AutoConfigPrompted = prompted; -} +void AppConfig::setAutoConfigPrompted(bool prompted) { m_AutoConfigPrompted = prompted; } QString AppConfig::barriersName() const { return m_BarriersName; } QString AppConfig::barriercName() const { return m_BarriercName; } -ElevateMode AppConfig::elevateMode() -{ - return m_ElevateMode; -} +ElevateMode AppConfig::elevateMode() { return m_ElevateMode; } -void AppConfig::setCryptoEnabled(bool e) { - m_CryptoEnabled = e; - emit sslToggled(e); -} +void AppConfig::setCryptoEnabled(bool e) { m_CryptoEnabled = e; } -bool AppConfig::getCryptoEnabled() const { - return m_CryptoEnabled; -} +bool AppConfig::getCryptoEnabled() const { return m_CryptoEnabled; } void AppConfig::setAutoHide(bool b) { m_AutoHide = b; } diff --git a/src/gui/src/AppConfig.h b/src/gui/src/AppConfig.h index 9faab2b1..c9ed38de 100644 --- a/src/gui/src/AppConfig.h +++ b/src/gui/src/AppConfig.h @@ -85,7 +85,6 @@ class AppConfig: public QObject QString barrierProgramDir() const; QString barrierLogDir() const; - bool detectPath(const QString& name, QString& path); void persistLogDir(); ElevateMode elevateMode(); @@ -136,9 +135,6 @@ protected: static const char m_BarriersName[]; static const char m_BarriercName[]; static const char m_BarrierLogDir[]; - - signals: - void sslToggled(bool enabled); }; #endif diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index c9292144..2f2decda 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -16,8 +16,6 @@ * along with this program. If not, see . */ -#define DOWNLOAD_URL "http://github.com/debauchee/barrier/" - #include #include "MainWindow.h" @@ -117,10 +115,10 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) : // change default size based on os #if defined(Q_OS_MAC) resize(720, 550); - setMinimumSize(size()); + setMinimumSize(720, 0); #elif defined(Q_OS_LINUX) resize(700, 530); - setMinimumSize(size()); + setMinimumSize(700, 0); #endif m_SuppressAutoConfigWarning = true; @@ -130,10 +128,10 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) : m_pComboServerList->hide(); m_pLabelPadlock->hide(); - sslToggled(appConfig.getCryptoEnabled()); + updateSSLFingerprint(); - connect (m_AppConfig, SIGNAL(sslToggled(bool)), - this, SLOT(sslToggled(bool)), Qt::QueuedConnection); + // resize window to smallest reasonable size + resize(0, 0); } MainWindow::~MainWindow() @@ -146,15 +144,8 @@ MainWindow::~MainWindow() saveSettings(); delete m_pZeroconfService; - - if (m_DownloadMessageBox != NULL) { - delete m_DownloadMessageBox; - } - - if (m_BonjourInstall != NULL) { - delete m_BonjourInstall; - } - + delete m_DownloadMessageBox; + delete m_BonjourInstall; delete m_pSslCertificate; } @@ -556,16 +547,6 @@ void MainWindow::startBarrier() } } -void -MainWindow::sslToggled (bool enabled) -{ - if (enabled) { - m_pSslCertificate = new SslCertificate(this); - m_pSslCertificate->generateCertificate(); - } - updateLocalFingerprint(); -} - bool MainWindow::clientArgs(QStringList& args, QString& app) { app = appPath(appConfig().barriercName()); @@ -947,16 +928,16 @@ void MainWindow::serverDetected(const QString name) } } -void MainWindow::updateLocalFingerprint() +void MainWindow::updateSSLFingerprint() { - if (m_AppConfig->getCryptoEnabled() && Fingerprint::local().fileExists()) { - m_pLabelFingerprint->setVisible(true); - m_pLabelLocalFingerprint->setVisible(true); - m_pLabelLocalFingerprint->setText(Fingerprint::local().readFirst()); + if (m_AppConfig->getCryptoEnabled() && m_pSslCertificate == nullptr) { + m_pSslCertificate = new SslCertificate(this); + m_pSslCertificate->generateCertificate(); } - else { - m_pLabelFingerprint->setVisible(false); - m_pLabelLocalFingerprint->setVisible(false); + if (m_AppConfig->getCryptoEnabled() && Fingerprint::local().fileExists()) { + m_pLabelLocalFingerprint->setText(Fingerprint::local().readFirst()); + } else { + m_pLabelLocalFingerprint->setText("Disabled"); } } @@ -1004,13 +985,13 @@ bool MainWindow::on_m_pActionSave_triggered() void MainWindow::on_m_pActionAbout_triggered() { - AboutDialog dlg(this, appPath(appConfig().barriercName())); - dlg.exec(); + AboutDialog(this, appPath(appConfig().barriercName())).exec(); } void MainWindow::on_m_pActionSettings_triggered() { - SettingsDialog(this, appConfig()).exec(); + if (SettingsDialog(this, appConfig()).exec() == QDialog::Accepted) + updateSSLFingerprint(); } void MainWindow::autoAddScreen(const QString name) diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index 725b7ed9..a85ca32b 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -113,7 +113,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase void autoAddScreen(const QString name); void updateZeroconfService(); void serverDetected(const QString name); - void updateLocalFingerprint(); public slots: void appendLogRaw(const QString& text); @@ -123,7 +122,6 @@ public slots: void startBarrier(); protected slots: - void sslToggled(bool enabled); void on_m_pGroupClient_toggled(bool on); void on_m_pGroupServer_toggled(bool on); bool on_m_pButtonBrowseConfigFile_clicked(); @@ -173,9 +171,8 @@ public slots: QString getTimeStamp(); void restartBarrier(); void proofreadInfo(); - void windowStateChanged(); - + void updateSSLFingerprint(); private: QSettings& m_Settings; diff --git a/src/gui/src/MainWindowBase.ui b/src/gui/src/MainWindowBase.ui index 8ac00713..eb9b7ef9 100644 --- a/src/gui/src/MainWindowBase.ui +++ b/src/gui/src/MainWindowBase.ui @@ -18,8 +18,8 @@ - 500 - 400 + 600 + 0 diff --git a/src/gui/src/SettingsDialog.cpp b/src/gui/src/SettingsDialog.cpp index fa178176..dc073134 100644 --- a/src/gui/src/SettingsDialog.cpp +++ b/src/gui/src/SettingsDialog.cpp @@ -65,26 +65,26 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) : void SettingsDialog::accept() { - appConfig().setScreenName(m_pLineEditScreenName->text()); - appConfig().setPort(m_pSpinBoxPort->value()); - appConfig().setNetworkInterface(m_pLineEditInterface->text()); - appConfig().setLogLevel(m_pComboLogLevel->currentIndex()); - appConfig().setLogToFile(m_pCheckBoxLogToFile->isChecked()); - appConfig().setLogFilename(m_pLineEditLogFilename->text()); - appConfig().setLanguage(m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString()); - appConfig().setElevateMode(static_cast(m_pComboElevate->currentIndex())); - appConfig().setAutoHide(m_pCheckBoxAutoHide->isChecked()); - appConfig().setMinimizeToTray(m_pCheckBoxMinimizeToTray->isChecked()); - appConfig().saveSettings(); + m_appConfig.setScreenName(m_pLineEditScreenName->text()); + m_appConfig.setPort(m_pSpinBoxPort->value()); + m_appConfig.setNetworkInterface(m_pLineEditInterface->text()); + m_appConfig.setCryptoEnabled(m_pCheckBoxEnableCrypto->isChecked()); + m_appConfig.setLogLevel(m_pComboLogLevel->currentIndex()); + m_appConfig.setLogToFile(m_pCheckBoxLogToFile->isChecked()); + m_appConfig.setLogFilename(m_pLineEditLogFilename->text()); + m_appConfig.setLanguage(m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString()); + m_appConfig.setElevateMode(static_cast(m_pComboElevate->currentIndex())); + m_appConfig.setAutoHide(m_pCheckBoxAutoHide->isChecked()); + m_appConfig.setMinimizeToTray(m_pCheckBoxMinimizeToTray->isChecked()); + m_appConfig.saveSettings(); QDialog::accept(); } void SettingsDialog::reject() { - if (appConfig().language() != m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString()) { - QBarrierApplication::getInstance()->switchTranslator(appConfig().language()); + if (m_appConfig.language() != m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString()) { + QBarrierApplication::getInstance()->switchTranslator(m_appConfig.language()); } - QDialog::reject(); } @@ -137,16 +137,4 @@ void SettingsDialog::on_m_pComboLanguage_currentIndexChanged(int index) { QString ietfCode = m_pComboLanguage->itemData(index).toString(); QBarrierApplication::getInstance()->switchTranslator(ietfCode); -} - -void SettingsDialog::on_m_pCheckBoxEnableCrypto_toggled(bool checked) -{ - m_appConfig.setCryptoEnabled(checked); - m_appConfig.saveSettings(); - if (checked) { - SslCertificate sslCertificate; - sslCertificate.generateCertificate(); - MainWindow& mainWindow = dynamic_cast (*this->parent()); - mainWindow.updateLocalFingerprint(); - } -} +} \ No newline at end of file diff --git a/src/gui/src/SettingsDialog.h b/src/gui/src/SettingsDialog.h index 29400b95..c16b8218 100644 --- a/src/gui/src/SettingsDialog.h +++ b/src/gui/src/SettingsDialog.h @@ -33,8 +33,6 @@ class SettingsDialog : public QDialog, public Ui::SettingsDialogBase public: SettingsDialog(QWidget* parent, AppConfig& config); - static QString browseForBarrierc(QWidget* parent, const QString& programDir, const QString& barriercName); - static QString browseForBarriers(QWidget* parent, const QString& programDir, const QString& barriersName); protected: void accept(); @@ -48,7 +46,6 @@ class SettingsDialog : public QDialog, public Ui::SettingsDialogBase CoreInterface m_CoreInterface; private slots: - void on_m_pCheckBoxEnableCrypto_toggled(bool checked); void on_m_pComboLanguage_currentIndexChanged(int index); void on_m_pCheckBoxLogToFile_stateChanged(int ); void on_m_pButtonBrowseLog_clicked(); From c351d450aeba92472223ff4b46a4b5444b0543a8 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sun, 25 Feb 2018 20:00:32 -0500 Subject: [PATCH 25/37] move log output into its own window; add some keyboard shortcuts for menu items --- src/gui/src/LogWindow.cpp | 72 +++++++++++++++++++++++++++++ src/gui/src/LogWindow.h | 46 +++++++++++++++++++ src/gui/src/LogWindowBase.ui | 86 +++++++++++++++++++++++++++++++++++ src/gui/src/MainWindow.cpp | 47 ++++++++++--------- src/gui/src/MainWindow.h | 5 +- src/gui/src/MainWindowBase.ui | 61 ++++++------------------- src/gui/src/main.cpp | 2 - 7 files changed, 246 insertions(+), 73 deletions(-) create mode 100644 src/gui/src/LogWindow.cpp create mode 100644 src/gui/src/LogWindow.h create mode 100644 src/gui/src/LogWindowBase.ui diff --git a/src/gui/src/LogWindow.cpp b/src/gui/src/LogWindow.cpp new file mode 100644 index 00000000..6aee096a --- /dev/null +++ b/src/gui/src/LogWindow.cpp @@ -0,0 +1,72 @@ +/* +* barrier -- mouse and keyboard sharing utility +* Copyright (C) 2018 Debauchee Open Source Group +* +* 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 . +*/ + +#include "LogWindow.h" + +#include + +static QString getTimeStamp() +{ + QDateTime current = QDateTime::currentDateTime(); + return '[' + current.toString(Qt::ISODate) + ']'; +} + +LogWindow::LogWindow(QWidget *parent) : + QDialog(parent) +{ + // explicitly unset DeleteOnClose so the log window can be show and hidden + // repeatedly until Barrier is finished + setAttribute(Qt::WA_DeleteOnClose, false); + setupUi(this); +} + +void LogWindow::startNewInstance() +{ + // put a space between last log output and new instance. + if (!m_pLogOutput->toPlainText().isEmpty()) + appendRaw(""); +} + +void LogWindow::appendInfo(const QString& text) +{ + appendRaw(getTimeStamp() + " INFO: " + text); +} + +void LogWindow::appendDebug(const QString& text) +{ + appendRaw(getTimeStamp() + " DEBUG: " + text); +} + +void LogWindow::appendError(const QString& text) +{ + appendRaw(getTimeStamp() + " ERROR: " + text); +} + +void LogWindow::appendRaw(const QString& text) +{ + m_pLogOutput->append(text); +} + +void LogWindow::on_m_pButtonHide_clicked() +{ + hide(); +} + +void LogWindow::on_m_pButtonClearLog_clicked() +{ + m_pLogOutput->clear(); +} diff --git a/src/gui/src/LogWindow.h b/src/gui/src/LogWindow.h new file mode 100644 index 00000000..af230307 --- /dev/null +++ b/src/gui/src/LogWindow.h @@ -0,0 +1,46 @@ +/* + * barrier -- mouse and keyboard sharing utility + * Copyright (C) 2018 Debauchee Open Source Group + * + * 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 . + */ + +#if !defined(LOGWINDOW__H) + +#define LOGWINDOW__H + +#include + +#include "ui_LogWindowBase.h" + +class LogWindow : public QDialog, public Ui::LogWindowBase +{ + Q_OBJECT + + public: + LogWindow(QWidget *parent); + + void startNewInstance(); + + void appendRaw(const QString& text); + void appendInfo(const QString& text); + void appendDebug(const QString& text); + void appendError(const QString& text); + + private slots: + void on_m_pButtonHide_clicked(); + void on_m_pButtonClearLog_clicked(); + +}; + +#endif // LOGWINDOW__H diff --git a/src/gui/src/LogWindowBase.ui b/src/gui/src/LogWindowBase.ui new file mode 100644 index 00000000..c7272a70 --- /dev/null +++ b/src/gui/src/LogWindowBase.ui @@ -0,0 +1,86 @@ + + + LogWindowBase + + + + 0 + 0 + 600 + 371 + + + + + 0 + 0 + + + + + 400 + 0 + + + + Log - Barrier + + + + + + + Courier + + + + false + + + false + + + QTextEdit::NoWrap + + + true + + + + + + + QLayout::SetDefaultConstraint + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + &Clear Log + + + + + + + &Hide + + + + + + + + diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 2f2decda..59b1d556 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -93,7 +93,8 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) : m_BonjourInstall(NULL), m_SuppressEmptyServerWarning(false), m_ExpectedRunningState(kStopped), - m_pSslCertificate(NULL) + m_pSslCertificate(NULL), + m_pLogWindow(new LogWindow(nullptr)) { setupUi(this); @@ -147,6 +148,13 @@ MainWindow::~MainWindow() delete m_DownloadMessageBox; delete m_BonjourInstall; delete m_pSslCertificate; + + // LogWindow is created as a sibling of the MainWindow rather than a child + // so that the main window can be hidden without hiding the log. because of + // this it does not get properly cleaned up by the QObject system. also by + // the time this destructor is called the event loop will no longer be able + // to clean up the LogWindow so ->deleteLater() will not work + delete m_pLogWindow; } void MainWindow::open() @@ -184,6 +192,7 @@ void MainWindow::createTrayIcon() m_pTrayIconMenu->addAction(m_pActionStartBarrier); m_pTrayIconMenu->addAction(m_pActionStopBarrier); + m_pTrayIconMenu->addAction(m_pActionShowLog); m_pTrayIconMenu->addSeparator(); m_pTrayIconMenu->addAction(m_pActionMinimize); @@ -219,10 +228,11 @@ void MainWindow::createMenuBar() m_pMenuBar->addAction(m_pMenuBarrier->menuAction()); m_pMenuBar->addAction(m_pMenuHelp->menuAction()); - m_pMenuBarrier->addAction(m_pActionSave); - m_pMenuBarrier->addSeparator(); + m_pMenuBarrier->addAction(m_pActionShowLog); m_pMenuBarrier->addAction(m_pActionSettings); m_pMenuBarrier->addSeparator(); + m_pMenuBarrier->addAction(m_pActionSave); + m_pMenuBarrier->addSeparator(); m_pMenuBarrier->addAction(m_pActionQuit); m_pMenuHelp->addAction(m_pActionAbout); @@ -248,6 +258,7 @@ void MainWindow::initConnections() connect(m_pActionRestore, SIGNAL(triggered()), this, SLOT(showNormal())); connect(m_pActionStartBarrier, SIGNAL(triggered()), this, SLOT(startBarrier())); connect(m_pActionStopBarrier, SIGNAL(triggered()), this, SLOT(stopBarrier())); + connect(m_pActionShowLog, SIGNAL(triggered()), this, SLOT(showLogWindow())); connect(m_pActionQuit, SIGNAL(triggered()), qApp, SLOT(quit())); } @@ -314,25 +325,25 @@ void MainWindow::logError() void MainWindow::appendLogInfo(const QString& text) { - appendLogRaw(getTimeStamp() + " INFO: " + text); + m_pLogWindow->appendInfo(text); } void MainWindow::appendLogDebug(const QString& text) { if (appConfig().logLevel() >= 4) { - appendLogRaw(getTimeStamp() + " DEBUG: " + text); + m_pLogWindow->appendDebug(text); } } void MainWindow::appendLogError(const QString& text) { - appendLogRaw(getTimeStamp() + " ERROR: " + text); + m_pLogWindow->appendError(text); } void MainWindow::appendLogRaw(const QString& text) { foreach(QString line, text.split(QRegExp("\r|\n|\r\n"))) { if (!line.isEmpty()) { - m_pLogOutput->append(line); + m_pLogWindow->appendRaw(line); updateFromLogLine(line); } } @@ -350,7 +361,7 @@ void MainWindow::checkConnected(const QString& line) // TODO: implement ipc connection state messages to replace this hack. if (line.contains("started server") || line.contains("connected to server") || - line.contains("watchdog status: ok")) + line.contains("server status: active")) { setBarrierState(barrierConnected); @@ -410,12 +421,6 @@ void MainWindow::checkFingerprint(const QString& line) } } -QString MainWindow::getTimeStamp() -{ - QDateTime current = QDateTime::currentDateTime(); - return '[' + current.toString(Qt::ISODate) + ']'; -} - void MainWindow::restartBarrier() { stopBarrier(); @@ -429,11 +434,6 @@ void MainWindow::proofreadInfo() setBarrierState((qBarrierState)oldState); } -void MainWindow::clearLog() -{ - m_pLogOutput->clear(); -} - void MainWindow::startBarrier() { bool desktopMode = appConfig().processMode() == Desktop; @@ -510,9 +510,7 @@ void MainWindow::startBarrier() connect(barrierProcess(), SIGNAL(readyReadStandardError()), this, SLOT(logError())); } - // put a space between last log output and new instance. - if (!m_pLogOutput->toPlainText().isEmpty()) - appendLogRaw(""); + m_pLogWindow->startNewInstance(); appendLogInfo("starting " + QString(barrierType() == barrierServer ? "server" : "client")); @@ -1264,3 +1262,8 @@ void MainWindow::windowStateChanged() if (windowState() == Qt::WindowMinimized && appConfig().getMinimizeToTray()) hide(); } + +void MainWindow::showLogWindow() +{ + m_pLogWindow->show(); +} diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index a85ca32b..27b30d11 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -33,6 +33,7 @@ #include "VersionChecker.h" #include "IpcClient.h" #include "Ipc.h" +#include "LogWindow.h" #include @@ -104,7 +105,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase QString address(); QString appPath(const QString& name); void open(); - void clearLog(); VersionChecker& versionChecker() { return m_VersionChecker; } QString getScreenName(); ServerConfig& serverConfig() { return m_ServerConfig; } @@ -135,6 +135,7 @@ public slots: void logOutput(); void logError(); void bonjourInstallFinished(); + void showLogWindow(); protected: QSettings& settings() { return m_Settings; } @@ -168,7 +169,6 @@ public slots: QString getProfileRootForArg(); void checkConnected(const QString& line); void checkFingerprint(const QString& line); - QString getTimeStamp(); void restartBarrier(); void proofreadInfo(); void windowStateChanged(); @@ -201,6 +201,7 @@ public slots: QMutex m_StopDesktopMutex; SslCertificate* m_pSslCertificate; QStringList m_PendingClientNames; + LogWindow *m_pLogWindow; private slots: void on_m_pCheckBoxAutoConfig_toggled(bool checked); diff --git a/src/gui/src/MainWindowBase.ui b/src/gui/src/MainWindowBase.ui index eb9b7ef9..e478339a 100644 --- a/src/gui/src/MainWindowBase.ui +++ b/src/gui/src/MainWindowBase.ui @@ -239,42 +239,6 @@ - - - - Log - - - - - - - 0 - 0 - - - - - Courier - - - - false - - - false - - - QTextEdit::NoWrap - - - true - - - - - - @@ -378,14 +342,6 @@ Ctrl+T - - - S&how Status - - - Ctrl+H - - &Hide @@ -410,7 +366,7 @@ - Save configuration &as... + S&ave configuration Save the interactively generated server configuration to a file. @@ -421,13 +377,24 @@ - Settings + Change &Settings Edit settings - + F4 + + + + + Show &Log + + + Show Log + + + F2 diff --git a/src/gui/src/main.cpp b/src/gui/src/main.cpp index 2433e9f0..1dbd53ab 100644 --- a/src/gui/src/main.cpp +++ b/src/gui/src/main.cpp @@ -84,9 +84,7 @@ int main(int argc, char* argv[]) return -1; } -#ifndef Q_OS_WIN QApplication::setQuitOnLastWindowClosed(false); -#endif QSettings settings; AppConfig appConfig (&settings); From 315f4c05ca526affeb53204b1128db7282e461d7 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sun, 25 Feb 2018 21:19:04 -0500 Subject: [PATCH 26/37] re-add Hide to menu because not all WMs will add a minimize button to the title bar; add WM hint so that tiling WMs might float it instead --- src/gui/src/MainWindow.cpp | 8 ++++++++ src/gui/src/MainWindowBase.ui | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 59b1d556..d9efafe3 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -96,6 +96,13 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) : m_pSslCertificate(NULL), m_pLogWindow(new LogWindow(nullptr)) { + // explicitly unset DeleteOnClose so the window can be show and hidden + // repeatedly until Barrier is finished + setAttribute(Qt::WA_DeleteOnClose, false); + // mark the windows as sort of "dialog" window so that tiling window + // managers will float it by default (X11) + setAttribute(Qt::WA_X11NetWmWindowTypeDialog, true); + setupUi(this); createMenuBar(); @@ -230,6 +237,7 @@ void MainWindow::createMenuBar() m_pMenuBarrier->addAction(m_pActionShowLog); m_pMenuBarrier->addAction(m_pActionSettings); + m_pMenuBarrier->addAction(m_pActionMinimize); m_pMenuBarrier->addSeparator(); m_pMenuBarrier->addAction(m_pActionSave); m_pMenuBarrier->addSeparator(); diff --git a/src/gui/src/MainWindowBase.ui b/src/gui/src/MainWindowBase.ui index e478339a..d1b0b37c 100644 --- a/src/gui/src/MainWindowBase.ui +++ b/src/gui/src/MainWindowBase.ui @@ -350,7 +350,7 @@ Hide - + F5 From db1e05ff084bd56f68871b80ce5fc220dfd24125 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Thu, 1 Mar 2018 10:57:13 -0500 Subject: [PATCH 27/37] integrate inno installer into cmake --- CMakeLists.txt | 6 ++++-- cmake/Version.cmake | 2 +- dist/inno/{barrier.iss => barrier.iss.in} | 12 ++++++------ 3 files changed, 11 insertions(+), 9 deletions(-) rename dist/inno/{barrier.iss => barrier.iss.in} (83%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 05c8f22d..5f385bec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -356,8 +356,10 @@ endif() # Windows installer # if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") - message (STATUS "Configuring the v1 installer") - configure_files (${CMAKE_CURRENT_SOURCE_DIR}/dist/wix ${CMAKE_BINARY_DIR}/installer) + message (STATUS "Configuring the wix installer") + configure_files (${CMAKE_CURRENT_SOURCE_DIR}/dist/wix ${CMAKE_BINARY_DIR}/installer-wix) + message (STATUS "Configuring the inno installer") + configure_files (${CMAKE_CURRENT_SOURCE_DIR}/dist/inno ${CMAKE_BINARY_DIR}/installer-inno) endif() # diff --git a/cmake/Version.cmake b/cmake/Version.cmake index 7deda472..a9995bb7 100644 --- a/cmake/Version.cmake +++ b/cmake/Version.cmake @@ -39,7 +39,7 @@ endif() if (NOT DEFINED BARRIER_REVISION) if (DEFINED ENV{GIT_COMMIT}) string (SUBSTRING $ENV{GIT_COMMIT} 0 8 BARRIER_REVISION) - elseif (BARRIER_VERSION_STAGE STREQUAL "snapshot") + else() execute_process ( COMMAND git rev-parse --short=8 HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} diff --git a/dist/inno/barrier.iss b/dist/inno/barrier.iss.in similarity index 83% rename from dist/inno/barrier.iss rename to dist/inno/barrier.iss.in index ec774131..6b52bcc9 100644 --- a/dist/inno/barrier.iss +++ b/dist/inno/barrier.iss.in @@ -1,5 +1,5 @@ #define MyAppName "Barrier" -#define MyAppVersion "1.9" +#define MyAppVersion "@BARRIER_VERSION@" #define MyAppPublisher "Debauchee Open Source Group" #define MyAppURL "https://github.com/debauchee/barrier/wiki" #define MyAppExeName "barrier.exe" @@ -18,10 +18,10 @@ AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DefaultDirName={pf}\{#MyAppName} DisableProgramGroupPage=yes -LicenseFile=E:\Projects\vs\barrier-release.git\res\License.rtf -OutputDir=E:\Projects\vs\barrier-release.git\build\installer\bin -OutputBaseFilename=BarrierSetup -SetupIconFile=E:\Projects\vs\barrier-release.git\res\barrier.ico +LicenseFile=@CMAKE_CURRENT_SOURCE_DIR@/res/License.rtf +OutputDir=@CMAKE_RUNTIME_OUTPUT_DIRECTORY@/../installer-inno/bin +OutputBaseFilename=BarrierSetup-{#MyAppVersion} +SetupIconFile=@CMAKE_CURRENT_SOURCE_DIR@/res/barrier.ico Compression=lzma SolidCompression=yes ArchitecturesInstallIn64BitMode=x64 ia64 @@ -32,7 +32,7 @@ ArchitecturesInstallIn64BitMode=x64 ia64 Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] -Source: "E:\Projects\vs\barrier-release.git\build\bin\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "@CMAKE_RUNTIME_OUTPUT_DIRECTORY@/Release/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] From 786d5133798a4b5f0cc36484030b36b59fe7f255 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Thu, 1 Mar 2018 12:22:54 -0500 Subject: [PATCH 28/37] fix build script --- clean_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clean_build.sh b/clean_build.sh index cdd81fbd..0c7ee516 100755 --- a/clean_build.sh +++ b/clean_build.sh @@ -16,9 +16,9 @@ if [ "$(uname)" = "Darwin" ]; then source ./osx_environment.sh B_CMAKE_FLAGS="-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 $B_CMAKE_FLAGS" fi -B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE $B_CMAKE_FLAGS" # allow local customizations to build environment [ -r ./unixbuild_env.sh ] && source ./unixbuild_env.sh +B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE $B_CMAKE_FLAGS" rm -rf build mkdir build || exit 1 cd build || exit 1 From e6a3a124ee4201eaae8d859db46501700f9bade1 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Thu, 1 Mar 2018 13:05:53 -0500 Subject: [PATCH 29/37] improve macos build --- .gitignore | 3 +- build_installer.bat | 2 +- clean_build.bat | 4 +-- clean_build.sh | 2 +- .../macos/bundle/build_installer.sh.in | 28 +++++++++---------- .../macos/bundle/reref_dylibs.sh | 0 6 files changed, 18 insertions(+), 21 deletions(-) rename build_osx_installer.sh => dist/macos/bundle/build_installer.sh.in (75%) rename osx_reref_dylibs.sh => dist/macos/bundle/reref_dylibs.sh (100%) diff --git a/.gitignore b/.gitignore index 4000ad56..eb253b1c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -winbuild_env.bat -unixbuild_env.sh +build_env.* config.h .DS_Store *.pyc diff --git a/build_installer.bat b/build_installer.bat index ac292c21..424e585a 100644 --- a/build_installer.bat +++ b/build_installer.bat @@ -19,7 +19,7 @@ goto done :buildproject echo To build a 64-bit Windows installer: -echo - set Q_BUILD_TYPE=Release in winbuild_env.bat +echo - set Q_BUILD_TYPE=Release in build_env.bat echo - also set other environmental overrides necessary for your build environment echo - run clean_build.bat to build Barrier and verify that it succeeds echo - re-run this script to create the installation package diff --git a/clean_build.bat b/clean_build.bat index 14268cd5..9aebadd8 100644 --- a/clean_build.bat +++ b/clean_build.bat @@ -1,6 +1,6 @@ @echo off -REM defaults - override them by creating a winbuild_env.bat file +REM defaults - override them by creating a build_env.bat file set B_BUILD_TYPE=Debug set B_QT_ROOT=C:\Qt set B_QT_VER=5.6.3 @@ -10,7 +10,7 @@ set B_BONJOUR=C:\Program Files\Bonjour SDK set savedir=%cd% cd /d %~dp0 -if exist winbuild_env.bat call winbuild_env.bat +if exist build_env.bat call build_env.bat REM needed by cmake to set bonjour include dir set BONJOUR_SDK_HOME=%B_BONJOUR% diff --git a/clean_build.sh b/clean_build.sh index 0c7ee516..730b21d0 100755 --- a/clean_build.sh +++ b/clean_build.sh @@ -17,7 +17,7 @@ if [ "$(uname)" = "Darwin" ]; then B_CMAKE_FLAGS="-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 $B_CMAKE_FLAGS" fi # allow local customizations to build environment -[ -r ./unixbuild_env.sh ] && source ./unixbuild_env.sh +[ -r ./build_env.sh ] && source ./build_env.sh B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE $B_CMAKE_FLAGS" rm -rf build mkdir build || exit 1 diff --git a/build_osx_installer.sh b/dist/macos/bundle/build_installer.sh.in similarity index 75% rename from build_osx_installer.sh rename to dist/macos/bundle/build_installer.sh.in index 43276af3..1fa724c7 100755 --- a/build_osx_installer.sh +++ b/dist/macos/bundle/build_installer.sh.in @@ -1,29 +1,27 @@ #!/bin/sh # change this to rename the installer package -B_DMG="Barrier-v1.9.dmg" - -cd $(dirname $0) +B_DMG="Barrier-@BARRIER_VERSION@.dmg" # sanity check so we don't distribute packages full of debug symbols -B_BUILD_TYPE=$(grep -E ^CMAKE_BUILD_TYPE build/CMakeCache.txt | cut -d= -f2) -if [ "$B_BUILD_TYPE" != "Release" ]; then +if [ "@CMAKE_BUILD_TYPE@" != "Release" ]; then echo Will only build installers for Release builds exit 1 fi -B_REREF_SCRIPT=$(pwd)/osx_reref_dylibs.sh +cd @CMAKE_CURRENT_SOURCE_DIR@/build/bundle || exit 1 + +B_REREF_SCRIPT=./reref_dylibs.sh if [ ! -x $B_REREF_SCRIPT ]; then echo Missing script: $B_REREF_SCRIPT exit 1 fi -# remove any old copies so there's no confusion about whever this +# remove any old copies so there's no confusion about whether this # process completes successfully or not -rm -rf build/bundle/{bundle.dmg,$B_DMG} +rm -rf temp.dmg $B_DMG -B_BINARY_PATH=$(pwd)/build/bin -cd build/bundle/Barrier.app/Contents 2>/dev/null +cd Barrier.app/Contents 2>/dev/null if [ $? -ne 0 ]; then echo Please make sure that the build completed successfully echo before trying to create the installer. @@ -37,7 +35,7 @@ mkdir MacOS || exit 1 cd MacOS || exit 1 # copy all executables -cp ${B_BINARY_PATH}/* . || exit 1 +cp @CMAKE_RUNTIME_OUTPUT_DIR@/* . || exit 1 # copy the qt platform plugin # TODO: this is hacky and will probably break if there is more than one qt @@ -69,11 +67,11 @@ chmod +x barrier.sh # create the DMG to be distributed in build/bundle cd ../../.. -hdiutil create -size 64m -fs HFS+ -volname "Barrier" bundle.dmg || exit 1 -hdiutil attach bundle.dmg -mountpoint mnt || exit 1 +hdiutil create -size 64m -fs HFS+ -volname "Barrier" temp.dmg || exit 1 +hdiutil attach temp.dmg -mountpoint mnt || exit 1 cp -r Barrier.app mnt/ || exit 1 hdiutil detach mnt || exit 1 -hdiutil convert bundle.dmg -format UDZO -o $B_DMG || exit 1 -rm bundle.dmg +hdiutil convert temp.dmg -format UDZO -o $B_DMG || exit 1 +rm temp.dmg echo "Installer created successfully" diff --git a/osx_reref_dylibs.sh b/dist/macos/bundle/reref_dylibs.sh similarity index 100% rename from osx_reref_dylibs.sh rename to dist/macos/bundle/reref_dylibs.sh From 116a13390233959be67d140b9c831f51709800fa Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Thu, 1 Mar 2018 13:22:47 -0500 Subject: [PATCH 30/37] fix macos installer script --- cmake/Version.cmake | 2 +- dist/macos/bundle/build_installer.sh.in | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/Version.cmake b/cmake/Version.cmake index a9995bb7..ea565eb1 100644 --- a/cmake/Version.cmake +++ b/cmake/Version.cmake @@ -74,7 +74,7 @@ else() set (BARRIER_VERSION_TAG "${BARRIER_VERSION_STAGE}") endif() -set (BARRIER_VERSION "${BARRIER_VERSION_MAJOR}.${BARRIER_VERSION_MINOR}.${BARRIER_VERSION_PATCH}") +set (BARRIER_VERSION "${BARRIER_VERSION_MAJOR}.${BARRIER_VERSION_MINOR}.${BARRIER_VERSION_PATCH}-${BARRIER_VERSION_STAGE}") set (BARRIER_VERSION_STRING "${BARRIER_VERSION}-${BARRIER_VERSION_TAG}") message (STATUS "Full Barrier version string is '" ${BARRIER_VERSION_STRING} "'") diff --git a/dist/macos/bundle/build_installer.sh.in b/dist/macos/bundle/build_installer.sh.in index 1fa724c7..b475343c 100755 --- a/dist/macos/bundle/build_installer.sh.in +++ b/dist/macos/bundle/build_installer.sh.in @@ -11,7 +11,7 @@ fi cd @CMAKE_CURRENT_SOURCE_DIR@/build/bundle || exit 1 -B_REREF_SCRIPT=./reref_dylibs.sh +B_REREF_SCRIPT=@CMAKE_CURRENT_SOURCE_DIR@/reref_dylibs.sh if [ ! -x $B_REREF_SCRIPT ]; then echo Missing script: $B_REREF_SCRIPT exit 1 @@ -35,7 +35,7 @@ mkdir MacOS || exit 1 cd MacOS || exit 1 # copy all executables -cp @CMAKE_RUNTIME_OUTPUT_DIR@/* . || exit 1 +cp @CMAKE_RUNTIME_OUTPUT_DIRECTORY@/* . || exit 1 # copy the qt platform plugin # TODO: this is hacky and will probably break if there is more than one qt From c605cbdbcc1d9c95a1e704714539a8be679e4720 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Thu, 1 Mar 2018 13:27:58 -0500 Subject: [PATCH 31/37] fix macos installer script --- dist/macos/bundle/build_installer.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/macos/bundle/build_installer.sh.in b/dist/macos/bundle/build_installer.sh.in index b475343c..f939b776 100755 --- a/dist/macos/bundle/build_installer.sh.in +++ b/dist/macos/bundle/build_installer.sh.in @@ -11,7 +11,7 @@ fi cd @CMAKE_CURRENT_SOURCE_DIR@/build/bundle || exit 1 -B_REREF_SCRIPT=@CMAKE_CURRENT_SOURCE_DIR@/reref_dylibs.sh +B_REREF_SCRIPT=@CMAKE_CURRENT_SOURCE_DIR@/build/bundle/reref_dylibs.sh if [ ! -x $B_REREF_SCRIPT ]; then echo Missing script: $B_REREF_SCRIPT exit 1 From 625253a7e8e2db5b46db816e12649e4ad22b3383 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Fri, 2 Mar 2018 18:36:31 -0500 Subject: [PATCH 32/37] fix FreeBSD build --- CMakeLists.txt | 25 +++++++++++++++++++++---- src/gui/CMakeLists.txt | 3 ++- src/lib/arch/CMakeLists.txt | 5 ++++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f385bec..7e182f71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,9 +157,14 @@ if (UNIX) ) else() # not-apple - - # add include dir for bsd (posix uses /usr/include/) - set (CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH}:/usr/local/include") + # FreeBSD uses /usr/local for anything not part of base + # Also package avahi-libdns puts dns_sd.h a bit deeper + if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + set (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};/usr/local/include;/usr/local/include/avahi-compat-libdns_sd") + set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L/usr/local/lib") + include_directories("/usr/local/include" "/usr/local/include/avahi-compat-libdns_sd") + link_directories("/usr/local/lib") + endif() set (XKBlib "X11/Xlib.h;X11/XKBlib.h") set (CMAKE_EXTRA_INCLUDE_FILES "${XKBlib};X11/extensions/Xrandr.h") @@ -174,6 +179,7 @@ if (UNIX) check_include_files ("X11/extensions/XTest.h" HAVE_X11_EXTENSIONS_XTEST_H) check_include_files ("${XKBlib}" HAVE_X11_XKBLIB_H) check_include_files ("X11/extensions/XInput2.h" HAVE_XI2) + check_include_files ("dns_sd.h" HAVE_DNSSD) if (HAVE_X11_EXTENSIONS_DPMS_H) # Assume that function prototypes declared, when include exists. @@ -184,6 +190,10 @@ if (UNIX) message (FATAL_ERROR "Missing header: " ${XKBlib}) endif() + if (NOT HAVE_DNSSD) + message (FATAL_ERROR "Missing header: dns_sd.h") + endif() + check_library_exists ("SM;ICE" IceConnectionNumber "" HAVE_ICE) check_library_exists ("Xext;X11" DPMSQueryExtension "" HAVE_Xext) check_library_exists ("Xtst;Xext;X11" XTestQueryExtension "" HAVE_Xtst) @@ -305,7 +315,14 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") set (OPENSSL_LIBS ssl crypto) else() - message (FATAL_ERROR "Couldn't find OpenSSL") + find_library (lib_ssl ssl) + find_library (lib_crypto crypto) + if (NOT lib_ssl) + message(FATAL_ERROR "openssl library not found") + elseif (NOT lib_crypto) + message(FATAL_ERROR "crypto library not found") + endif() + set (OPENSSL_LIBS ${lib_ssl} ${lib_crypto}) endif() # diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 869ef47a..4a7e291a 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -36,7 +36,8 @@ if (WIN32) elseif (APPLE) find_library(APPSERVICES_LIB ApplicationServices) target_link_libraries(barrier ${APPSERVICES_LIB}) -elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") +elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR + ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") target_link_libraries (barrier dns_sd) else() target_link_libraries (barrier) diff --git a/src/lib/arch/CMakeLists.txt b/src/lib/arch/CMakeLists.txt index 8a06b41e..113cdd99 100644 --- a/src/lib/arch/CMakeLists.txt +++ b/src/lib/arch/CMakeLists.txt @@ -40,5 +40,8 @@ endif() add_library(arch STATIC ${sources}) if (UNIX) - target_link_libraries(arch dl ${libs}) + target_link_libraries(arch ${libs}) + if (NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + target_link_libraries(arch dl) + endif() endif() From 5b31036cdc4345ecb35a1c338fc6f2439310bc41 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sat, 3 Mar 2018 12:57:13 -0500 Subject: [PATCH 33/37] fix bad logic in XWindowsScreen.cpp --- src/lib/platform/XWindowsScreen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/platform/XWindowsScreen.cpp b/src/lib/platform/XWindowsScreen.cpp index 3a001ff7..581c9111 100644 --- a/src/lib/platform/XWindowsScreen.cpp +++ b/src/lib/platform/XWindowsScreen.cpp @@ -1405,9 +1405,9 @@ XWindowsScreen::handleSystemEvent(const Event& event, void*) #if HAVE_X11_EXTENSIONS_XRANDR_H if (m_xrandr) { - if (xevent->type == m_xrandrEventBase + RRScreenChangeNotify - || xevent->type == m_xrandrEventBase + RRNotify - && reinterpret_cast(xevent)->subtype == RRNotify_CrtcChange) { + if (xevent->type == m_xrandrEventBase + RRScreenChangeNotify || + (xevent->type == m_xrandrEventBase + RRNotify && + reinterpret_cast(xevent)->subtype == RRNotify_CrtcChange)) { LOG((CLOG_INFO "XRRScreenChangeNotifyEvent or RRNotify_CrtcChange received")); // we're required to call back into XLib so XLib can update its internal state From 5362dbc297c56c03f2be2334cf3a266a0e024122 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sat, 3 Mar 2018 12:57:49 -0500 Subject: [PATCH 34/37] replace source with . in sh scripts for compatibility --- clean_build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clean_build.sh b/clean_build.sh index 730b21d0..3085c08f 100755 --- a/clean_build.sh +++ b/clean_build.sh @@ -13,11 +13,11 @@ B_BUILD_TYPE=${B_BUILD_TYPE:-Debug} if [ "$(uname)" = "Darwin" ]; then # OSX needs a lot of extra help, poor thing # run the osx_environment.sh script to fix paths - source ./osx_environment.sh + . ./osx_environment.sh B_CMAKE_FLAGS="-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 $B_CMAKE_FLAGS" fi # allow local customizations to build environment -[ -r ./build_env.sh ] && source ./build_env.sh +[ -r ./build_env.sh ] && . ./build_env.sh B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE $B_CMAKE_FLAGS" rm -rf build mkdir build || exit 1 From e396f8d55e1f8629e042bc3b2d52908496049b16 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sat, 3 Mar 2018 14:34:34 -0500 Subject: [PATCH 35/37] sync mainwindow icon to current application status --- src/gui/src/MainWindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index d9efafe3..ff9725c0 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -288,6 +288,8 @@ void MainWindow::setIcon(qBarrierState state) QIcon icon; icon.addFile(barrierIconFiles[state]); + setWindowIcon(icon); + if (m_pTrayIcon) m_pTrayIcon->setIcon(icon); } From 3edbc0039787d38a5ca307af4dc6f16ea8a63fe4 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sun, 4 Mar 2018 14:48:15 -0500 Subject: [PATCH 36/37] fix X11 crash if DISPLAY is not valid --- CMakeLists.txt | 2 +- src/gui/CMakeLists.txt | 6 ++++-- src/gui/src/DisplayIsValid.cpp | 14 ++++++++++++++ src/gui/src/DisplayIsValid.h | 5 +++++ src/gui/src/main.cpp | 9 +++++++++ 5 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 src/gui/src/DisplayIsValid.cpp create mode 100644 src/gui/src/DisplayIsValid.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e182f71..27dccc96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -212,7 +212,7 @@ if (UNIX) if (HAVE_Xtst) # Xtxt depends on X11. - set (HAVE_X11) + set (HAVE_X11 1) list (APPEND libs Xtst X11) else() diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 4a7e291a..a5dc9874 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -39,8 +39,10 @@ elseif (APPLE) elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") target_link_libraries (barrier dns_sd) -else() - target_link_libraries (barrier) +endif() + +if (HAVE_X11) + target_link_libraries (barrier X11) endif() if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") diff --git a/src/gui/src/DisplayIsValid.cpp b/src/gui/src/DisplayIsValid.cpp new file mode 100644 index 00000000..5685c42d --- /dev/null +++ b/src/gui/src/DisplayIsValid.cpp @@ -0,0 +1,14 @@ +#ifdef WINAPI_XWINDOWS + +#include "DisplayIsValid.h" +#include + +bool display_is_valid() +{ + auto dsp = XOpenDisplay(NULL); + if (dsp != NULL) + XCloseDisplay(dsp); + return dsp != NULL; +} + +#endif diff --git a/src/gui/src/DisplayIsValid.h b/src/gui/src/DisplayIsValid.h new file mode 100644 index 00000000..d5fcac83 --- /dev/null +++ b/src/gui/src/DisplayIsValid.h @@ -0,0 +1,5 @@ +#pragma once + +#ifdef WINAPI_XWINDOWS +bool display_is_valid(); +#endif diff --git a/src/gui/src/main.cpp b/src/gui/src/main.cpp index 1dbd53ab..76a7d1a2 100644 --- a/src/gui/src/main.cpp +++ b/src/gui/src/main.cpp @@ -23,6 +23,7 @@ #include "MainWindow.h" #include "AppConfig.h" #include "SetupWizard.h" +#include "DisplayIsValid.h" #include #include @@ -54,6 +55,14 @@ bool checkMacAssistiveDevices(); int main(int argc, char* argv[]) { +#ifdef WINAPI_XWINDOWS + // QApplication's constructor will call a fscking abort() if + // DISPLAY is bad. Let's check it first and handle it gracefully + if (!display_is_valid()) { + fprintf(stderr, "The Barrier GUI requires a display. Quitting...\n"); + return 1; + } +#endif #ifdef Q_OS_DARWIN /* Workaround for QTBUG-40332 - "High ping when QNetworkAccessManager is instantiated" */ ::setenv ("QT_BEARER_POLL_TIMEOUT", "-1", 1); From b4604b09215af3f8940cd9afe2c9fcc500ec4fc7 Mon Sep 17 00:00:00 2001 From: walker0643 <> Date: Sun, 4 Mar 2018 16:58:17 -0500 Subject: [PATCH 37/37] fix QBarrier references --- src/gui/gui.ts | 4 ++-- src/gui/res/lang/gui_af-ZA.ts | 4 ++-- src/gui/res/lang/gui_ar.ts | 4 ++-- src/gui/res/lang/gui_bg-BG.ts | 4 ++-- src/gui/res/lang/gui_ca-AD.ts | 4 ++-- src/gui/res/lang/gui_cs-CZ.ts | 4 ++-- src/gui/res/lang/gui_cy.ts | 4 ++-- src/gui/res/lang/gui_da.ts | 4 ++-- src/gui/res/lang/gui_de.ts | 4 ++-- src/gui/res/lang/gui_es.ts | 4 ++-- src/gui/res/lang/gui_et-EE.ts | 4 ++-- src/gui/res/lang/gui_fi.ts | 4 ++-- src/gui/res/lang/gui_fr.ts | 4 ++-- src/gui/res/lang/gui_gl.ts | 4 ++-- src/gui/res/lang/gui_grk.ts | 4 ++-- src/gui/res/lang/gui_he.ts | 4 ++-- src/gui/res/lang/gui_hi.ts | 4 ++-- src/gui/res/lang/gui_hr-HR.ts | 4 ++-- src/gui/res/lang/gui_hu-HU.ts | 4 ++-- src/gui/res/lang/gui_id.ts | 4 ++-- src/gui/res/lang/gui_is-IS.ts | 4 ++-- src/gui/res/lang/gui_it.ts | 4 ++-- src/gui/res/lang/gui_ja-JP.ts | 4 ++-- src/gui/res/lang/gui_ko.ts | 4 ++-- src/gui/res/lang/gui_lt.ts | 4 ++-- src/gui/res/lang/gui_lv.ts | 4 ++-- src/gui/res/lang/gui_mr.ts | 4 ++-- src/gui/res/lang/gui_nl-NL.ts | 4 ++-- src/gui/res/lang/gui_no.ts | 4 ++-- src/gui/res/lang/gui_pes-IR.ts | 4 ++-- src/gui/res/lang/gui_pl-PL.ts | 4 ++-- src/gui/res/lang/gui_pt-BR.ts | 4 ++-- src/gui/res/lang/gui_pt-PT.ts | 4 ++-- src/gui/res/lang/gui_ro.ts | 4 ++-- src/gui/res/lang/gui_ru.ts | 4 ++-- src/gui/res/lang/gui_si.ts | 4 ++-- src/gui/res/lang/gui_sk-SK.ts | 4 ++-- src/gui/res/lang/gui_sl-SI.ts | 4 ++-- src/gui/res/lang/gui_sq-AL.ts | 4 ++-- src/gui/res/lang/gui_sr.ts | 4 ++-- src/gui/res/lang/gui_sv.ts | 4 ++-- src/gui/res/lang/gui_th-TH.ts | 4 ++-- src/gui/res/lang/gui_tr-TR.ts | 4 ++-- src/gui/res/lang/gui_uk.ts | 4 ++-- src/gui/res/lang/gui_ur.ts | 4 ++-- src/gui/res/lang/gui_vi.ts | 4 ++-- src/gui/res/lang/gui_zh-CN.ts | 4 ++-- src/gui/res/lang/gui_zh-TW.ts | 4 ++-- src/gui/src/AboutDialogBase.ui | 2 +- src/gui/src/KeySequence.cpp | 2 +- 50 files changed, 98 insertions(+), 98 deletions(-) diff --git a/src/gui/gui.ts b/src/gui/gui.ts index af7d1805..861a4967 100644 --- a/src/gui/gui.ts +++ b/src/gui/gui.ts @@ -17,7 +17,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz. +The Barrier GUI is based on QSynergy by Volker Lanz. </p> <p> Keyboard and mouse sharing application. Cross platform and open source.<br /><br /> @@ -26,7 +26,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz. +The Barrier GUI is based on QSynergy by Volker Lanz. </p> diff --git a/src/gui/res/lang/gui_af-ZA.ts b/src/gui/res/lang/gui_af-ZA.ts index 381ea79a..446c9a4f 100644 --- a/src/gui/res/lang/gui_af-ZA.ts +++ b/src/gui/res/lang/gui_af-ZA.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_ar.ts b/src/gui/res/lang/gui_ar.ts index e2a91a82..c934dbad 100644 --- a/src/gui/res/lang/gui_ar.ts +++ b/src/gui/res/lang/gui_ar.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_bg-BG.ts b/src/gui/res/lang/gui_bg-BG.ts index 0a20c17c..fc6988e7 100644 --- a/src/gui/res/lang/gui_bg-BG.ts +++ b/src/gui/res/lang/gui_bg-BG.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_ca-AD.ts b/src/gui/res/lang/gui_ca-AD.ts index a2b01c81..3ccc7ebc 100644 --- a/src/gui/res/lang/gui_ca-AD.ts +++ b/src/gui/res/lang/gui_ca-AD.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_cs-CZ.ts b/src/gui/res/lang/gui_cs-CZ.ts index dd585c3f..fd639fa2 100644 --- a/src/gui/res/lang/gui_cs-CZ.ts +++ b/src/gui/res/lang/gui_cs-CZ.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_cy.ts b/src/gui/res/lang/gui_cy.ts index 892fb2f9..15b59ea2 100644 --- a/src/gui/res/lang/gui_cy.ts +++ b/src/gui/res/lang/gui_cy.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_da.ts b/src/gui/res/lang/gui_da.ts index c1b655b6..d910ccbf 100644 --- a/src/gui/res/lang/gui_da.ts +++ b/src/gui/res/lang/gui_da.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_de.ts b/src/gui/res/lang/gui_de.ts index 98f21781..4b826f53 100644 --- a/src/gui/res/lang/gui_de.ts +++ b/src/gui/res/lang/gui_de.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_es.ts b/src/gui/res/lang/gui_es.ts index d16f80cf..98ee4f9d 100644 --- a/src/gui/res/lang/gui_es.ts +++ b/src/gui/res/lang/gui_es.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_et-EE.ts b/src/gui/res/lang/gui_et-EE.ts index 9b0d7080..1e1ea573 100644 --- a/src/gui/res/lang/gui_et-EE.ts +++ b/src/gui/res/lang/gui_et-EE.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_fi.ts b/src/gui/res/lang/gui_fi.ts index bac219b0..9fe0b607 100644 --- a/src/gui/res/lang/gui_fi.ts +++ b/src/gui/res/lang/gui_fi.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_fr.ts b/src/gui/res/lang/gui_fr.ts index 0c69d07e..8d96c5b7 100644 --- a/src/gui/res/lang/gui_fr.ts +++ b/src/gui/res/lang/gui_fr.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_gl.ts b/src/gui/res/lang/gui_gl.ts index c91c7635..727878fe 100644 --- a/src/gui/res/lang/gui_gl.ts +++ b/src/gui/res/lang/gui_gl.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_grk.ts b/src/gui/res/lang/gui_grk.ts index 5e37e75e..03b71e22 100644 --- a/src/gui/res/lang/gui_grk.ts +++ b/src/gui/res/lang/gui_grk.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_he.ts b/src/gui/res/lang/gui_he.ts index 9b920d20..192d2a1f 100644 --- a/src/gui/res/lang/gui_he.ts +++ b/src/gui/res/lang/gui_he.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_hi.ts b/src/gui/res/lang/gui_hi.ts index 0af6b7d6..a6ba550d 100644 --- a/src/gui/res/lang/gui_hi.ts +++ b/src/gui/res/lang/gui_hi.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_hr-HR.ts b/src/gui/res/lang/gui_hr-HR.ts index 24857d09..89e437a1 100644 --- a/src/gui/res/lang/gui_hr-HR.ts +++ b/src/gui/res/lang/gui_hr-HR.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_hu-HU.ts b/src/gui/res/lang/gui_hu-HU.ts index 6db281be..524c0131 100644 --- a/src/gui/res/lang/gui_hu-HU.ts +++ b/src/gui/res/lang/gui_hu-HU.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_id.ts b/src/gui/res/lang/gui_id.ts index c083b990..fc2cd9eb 100644 --- a/src/gui/res/lang/gui_id.ts +++ b/src/gui/res/lang/gui_id.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_is-IS.ts b/src/gui/res/lang/gui_is-IS.ts index ecb6a53a..a4c0aa7d 100644 --- a/src/gui/res/lang/gui_is-IS.ts +++ b/src/gui/res/lang/gui_is-IS.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_it.ts b/src/gui/res/lang/gui_it.ts index af9a4a4f..a802e28e 100644 --- a/src/gui/res/lang/gui_it.ts +++ b/src/gui/res/lang/gui_it.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_ja-JP.ts b/src/gui/res/lang/gui_ja-JP.ts index 2625410a..c4c0e9ec 100644 --- a/src/gui/res/lang/gui_ja-JP.ts +++ b/src/gui/res/lang/gui_ja-JP.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_ko.ts b/src/gui/res/lang/gui_ko.ts index 31ed00f0..fee6276b 100644 --- a/src/gui/res/lang/gui_ko.ts +++ b/src/gui/res/lang/gui_ko.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_lt.ts b/src/gui/res/lang/gui_lt.ts index 23291ab4..45713fb5 100644 --- a/src/gui/res/lang/gui_lt.ts +++ b/src/gui/res/lang/gui_lt.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_lv.ts b/src/gui/res/lang/gui_lv.ts index 2cbc58ff..e53cf7d8 100644 --- a/src/gui/res/lang/gui_lv.ts +++ b/src/gui/res/lang/gui_lv.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_mr.ts b/src/gui/res/lang/gui_mr.ts index 492813a1..028005da 100644 --- a/src/gui/res/lang/gui_mr.ts +++ b/src/gui/res/lang/gui_mr.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_nl-NL.ts b/src/gui/res/lang/gui_nl-NL.ts index f0725cda..2eabfbbf 100644 --- a/src/gui/res/lang/gui_nl-NL.ts +++ b/src/gui/res/lang/gui_nl-NL.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_no.ts b/src/gui/res/lang/gui_no.ts index 2853168b..42d5b959 100644 --- a/src/gui/res/lang/gui_no.ts +++ b/src/gui/res/lang/gui_no.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_pes-IR.ts b/src/gui/res/lang/gui_pes-IR.ts index 931c275e..d4a0f919 100644 --- a/src/gui/res/lang/gui_pes-IR.ts +++ b/src/gui/res/lang/gui_pes-IR.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_pl-PL.ts b/src/gui/res/lang/gui_pl-PL.ts index f416fb59..9fef7f3b 100644 --- a/src/gui/res/lang/gui_pl-PL.ts +++ b/src/gui/res/lang/gui_pl-PL.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_pt-BR.ts b/src/gui/res/lang/gui_pt-BR.ts index 34bd87a9..802551b3 100644 --- a/src/gui/res/lang/gui_pt-BR.ts +++ b/src/gui/res/lang/gui_pt-BR.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_pt-PT.ts b/src/gui/res/lang/gui_pt-PT.ts index 1396e809..45a20a87 100644 --- a/src/gui/res/lang/gui_pt-PT.ts +++ b/src/gui/res/lang/gui_pt-PT.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_ro.ts b/src/gui/res/lang/gui_ro.ts index 70123a9b..e79e83b9 100644 --- a/src/gui/res/lang/gui_ro.ts +++ b/src/gui/res/lang/gui_ro.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_ru.ts b/src/gui/res/lang/gui_ru.ts index fde9298c..08cc4cbc 100644 --- a/src/gui/res/lang/gui_ru.ts +++ b/src/gui/res/lang/gui_ru.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_si.ts b/src/gui/res/lang/gui_si.ts index 6db56fd0..cb566779 100644 --- a/src/gui/res/lang/gui_si.ts +++ b/src/gui/res/lang/gui_si.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_sk-SK.ts b/src/gui/res/lang/gui_sk-SK.ts index f979d065..aac1379d 100644 --- a/src/gui/res/lang/gui_sk-SK.ts +++ b/src/gui/res/lang/gui_sk-SK.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_sl-SI.ts b/src/gui/res/lang/gui_sl-SI.ts index 3460d08e..2d4a49df 100644 --- a/src/gui/res/lang/gui_sl-SI.ts +++ b/src/gui/res/lang/gui_sl-SI.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_sq-AL.ts b/src/gui/res/lang/gui_sq-AL.ts index 572893cd..980b795e 100644 --- a/src/gui/res/lang/gui_sq-AL.ts +++ b/src/gui/res/lang/gui_sq-AL.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_sr.ts b/src/gui/res/lang/gui_sr.ts index 0b2ac866..f2454754 100644 --- a/src/gui/res/lang/gui_sr.ts +++ b/src/gui/res/lang/gui_sr.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_sv.ts b/src/gui/res/lang/gui_sv.ts index d67f26a2..84949708 100644 --- a/src/gui/res/lang/gui_sv.ts +++ b/src/gui/res/lang/gui_sv.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_th-TH.ts b/src/gui/res/lang/gui_th-TH.ts index ec9aba3a..878a4e35 100644 --- a/src/gui/res/lang/gui_th-TH.ts +++ b/src/gui/res/lang/gui_th-TH.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_tr-TR.ts b/src/gui/res/lang/gui_tr-TR.ts index cf863906..d35de141 100644 --- a/src/gui/res/lang/gui_tr-TR.ts +++ b/src/gui/res/lang/gui_tr-TR.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_uk.ts b/src/gui/res/lang/gui_uk.ts index 5890e3a4..68cac01d 100644 --- a/src/gui/res/lang/gui_uk.ts +++ b/src/gui/res/lang/gui_uk.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_ur.ts b/src/gui/res/lang/gui_ur.ts index e40cb8b2..2dbd1ea0 100644 --- a/src/gui/res/lang/gui_ur.ts +++ b/src/gui/res/lang/gui_ur.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_vi.ts b/src/gui/res/lang/gui_vi.ts index 79f6b5f1..e4031c56 100644 --- a/src/gui/res/lang/gui_vi.ts +++ b/src/gui/res/lang/gui_vi.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_zh-CN.ts b/src/gui/res/lang/gui_zh-CN.ts index 826ef9eb..b5cdf6c5 100644 --- a/src/gui/res/lang/gui_zh-CN.ts +++ b/src/gui/res/lang/gui_zh-CN.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/res/lang/gui_zh-TW.ts b/src/gui/res/lang/gui_zh-TW.ts index 6d6137b3..fc55f56e 100644 --- a/src/gui/res/lang/gui_zh-TW.ts +++ b/src/gui/res/lang/gui_zh-TW.ts @@ -14,7 +14,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> <p> @@ -23,7 +23,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz.<br /><br /> +The Barrier GUI is based on QSynergy by Volker Lanz.<br /><br /> Visit our website for help and info (symless.com). </p> diff --git a/src/gui/src/AboutDialogBase.ui b/src/gui/src/AboutDialogBase.ui index 910ecf2b..96fee154 100644 --- a/src/gui/src/AboutDialogBase.ui +++ b/src/gui/src/AboutDialogBase.ui @@ -57,7 +57,7 @@ Copyright © 2012-2016 Symless Ltd.<br /> Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br /> Barrier is released under the GNU General Public License (GPLv2).<br /><br /> Barrier is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> -The Barrier GUI is based on QBarrier by Volker Lanz. +The Barrier GUI is based on QSynergy by Volker Lanz. </p> diff --git a/src/gui/src/KeySequence.cpp b/src/gui/src/KeySequence.cpp index ee0fd562..cc74cb2b 100644 --- a/src/gui/src/KeySequence.cpp +++ b/src/gui/src/KeySequence.cpp @@ -22,7 +22,7 @@ #include // this table originally comes from Qt sources (gui/kernel/qkeysequence.cpp) -// and is heavily modified for QBarrier +// and is heavily modified static const struct { int key;