From 81d327e65a2081a5bb48f974d9101ed9f85767a6 Mon Sep 17 00:00:00 2001 From: marha Date: Thu, 3 Feb 2011 14:55:25 +0000 Subject: xdmcp: add host connected to in the title of the main window --- xorg-server/hw/xwin/wincreatewnd.c | 11 +++++---- xorg-server/hw/xwin/wintrayicon.c | 18 ++++++++++++-- xorg-server/hw/xwin/winwindow.h | 4 ++-- xorg-server/hw/xwin/xdmcphostselect.c | 45 +++++++++++++++++++++++++++-------- 4 files changed, 60 insertions(+), 18 deletions(-) (limited to 'xorg-server/hw/xwin') diff --git a/xorg-server/hw/xwin/wincreatewnd.c b/xorg-server/hw/xwin/wincreatewnd.c index 91dfb4abf..9931abe75 100644 --- a/xorg-server/hw/xwin/wincreatewnd.c +++ b/xorg-server/hw/xwin/wincreatewnd.c @@ -65,6 +65,8 @@ winCreateBoundingWindowFullScreen (ScreenPtr pScreen) HWND *phwnd = &pScreenPriv->hwndScreen; WNDCLASSEX wc; char szTitle[256]; + char HostName[256]; + gethostname(HostName,256); winDebug ("winCreateBoundingWindowFullScreen\n"); @@ -91,12 +93,11 @@ winCreateBoundingWindowFullScreen (ScreenPtr pScreen) sizeof (szTitle), WINDOW_TITLE_XDMCP, g_pszQueryHost, + HostName, display, (int) pScreenInfo->dwScreen); else { - char HostName[256]; - gethostname(HostName,256); snprintf (szTitle, sizeof (szTitle), WINDOW_TITLE, @@ -163,6 +164,9 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) DWORD dwWindowStyle; BOOL fForceShowWindow = FALSE; char szTitle[256]; + char HostName[256]; + + gethostname(HostName,256); winDebug ("winCreateBoundingWindowWindowed - User w: %d h: %d\n", (int) pScreenInfo->dwUserWidth, (int) pScreenInfo->dwUserHeight); @@ -332,12 +336,11 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) sizeof (szTitle), WINDOW_TITLE_XDMCP, g_pszQueryHost, + HostName, display, (int) pScreenInfo->dwScreen); else { - char HostName[256]; - gethostname(HostName,256); snprintf (szTitle, sizeof (szTitle), WINDOW_TITLE, diff --git a/xorg-server/hw/xwin/wintrayicon.c b/xorg-server/hw/xwin/wintrayicon.c index 52c7de3dc..01d53bc44 100644 --- a/xorg-server/hw/xwin/wintrayicon.c +++ b/xorg-server/hw/xwin/wintrayicon.c @@ -63,13 +63,27 @@ winInitNotifyIcon (winPrivScreenPtr pScreenPriv, Bool Modify) gethostname(HostName,256); /* Set display and screen-specific tooltip text */ - snprintf (nid.szTip, + if (g_pszQueryHost) + { + snprintf (nid.szTip, sizeof (nid.szTip), - PROJECT_NAME " Server - %s:%s.%d - %d clients", + "%s - %s:%s.%d - %d clients", + g_pszQueryHost, HostName, display, (int) pScreenInfo->dwScreen, pScreenPriv->iConnectedClients); + } + else + { + snprintf (nid.szTip, + sizeof (nid.szTip), + "%s:%s.%d - %d clients", + HostName, + display, + (int) pScreenInfo->dwScreen, + pScreenPriv->iConnectedClients); + } /* Add the tray icon */ if (!Shell_NotifyIcon ((Modify) ? NIM_MODIFY : NIM_ADD, &nid)) diff --git a/xorg-server/hw/xwin/winwindow.h b/xorg-server/hw/xwin/winwindow.h index f720445b4..7c65ce505 100644 --- a/xorg-server/hw/xwin/winwindow.h +++ b/xorg-server/hw/xwin/winwindow.h @@ -45,8 +45,8 @@ #endif #define EXECUTABLE_NAME "VcXsrv" #define WINDOW_CLASS "VcXsrv/x" -#define WINDOW_TITLE PROJECT_NAME " Server - %s:%s.%d" -#define WINDOW_TITLE_XDMCP PROJECT_NAME " Server - %s:%s.%d" +#define WINDOW_TITLE PROJECT_NAME " Server - Display %s:%s.%d" +#define WINDOW_TITLE_XDMCP PROJECT_NAME " Server - %s - Display %s:%s.%d" #define WIN_SCR_PROP "vcxsrv_screen_prop rl" #define WINDOW_CLASS_X "vcxsrv/x X rl" #define WINDOW_TITLE_X PROJECT_NAME " X" diff --git a/xorg-server/hw/xwin/xdmcphostselect.c b/xorg-server/hw/xwin/xdmcphostselect.c index a447f9495..3196da4af 100644 --- a/xorg-server/hw/xwin/xdmcphostselect.c +++ b/xorg-server/hw/xwin/xdmcphostselect.c @@ -6,6 +6,39 @@ void XdmcpHostSelected(int HostIndex); static HWND g_hDlgHosts; +static char HostToConnect[128]; + +static void SelectHost(int Index) +{ + int i; + char HostName[128]; + int HostIndex=SendDlgItemMessage(g_hDlgHosts, IDC_HOSTLIST, LB_GETITEMDATA, (WPARAM)Index, 0); + + HostToConnect[0]=0; + SendDlgItemMessage(g_hDlgHosts, IDC_HOSTLIST, LB_GETTEXT, (WPARAM)Index, (LPARAM)HostToConnect); + g_pszQueryHost=HostToConnect; + + gethostname(HostName,128); + + XdmcpHostSelected(HostIndex); + + for (i = 0; i < g_iNumScreens; ++i) + { + /* Change the window title to reflect the host we are connecting to */ + if (g_ScreenInfo[i].pScreen) + { + char szTitle[256]; + + winScreenPriv(g_ScreenInfo[i].pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + snprintf (szTitle, sizeof (szTitle), WINDOW_TITLE_XDMCP, HostToConnect, HostName, display, (int) pScreenInfo->dwScreen); + SetWindowText(pScreenPriv->hwndScreen,szTitle); + } + } + + DestroyWindow (g_hDlgHosts); + g_hDlgHosts = NULL; +} /* * Process messages for the about dialog. @@ -64,11 +97,7 @@ static wBOOL CALLBACK DisplayXdmcpHostsDlgProc (HWND hwndDialog, UINT message, W } else { - int HostIndex=SendDlgItemMessage(g_hDlgHosts, IDC_HOSTLIST, LB_GETITEMDATA, (WPARAM)Index, 0); - XdmcpHostSelected(HostIndex); - - DestroyWindow (g_hDlgHosts); - g_hDlgHosts = NULL; + SelectHost(Index); } return TRUE; @@ -87,11 +116,7 @@ static wBOOL CALLBACK DisplayXdmcpHostsDlgProc (HWND hwndDialog, UINT message, W if (HIWORD(wParam)==LBN_DBLCLK) { int Index=SendDlgItemMessage(g_hDlgHosts, IDC_HOSTLIST, LB_GETCURSEL, 0, 0); - int HostIndex=SendDlgItemMessage(g_hDlgHosts, IDC_HOSTLIST, LB_GETITEMDATA, (WPARAM)Index, 0); - XdmcpHostSelected(HostIndex); - - DestroyWindow (g_hDlgHosts); - g_hDlgHosts = NULL; + SelectHost(Index); return TRUE; } break; -- cgit v1.2.3