From fafca253f3540ba9f65f8d2ec19ff6091f5f9c5d Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Wed, 5 Feb 2014 22:38:09 +0100 Subject: [PATCH] Let Ctrl-O key open chat for last talker --- backend.c | 3 ++- backend.h | 1 + dialogs.c | 3 +++ gtk/xoptions.c | 1 + 4 files changed, 7 insertions(+), 1 deletions(-) diff --git a/backend.c b/backend.c index 5d31621..3039944 100644 --- a/backend.c +++ b/backend.c @@ -289,6 +289,7 @@ int chattingPartner; char marker[BOARD_RANKS][BOARD_FILES]; /* [HGM] marks for target squares */ char legal[BOARD_RANKS][BOARD_FILES]; /* [HGM] legal target squares */ char lastMsg[MSG_SIZ]; +char lastTalker[MSG_SIZ]; ChessSquare pieceSweep = EmptySquare; ChessSquare promoSweep = EmptySquare, defaultPromoChoice; int promoDefaultAltered; @@ -3335,7 +3336,7 @@ read_from_ics (InputSourceRef isr, VOIDSTAR closure, char *data, int count, int talker[0] = 0; Colorize(ColorTell, FALSE); chattingPartner = p; break; } - if(chattingPartner<0) i = oldi; else { + if(chattingPartner<0) i = oldi, safeStrCpy(lastTalker, talker+1, MSG_SIZ); else { Colorize(curColor, TRUE); // undo the bogus colorations we just made to trigger the souds if(oldi > 0 && buf[oldi-1] == '\n') oldi--; if (oldi > next_out) SendToPlayer(&buf[next_out], oldi - next_out); diff --git a/backend.h b/backend.h index 4200c5a..984c286 100644 --- a/backend.h +++ b/backend.h @@ -77,6 +77,7 @@ extern int tinyLayout, smallLayout; extern Boolean mcMode; extern int dragging; extern char variantError[]; +extern char lastTalker[]; void MarkMenuItem P((char *menuRef, int state)); char *CmailMsg P((void)); diff --git a/dialogs.c b/dialogs.c index 6fa9065..da4fb71 100644 --- a/dialogs.c +++ b/dialogs.c @@ -1798,6 +1798,9 @@ IcsHist (int n, Option *opt, DialogClass dlg) if(hidden) BoardToTop(); else PaneSwitch(); break; + case 15: + NewChat(lastTalker); + break; case 14: for(chat=0; chat < MAX_CHAT; chat++) if(!chatPartner[chat][0]) break; if(chat < MAX_CHAT) ChatSwitch(chat + 1); diff --git a/gtk/xoptions.c b/gtk/xoptions.c index f330e41..6cf117a 100644 --- a/gtk/xoptions.c +++ b/gtk/xoptions.c @@ -504,6 +504,7 @@ TypeInProc (GtkWidget *widget, GdkEventKey *event, gpointer gdata) controlState = event->state & GDK_CONTROL_MASK; switch(event->keyval) { case 'n': return (controlState && IcsHist(14, opt, dlg)); + case 'o': return (controlState && IcsHist(15, opt, dlg)); case GDK_Tab: IcsHist(10, opt, dlg); break; case GDK_Up: IcsHist(1, opt, dlg); break; case GDK_Down: IcsHist(-1, opt, dlg); break; -- 1.7.0.4