From ea23332c1d3b1a588b67a961378a30965d16064b Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Mon, 3 Feb 2014 20:35:31 +0100 Subject: [PATCH] Let ICS Console pop up GTK in stead of ICS Input Box --- dialogs.c | 19 ++++++++++++++++++- dialogs.h | 1 + gtk/xboard.c | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/dialogs.c b/dialogs.c index 16d4d19..e93e736 100644 --- a/dialogs.c +++ b/dialogs.c @@ -1325,7 +1325,7 @@ PopUpMoveDialog (char firstchar) void BoxAutoPopUp (char *buf) -{ +{ // only used in Xaw. GTK calls ConsoleAutoPopUp in stead (when we type to board) if(!appData.autoBox) return; if(appData.icsActive) { // text typed to board in ICS mode: divert to ICS input box if(DialogExists(InputBoxDlg)) { // box already exists: append to current contents @@ -1914,6 +1914,23 @@ ChatProc () AddHandler(&chatOptions[CHAT_PARTNER], ChatDlg, 2), AddHandler(&chatOptions[CHAT_IN], ChatDlg, 2); // treats return as OK PaneSwitch(); HardSetFocus(&chatOptions[CHAT_IN]); MarkMenu("View.OpenChatWindow", ChatDlg); + CursorAtEnd(&chatOptions[CHAT_IN]); +} + +void +ConsoleAutoPopUp (char *buf) +{ + if(!appData.autoBox) return; + if(appData.icsActive) { // text typed to board in ICS mode: divert to ICS input box + if(DialogExists(ChatDlg)) { // box already exists: append to current contents + char *p, newText[MSG_SIZ]; + GetWidgetText(&chatOptions[CHAT_IN], &p); + snprintf(newText, MSG_SIZ, "%s%c", p, *buf); + SetWidgetText(&chatOptions[CHAT_IN], newText, ChatDlg); + if(shellUp[ChatDlg]) HardSetFocus (&boxOptions[CHAT_IN]); //why??? + } else { ASSIGN(line, buf); } // box did not exist: make sure it pops up with char in it + ChatProc(); + } else PopUpMoveDialog(*buf); } //--------------------------------- Game-List options dialog ------------------------------------------ diff --git a/dialogs.h b/dialogs.h index 449069e..87be680 100644 --- a/dialogs.h +++ b/dialogs.h @@ -189,6 +189,7 @@ void SlaveResize P((Option *opt)); int SetCurrentComboSelection P((Option *opt)); void BoxAutoPopUp P((char *buf)); +void ConsoleAutoPopUp P((char *buf)); void IcsKey P((int n)); void ICSInputBoxPopUp P((void)); void LoadOptionsPopUp P((DialogClass parent)); diff --git a/gtk/xboard.c b/gtk/xboard.c index 7abd7ce..aff56cc 100644 --- a/gtk/xboard.c +++ b/gtk/xboard.c @@ -1788,7 +1788,7 @@ void MoveTypeInProc(eventkey) buf[0]=eventkey->keyval; buf[1]='\0'; if (eventkey->keyval > 32 && eventkey->keyval < 256) - BoxAutoPopUp (buf); + ConsoleAutoPopUp (buf); } #ifdef TODO_GTK -- 1.7.0.4