diff options
author | Harold L Hunt II <huntharo@msu.edu> | 2004-03-28 17:49:32 +0000 |
---|---|---|
committer | Harold L Hunt II <huntharo@msu.edu> | 2004-03-28 17:49:32 +0000 |
commit | 6a6a27e63f715a312f15e7952a535574e9f7111f (patch) | |
tree | 4ba3702ba7347458c3d09f82a85a1a90c7c96a08 /hw/xwin/windialogs.c | |
parent | 1527162a67d7e9c763370f6e859e752be2317423 (diff) |
Fix problem with tray menu in non-multi-window modes, add framework for
Takuma to display the number of connected clients on shutdown.
Diffstat (limited to 'hw/xwin/windialogs.c')
-rwxr-xr-x | hw/xwin/windialogs.c | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/hw/xwin/windialogs.c b/hw/xwin/windialogs.c index 8db87e368..62803560a 100755 --- a/hw/xwin/windialogs.c +++ b/hw/xwin/windialogs.c @@ -242,6 +242,8 @@ winDisplayExitDialog (winPrivScreenPtr pScreenPriv) (int) GetDlgItem (g_hDlgExit, IDCANCEL), TRUE); } +#define CONNECTED_CLIENTS_FORMAT "There are currently %d clients connected." + /* * Exit dialog window procedure @@ -259,18 +261,41 @@ winExitDlgProc (HWND hDialog, UINT message, switch (message) { case WM_INITDIALOG: - /* Store pointers to private structures for future use */ - s_pScreenPriv = (winPrivScreenPtr) lParam; - s_pScreenInfo = s_pScreenPriv->pScreenInfo; - s_pScreen = s_pScreenInfo->pScreen; - - winCenterDialog (hDialog); - - /* Set icon to standard app icon */ - PostMessage (hDialog, - WM_SETICON, - ICON_SMALL, - (LPARAM) LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN))); + { + char *pszConnectedClients; + int iReturn; + int iConnectedClients = 100; + + /* Store pointers to private structures for future use */ + s_pScreenPriv = (winPrivScreenPtr) lParam; + s_pScreenInfo = s_pScreenPriv->pScreenInfo; + s_pScreen = s_pScreenInfo->pScreen; + + winCenterDialog (hDialog); + + /* Set icon to standard app icon */ + PostMessage (hDialog, + WM_SETICON, + ICON_SMALL, + (LPARAM) LoadIcon (g_hInstance, + MAKEINTRESOURCE(IDI_XWIN))); + + /* Format the connected clients string */ + iReturn = sprintf (NULL, CONNECTED_CLIENTS_FORMAT, + iConnectedClients); + if (iReturn <= 0) + return TRUE; + pszConnectedClients = malloc (iReturn + 1); + if (!pszConnectedClients) + return TRUE; + snprintf (pszConnectedClients, iReturn + 1, CONNECTED_CLIENTS_FORMAT, + iConnectedClients); + + /* Set the number of connected clients */ + SetWindowText (GetDlgItem (hDialog, IDC_CLIENTS_CONNECTED), + pszConnectedClients); + free (pszConnectedClients); + } return TRUE; case WM_COMMAND: |