From: H.G. Muller Date: Sun, 3 Apr 2011 11:15:17 +0000 (+0200) Subject: Put insertion point at end of text on SetFocus X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=cbcc1f10ea0dd1de8f6aeff721648b30d21a81bd;p=xboard.git Put insertion point at end of text on SetFocus --- diff --git a/xoptions.c b/xoptions.c index 6e995ea..fdc5513 100644 --- a/xoptions.c +++ b/xoptions.c @@ -97,14 +97,18 @@ static Widget previous = NULL; void SetFocus(Widget w, XtPointer data, XEvent *event, Boolean *b) { - Arg args; + Arg args[2]; + char *s; if(previous) { - XtSetArg(args, XtNdisplayCaret, False); - XtSetValues(previous, &args, 1); + XtSetArg(args[0], XtNdisplayCaret, False); + XtSetValues(previous, args, 1); } - XtSetArg(args, XtNdisplayCaret, True); - XtSetValues(w, &args, 1); + XtSetArg(args[0], XtNstring, &s); + XtGetValues(w, args, 1); + XtSetArg(args[0], XtNdisplayCaret, True); + XtSetArg(args[1], XtNinsertPosition, strlen(s)); + XtSetValues(w, args, 2); XtSetKeyboardFocus((Widget) data, w); previous = w; }