From cbcc1f10ea0dd1de8f6aeff721648b30d21a81bd Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sun, 3 Apr 2011 13:15:17 +0200 Subject: [PATCH] Put insertion point at end of text on SetFocus --- xoptions.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) 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; } -- 1.7.0.4