X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwchat.c;h=81e190d86db807c04f64cb0ec9d4155004772635;hb=dcfab363332520fedcd4e6e8c791a854ba548e83;hp=ac758190b071908f8a7ce5fa345e6f0af8861c22;hpb=becc619fe5f9413393ee1b21951687323a6e32e4;p=xboard.git diff --git a/winboard/wchat.c b/winboard/wchat.c index ac75819..81e190d 100644 --- a/winboard/wchat.c +++ b/winboard/wchat.c @@ -61,7 +61,7 @@ char *NextInHistory(); extern HWND ChatDialog; extern HINSTANCE hInst; -extern HWND hwndMain; +extern HWND hwndConsole; extern WindowPlacement wpChat[MAX_CHAT]; extern WindowPlacement wpConsole; @@ -207,6 +207,7 @@ LRESULT CALLBACK ChatProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam SendMessage( GetDlgItem(hDlg, IDC_ChatPartner), // [HGM] clickbox: initialize with requested handle WM_SETTEXT, 0, (LPARAM) chatPartner[partner] ); filterHasFocus[partner] = TRUE; + onTop = partner; // a newly opened box becomes top one if(chatPartner[partner][0]) { filterHasFocus[partner] = FALSE; SetFocus( GetDlgItem(hDlg, OPT_ChatInput) ); @@ -261,12 +262,9 @@ LRESULT CALLBACK ChatProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam switch (LOWORD(wParam)) { - case IDCANCEL: - chatHandle[partner] = 0; - chatPartner[partner][0] = 0; - ChatPopDown(); - EndDialog(hDlg, TRUE); - break; + case IDCANCEL: /* let Esc key switch focus back to console */ + SetFocus(GetDlgItem(hwndConsole, OPT_ConsoleInput)); + break; case IDC_Clear: SendMessage( GetDlgItem(hDlg, IDC_ChatMemo), WM_SETTEXT, 0, (LPARAM) "" ); @@ -371,7 +369,7 @@ void ChatPopUp(char *icsHandle) lpProc = MakeProcInstance( (FARPROC) ChatProc, hInst ); /* Note to self: dialog must have the WS_VISIBLE style set, otherwise it's not shown! */ - CreateDialog( hInst, MAKEINTRESOURCE(DLG_Chat), hwndMain, (DLGPROC)lpProc ); + CreateDialog( hInst, MAKEINTRESOURCE(DLG_Chat), hwndConsole, (DLGPROC)lpProc ); FreeProcInstance(lpProc);