Group Chat Boxes with console in stead of board window
[xboard.git] / winboard / wchat.c
index ac75819..64cc16a 100644 (file)
@@ -61,7 +61,7 @@ char *NextInHistory();
 extern HWND ChatDialog;\r
 \r
 extern HINSTANCE hInst;\r
-extern HWND hwndMain;\r
+extern HWND hwndConsole;\r
 \r
 extern WindowPlacement wpChat[MAX_CHAT];\r
 extern WindowPlacement wpConsole;\r
@@ -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\r
                        WM_SETTEXT, 0, (LPARAM) chatPartner[partner] );\r
        filterHasFocus[partner] = TRUE;\r
+       onTop = partner; // a newly opened box becomes top one\r
        if(chatPartner[partner][0]) {\r
            filterHasFocus[partner] = FALSE;\r
            SetFocus( GetDlgItem(hDlg, OPT_ChatInput) );\r
@@ -371,7 +372,7 @@ void ChatPopUp(char *icsHandle)
     lpProc = MakeProcInstance( (FARPROC) ChatProc, hInst );\r
 \r
     /* Note to self: dialog must have the WS_VISIBLE style set, otherwise it's not shown! */\r
-    CreateDialog( hInst, MAKEINTRESOURCE(DLG_Chat), hwndMain, (DLGPROC)lpProc );\r
+    CreateDialog( hInst, MAKEINTRESOURCE(DLG_Chat), hwndConsole, (DLGPROC)lpProc );\r
 \r
     FreeProcInstance(lpProc);\r
 \r