X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=gtk%2Fxoptions.c;h=7a03ffb581050f68f14a5f4046f18af1ffb0cdd2;hb=410e9845d7274ae18eb1430a86129daaa03518ba;hp=18fc857c2026deccd2a0da1600d11b206beafdf1;hpb=204df43a817c927d4db73f81cd4b4ce5075def6b;p=xboard.git diff --git a/gtk/xoptions.c b/gtk/xoptions.c index 18fc857..7a03ffb 100644 --- a/gtk/xoptions.c +++ b/gtk/xoptions.c @@ -317,8 +317,13 @@ void ScrollToCursor (Option *opt, int caretPos) { static GtkTextIter iter; + static GtkTextMark *mark; + if(!mark) mark = gtk_text_mark_new(NULL, 0); gtk_text_buffer_get_iter_at_offset((GtkTextBuffer *) opt->handle, &iter, caretPos); - gtk_text_view_scroll_to_iter((GtkTextView *) opt->textValue, &iter, 0.0, 0, 0.5, 0.5); + gtk_text_buffer_add_mark((GtkTextBuffer *) opt->handle, mark, &iter); + gtk_text_view_scroll_to_mark((GtkTextView *) opt->textValue, mark, 0.0, 0, 0.5, 0.5); +// gtk_text_view_scroll_to_iter((GtkTextView *) opt->textValue, &iter, 0.0, 0, 0.5, 0.5); + gtk_text_buffer_delete_mark((GtkTextBuffer *) opt->handle, mark); } int @@ -1571,13 +1576,8 @@ SendText (int n) void SetInsertPos (Option *opt, int pos) { -#ifdef TODO_GTK - Arg args[16]; - XtSetArg(args[0], XtNinsertPosition, pos); - XtSetValues(opt->handle, args, 1); -// SetFocus(opt->handle, shells[InputBoxDlg], NULL, False); // No idea why this does not work, and the following is needed: -// XSetInputFocus(xDisplay, XtWindow(opt->handle), RevertToPointerRoot, CurrentTime); -#endif + if(opt->value > 80) ScrollToCursor(opt, pos); + else gtk_editable_set_position(GTK_EDITABLE(opt->handle), pos); } void