The code which realizes full functionality Control Panel,
in a kind existing now, was added.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@467 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/network/Socket.h b/network/Socket.h
index a08afe5..595f47e 100644
--- a/network/Socket.h
+++ b/network/Socket.h
@@ -122,6 +122,7 @@
if (newTimeout && (!*timeout || newTimeout < *timeout))
*timeout = newTimeout;
}
+ virtual bool getDisable() {return true;};
};
}
diff --git a/rfb/ListConnInfo.h b/rfb/ListConnInfo.h
index e8ca60a..44df9ec 100644
--- a/rfb/ListConnInfo.h
+++ b/rfb/ListConnInfo.h
@@ -23,7 +23,7 @@
namespace rfb {
struct ListConnInfo {
- ListConnInfo() {}
+ ListConnInfo() : disableClients(false) {}
void Clear() {
conn.clear();
@@ -95,6 +95,16 @@
addInfo(InputList->iGetConn(), buf[0], buf[1], InputList->iGetStatus());
}
+ void setDisable(bool disable) {disableClients = disable;}
+
+ bool getDisable() {return disableClients;}
+
+ void setAllStatus(int stat) {
+ std::list<int>::iterator st;
+ for (st = status.begin(); st != status.end(); st++)
+ *st = stat;
+ }
+
private:
std::list<DWORD> conn;
std::list<char*> IP_address;
@@ -104,6 +114,7 @@
std::list<char*>::iterator Ii;
std::list<char*>::iterator ti;
std::list<int>::iterator si;
+ bool disableClients;
};
};
#endif
diff --git a/rfb/VNCServerST.cxx b/rfb/VNCServerST.cxx
index 9e6c480..9f6ecb5 100644
--- a/rfb/VNCServerST.cxx
+++ b/rfb/VNCServerST.cxx
@@ -81,7 +81,7 @@
renderedCursorInvalid(false),
securityFactory(sf ? sf : &defaultSecurityFactory),
queryConnectionHandler(0), useEconomicTranslate(false),
- lastConnectionTime(0)
+ lastConnectionTime(0), disableclients(false)
{
lastUserInputTime = lastDisconnectTime = time(0);
slog.debug("creating single-threaded server %s", name.buf);
@@ -511,6 +511,7 @@
void VNCServerST::getConnInfo(ListConnInfo * listConn)
{
listConn->Clear();
+ listConn->setDisable(getDisable());
if (clients.empty())
return;
std::list<VNCSConnectionST*>::iterator i;
@@ -521,6 +522,7 @@
void VNCServerST::setConnStatus(ListConnInfo* listConn)
{
+ setDisable(listConn->getDisable());
if (listConn->Empty() || clients.empty()) return;
for (listConn->iBegin(); !listConn->iEnd(); listConn->iNext()) {
VNCSConnectionST* conn = (VNCSConnectionST*)listConn->iGetConn();
diff --git a/rfb/VNCServerST.h b/rfb/VNCServerST.h
index 1cd2089..554a4c9 100644
--- a/rfb/VNCServerST.h
+++ b/rfb/VNCServerST.h
@@ -31,7 +31,6 @@
#include <rfb/LogWriter.h>
#include <rfb/Blacklist.h>
#include <rfb/Cursor.h>
-#include <rfb/ListConnInfo.h>
#include <network/Socket.h>
#include <rfb/ListConnInfo.h>
@@ -192,6 +191,9 @@
void getConnInfo(ListConnInfo * listConn);
void setConnStatus(ListConnInfo* listConn);
+ bool getDisable() { return disableclients;};
+ void setDisable(bool disable) { disableclients = disable;};
+
protected:
friend class VNCSConnectionST;
@@ -234,6 +236,8 @@
time_t lastUserInputTime;
time_t lastDisconnectTime;
time_t lastConnectionTime;
+
+ bool disableclients;
};
};
diff --git a/rfb_win32/SocketManager.cxx b/rfb_win32/SocketManager.cxx
index 6ebd5c0..6d1980c 100644
--- a/rfb_win32/SocketManager.cxx
+++ b/rfb_win32/SocketManager.cxx
@@ -139,6 +139,10 @@
WSAEnumNetworkEvents(sockets[index].fd, events[index], &network_events);
if (network_events.lNetworkEvents & FD_ACCEPT) {
network::Socket* new_sock = sockets[index].sock.listener->accept();
+ if ((sockets[index].server)->getDisable()) {
+ delete new_sock;
+ new_sock = 0;
+ }
if (new_sock) {
sockets[index].server->addClient(new_sock);
addSocket(new_sock, sockets[index].server);
diff --git a/winvnc/ControlPanel.cxx b/winvnc/ControlPanel.cxx
index 1f69306..e668d91 100644
--- a/winvnc/ControlPanel.cxx
+++ b/winvnc/ControlPanel.cxx
@@ -8,7 +8,6 @@
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
-//using namespace rfb_win32;
using namespace winvnc;
bool ControlPanel::showDialog()
@@ -26,6 +25,8 @@
InitLVColumns(IDC_LIST_CONNECTIONS, handle, 120, 3, ColumnsStrings,
LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM,
LVS_EX_FULLROWSELECT, LVCFMT_LEFT);
+ SendCommand(3, -1);
+ setItemChecked(IDC_DISABLE_CLIENTS, ListConnStatus.getDisable());
}
bool ControlPanel::onCommand(int cmd)
@@ -42,11 +43,6 @@
SendCommand(2, -1);
return false;
}
- case IDC_DISABLE_CLIENTS:
- {
-
- return false;
- }
case IDC_KILL_SEL_CLIENT:
{
SendCommand(3, 3);
@@ -68,6 +64,12 @@
EndDialog(handle, 0);
return false;
}
+ case IDC_DISABLE_CLIENTS:
+ {
+ ListConnStatus.setDisable(isItemChecked(IDC_DISABLE_CLIENTS));
+ SendCommand(3, -1);
+ return false;
+ }
}
return false;
@@ -109,7 +111,6 @@
stop_updating = false;
SendCommand(3, 2);
}
- initDialog();
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
@@ -141,15 +142,15 @@
COPYDATASTRUCT copyData;
copyData.dwData = command;
copyData.lpData = 0;
+ getSelConnInfo();
if (data != -1) {
- getSelConnInfo();
ListConnStatus.Copy(&ListSelConn);
- for (ListConnStatus.iBegin(); !ListConnStatus.iEnd(); ListConnStatus.iNext())
- ListConnStatus.iSetStatus(data);
+ ListConnStatus.setAllStatus(data);
copyData.cbData = (DWORD)&ListConnStatus;
} else {
- copyData.cbData = 0;
+ ListConnStatus.Clear();
}
+ copyData.cbData = (DWORD)&ListConnStatus;
SendMessage(m_hSTIcon, WM_COPYDATA, 0, (LPARAM)©Data);
}
diff --git a/winvnc/STrayIcon.cxx b/winvnc/STrayIcon.cxx
index 5922026..d3e13da 100644
--- a/winvnc/STrayIcon.cxx
+++ b/winvnc/STrayIcon.cxx
@@ -186,10 +186,13 @@
SendMessage(getHandle(), WM_CLOSE, 0, 0);
return 0;
}
- setIcon(thread.server.isServerInUse() ? thread.activeIcon : thread.inactiveIcon);
- CPanel->UpdateListView(&LCInfo);
thread.server.getClientsInfo(&LCInfo);
+ CPanel->UpdateListView(&LCInfo);
+
+ setIcon(thread.server.isServerInUse() ?
+ (!LCInfo.getDisable() ? thread.activeIcon : thread.dis_activeIcon) :
+ (!LCInfo.getDisable() ? thread.inactiveIcon : thread.dis_inactiveIcon));
return 0;
@@ -215,8 +218,10 @@
};
-STrayIconThread::STrayIconThread(VNCServerWin32& sm, UINT inactiveIcon_, UINT activeIcon_, UINT menu_)
-: server(sm), inactiveIcon(inactiveIcon_), activeIcon(activeIcon_), menu(menu_),
+STrayIconThread::STrayIconThread(VNCServerWin32& sm, UINT inactiveIcon_, UINT activeIcon_,
+ UINT dis_inactiveIcon_, UINT dis_activeIcon_, UINT menu_)
+: server(sm), inactiveIcon(inactiveIcon_), activeIcon(activeIcon_),
+ dis_inactiveIcon(dis_inactiveIcon_), dis_activeIcon(dis_activeIcon_),menu(menu_),
windowHandle(0), runTrayIcon(true) {
start();
}
diff --git a/winvnc/STrayIcon.h b/winvnc/STrayIcon.h
index cfd5ec0..ef32eba 100644
--- a/winvnc/STrayIcon.h
+++ b/winvnc/STrayIcon.h
@@ -29,7 +29,7 @@
class STrayIconThread : rfb::Thread {
public:
STrayIconThread(VNCServerWin32& sm, UINT inactiveIcon,
- UINT activeIcon, UINT menu);
+ UINT activeIcon, UINT dis_inactiveIcon, UINT dis_activeIcon, UINT menu);
virtual ~STrayIconThread() {
runTrayIcon = false;
PostThreadMessage(getThreadId(), WM_QUIT, 0, 0);
@@ -49,6 +49,8 @@
VNCServerWin32& server;
UINT inactiveIcon;
UINT activeIcon;
+ UINT dis_inactiveIcon;
+ UINT dis_activeIcon;
UINT menu;
bool runTrayIcon;
};
diff --git a/winvnc/VNCServerWin32.cxx b/winvnc/VNCServerWin32.cxx
index 30e9a72..67b3ec5 100644
--- a/winvnc/VNCServerWin32.cxx
+++ b/winvnc/VNCServerWin32.cxx
@@ -155,7 +155,8 @@
config.setNotifyThread(Thread::self(), VNCM_REG_CHANGED);
// - Create the tray icon if possible
- STrayIconThread trayIcon(*this, IDI_ICON, IDI_CONNECTED, IDR_TRAY);
+ STrayIconThread trayIcon(*this, IDI_ICON, IDI_CONNECTED, IDI_ICON_DISABLE,
+ IDI_CONNECTED_DISABLE, IDR_TRAY);
DWORD result = 0;
try {
diff --git a/winvnc/connecte.ico b/winvnc/connecte.ico
new file mode 100644
index 0000000..8f814b3
--- /dev/null
+++ b/winvnc/connecte.ico
Binary files differ
diff --git a/winvnc/icon_dis.ico b/winvnc/icon_dis.ico
new file mode 100644
index 0000000..0a6ea15
--- /dev/null
+++ b/winvnc/icon_dis.ico
Binary files differ
diff --git a/winvnc/resource.h b/winvnc/resource.h
index b9c0e04..b01ed96 100644
--- a/winvnc/resource.h
+++ b/winvnc/resource.h
@@ -12,6 +12,8 @@
#define IDD_CONTROL_PANEL 106
#define IDD_QUERY_CONNECT 107
#define IDD_ADD_NEW_CLIENT 108
+#define IDI_ICON_DISABLE 109
+#define IDI_CONNECTED_DISABLE 110
#define IDC_DESCRIPTION 1000
#define IDC_BUILDTIME 1001
#define IDC_VERSION 1002
@@ -42,7 +44,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 109
+#define _APS_NEXT_RESOURCE_VALUE 111
#define _APS_NEXT_COMMAND_VALUE 40007
#define _APS_NEXT_CONTROL_VALUE 1024
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/winvnc/winvnc.dsp b/winvnc/winvnc.dsp
index 9111851..a35a5e0 100644
--- a/winvnc/winvnc.dsp
+++ b/winvnc/winvnc.dsp
@@ -205,10 +205,18 @@
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
+SOURCE=.\connecte.ico
+# End Source File
+# Begin Source File
+
SOURCE=.\connected.ico
# End Source File
# Begin Source File
+SOURCE=.\icon_dis.ico
+# End Source File
+# Begin Source File
+
SOURCE=.\java\logo150x150.gif
# End Source File
# Begin Source File
diff --git a/winvnc/winvnc.rc b/winvnc/winvnc.rc
index 61cf8a6..ab92218 100644
--- a/winvnc/winvnc.rc
+++ b/winvnc/winvnc.rc
@@ -82,6 +82,15 @@
END
#endif // APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON_DISABLE ICON DISCARDABLE "icon_dis.ico"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
@@ -275,6 +284,7 @@
// remains consistent on all systems.
IDI_ICON ICON DISCARDABLE "winvnc.ico"
IDI_CONNECTED ICON DISCARDABLE "connected.ico"
+IDI_CONNECTED_DISABLE ICON DISCARDABLE "connecte.ico"
/////////////////////////////////////////////////////////////////////////////
//