diff --git a/cmd/synergys/CMSWindowsServerTaskBarReceiver.cpp b/cmd/synergys/CMSWindowsServerTaskBarReceiver.cpp index 5f5e5a24..3a79cb27 100644 --- a/cmd/synergys/CMSWindowsServerTaskBarReceiver.cpp +++ b/cmd/synergys/CMSWindowsServerTaskBarReceiver.cpp @@ -15,12 +15,15 @@ #include "CMSWindowsServerTaskBarReceiver.h" #include "CServer.h" #include "CMSWindowsClipboard.h" +#include "IEventQueue.h" #include "LogOutputters.h" #include "BasicTypes.h" #include "CArch.h" #include "CArchTaskBarWindows.h" #include "resource.h" +extern CEvent::Type getReloadConfigEvent(); + // // CMSWindowsServerTaskBarReceiver // @@ -171,6 +174,11 @@ CMSWindowsServerTaskBarReceiver::runMenu(int x, int y) copyLog(); break; + case IDC_RELOAD_CONFIG: + EVENTQUEUE->addEvent(CEvent(getReloadConfigEvent(), + IEventQueue::getSystemTarget())); + break; + case IDC_TASKBAR_QUIT: quit(); break; diff --git a/cmd/synergys/resource.h b/cmd/synergys/resource.h index c52355cf..57fd8c35 100644 --- a/cmd/synergys/resource.h +++ b/cmd/synergys/resource.h @@ -17,13 +17,14 @@ #define IDC_TASKBAR_QUIT 40003 #define IDC_TASKBAR_STATUS 40004 #define IDC_TASKBAR_LOG 40005 +#define IDC_RELOAD_CONFIG 40006 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 109 -#define _APS_NEXT_COMMAND_VALUE 40006 +#define _APS_NEXT_COMMAND_VALUE 40007 #define _APS_NEXT_CONTROL_VALUE 1003 #define _APS_NEXT_SYMED_VALUE 101 #endif diff --git a/cmd/synergys/synergys.cpp b/cmd/synergys/synergys.cpp index a7b70cd6..c1370197 100644 --- a/cmd/synergys/synergys.cpp +++ b/cmd/synergys/synergys.cpp @@ -144,6 +144,12 @@ static CClientListener* s_listener = NULL; static CServerTaskBarReceiver* s_taskBarReceiver = NULL; static CEvent::Type s_reloadConfigEvent = CEvent::kUnknown; +CEvent::Type +getReloadConfigEvent() +{ + return CEvent::registerTypeOnce(s_reloadConfigEvent, "reloadConfig"); +} + static void updateStatus() @@ -395,7 +401,7 @@ static void reloadSignalHandler(CArch::ESignal, void*) { - EVENTQUEUE->addEvent(CEvent(s_reloadConfigEvent, + EVENTQUEUE->addEvent(CEvent(getReloadConfigEvent(), IEventQueue::getSystemTarget())); } @@ -454,9 +460,8 @@ mainLoop() } // handle hangup signal by reloading the server's configuration - CEvent::registerTypeOnce(s_reloadConfigEvent, "reloadConfig"); ARCH->setSignalHandler(CArch::kHANGUP, &reloadSignalHandler, NULL); - EVENTQUEUE->adoptHandler(s_reloadConfigEvent, + EVENTQUEUE->adoptHandler(getReloadConfigEvent(), IEventQueue::getSystemTarget(), new CFunctionEventJob(&reloadConfig)); @@ -475,7 +480,7 @@ mainLoop() // close down LOG((CLOG_DEBUG1 "stopping server")); - EVENTQUEUE->removeHandler(s_reloadConfigEvent, + EVENTQUEUE->removeHandler(getReloadConfigEvent(), IEventQueue::getSystemTarget()); stopServer(); updateStatus(); diff --git a/cmd/synergys/synergys.rc b/cmd/synergys/synergys.rc index d528c4dd..41e40115 100644 --- a/cmd/synergys/synergys.rc +++ b/cmd/synergys/synergys.rc @@ -71,6 +71,7 @@ BEGIN BEGIN MENUITEM "Show Status", IDC_TASKBAR_STATUS MENUITEM "Copy Log To Clipboard", IDC_TASKBAR_LOG + MENUITEM "Reload Configuration", IDC_RELOAD_CONFIG MENUITEM SEPARATOR MENUITEM "Quit", IDC_TASKBAR_QUIT END