From 97965726a44d7b9354cfb2b69554ea8af327a1f7 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Tue, 30 Aug 2011 19:39:59 +0200 Subject: [PATCH] Auto-popup ICS Input Box Typing to the board made the move type-in pop up, but in ICS mode this is of course undesirable. Like in WinBoard, the ICS Input Box should pop up in stead, and accept the typed character. This is now realized. If the box already exists and has text in it, the typed character is appended to that text, and the box is given focus. Spaces now also are considered as printable. --- xoptions.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/xoptions.c b/xoptions.c index 08767b5..087ee5f 100644 --- a/xoptions.c +++ b/xoptions.c @@ -1572,9 +1572,18 @@ void MoveTypeInProc(Widget widget, caddr_t unused, XEvent *event) XQueryKeymap(xDisplay,keys); metaL = XKeysymToKeycode(xDisplay, XK_Meta_L); metaR = XKeysymToKeycode(xDisplay, XK_Meta_R); - if ( n == 1 && *buf > 32 && !(keys[metaL>>3]&1<<(metaL&7)) && !(keys[metaR>>3]&1<<(metaR&7))) // printable, no alt - PopUpMoveDialog(*buf); - + if ( n == 1 && *buf >= 32 && !(keys[metaL>>3]&1<<(metaL&7)) && !(keys[metaR>>3]&1<<(metaR&7))) { // printable, no alt + if(appData.icsActive) { // text typed to board in ICS mode: divert to ICS input box + if(shells[4]) { // box already exists: append to current contents + char *p, newText[MSG_SIZ]; + GetWidgetText(&boxOptions[0], &p); + snprintf(newText, MSG_SIZ, "%s%c", p, *buf); + SetWidgetText(&boxOptions[0], newText, 4); + if(shellUp[4]) XSetInputFocus(xDisplay, XtWindow(boxOptions[0].handle), RevertToPointerRoot, CurrentTime); //why??? + } else icsText = buf; // box did not exist: make sure it pops up with char in it + InputBoxPopup(); + } else PopUpMoveDialog(*buf); + } } void -- 1.7.0.4