summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarold L Hunt II <huntharo@msu.edu>2004-03-28 17:49:32 +0000
committerHarold L Hunt II <huntharo@msu.edu>2004-03-28 17:49:32 +0000
commit6a6a27e63f715a312f15e7952a535574e9f7111f (patch)
tree4ba3702ba7347458c3d09f82a85a1a90c7c96a08
parent1527162a67d7e9c763370f6e859e752be2317423 (diff)
Fix problem with tray menu in non-multi-window modes, add framework for
Takuma to display the number of connected clients on shutdown.
-rw-r--r--hw/xwin/XWin.rc9
-rwxr-xr-xhw/xwin/windialogs.c49
-rw-r--r--hw/xwin/winresource.h11
-rwxr-xr-xhw/xwin/wintrayicon.c10
4 files changed, 49 insertions, 30 deletions
diff --git a/hw/xwin/XWin.rc b/hw/xwin/XWin.rc
index a85e36c4b..446174f64 100644
--- a/hw/xwin/XWin.rc
+++ b/hw/xwin/XWin.rc
@@ -72,15 +72,16 @@ END
/* Exit */
-EXIT_DIALOG DIALOG DISCARDABLE 32, 32, 180, 70
+EXIT_DIALOG DIALOG DISCARDABLE 32, 32, 180, 78
STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP | DS_CENTER
FONT 8, "MS Sans Serif"
CAPTION "Cygwin/X - Exit?"
BEGIN
- PUSHBUTTON "E&xit", IDOK, 55, 48, 30, 14
- DEFPUSHBUTTON "&Cancel", IDCANCEL, 95, 48, 30, 14
+ PUSHBUTTON "E&xit", IDOK, 55, 56, 30, 14
+ DEFPUSHBUTTON "&Cancel", IDCANCEL, 95, 56, 30, 14
CTEXT "Exiting will close all screens running on this display.", IDC_STATIC, 7, 12, 166, 8
- CTEXT "Proceed with shutdown of this display/server?", IDC_STATIC, 7, 24, 166, 8
+ CTEXT "No information about connected clients available.", IDC_CLIENTS_CONNECTED, 7, 24, 166, 8
+ CTEXT "Proceed with shutdown of this display/server?", IDC_STATIC, 7, 36, 166, 8
END
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:
diff --git a/hw/xwin/winresource.h b/hw/xwin/winresource.h
index 967a52292..300fcd198 100644
--- a/hw/xwin/winresource.h
+++ b/hw/xwin/winresource.h
@@ -41,10 +41,13 @@
#define IDI_XWIN 101
#define IDI_XWIN_BOXED 102
#define IDM_TRAYICON_MENU 103
-#define ID_APP_EXIT 104
-#define ID_APP_HIDE_ROOT 105
-#define ID_APP_ALWAYS_ON_TOP 106
-#define ID_APP_ABOUT 107
+#define IDC_CLIENTS_CONNECTED 104
+
+
+#define ID_APP_EXIT 200
+#define ID_APP_HIDE_ROOT 201
+#define ID_APP_ALWAYS_ON_TOP 202
+#define ID_APP_ABOUT 203
#define ID_ABOUT_UG 300
#define ID_ABOUT_FAQ 301
diff --git a/hw/xwin/wintrayicon.c b/hw/xwin/wintrayicon.c
index 3beefa370..6a4c90f1a 100755
--- a/hw/xwin/wintrayicon.c
+++ b/hw/xwin/wintrayicon.c
@@ -161,20 +161,10 @@ winHandleIconMessage (HWND hwnd, UINT message,
else
#endif
{
- /* Remove Show Root Window button */
- RemoveMenu (hmenuTray,
- ID_APP_HIDE_ROOT,
- MF_BYCOMMAND);
-
/* Remove Hide Root Window button */
RemoveMenu (hmenuTray,
ID_APP_HIDE_ROOT,
MF_BYCOMMAND);
-
- /* Remove separator */
- RemoveMenu (hmenuTray,
- 0,
- MF_BYPOSITION);
}
SetupRootMenu ((unsigned long)hmenuTray);