X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xoptions.c;h=b95cb2274d6c8249251db7e030698eb822e4364f;hb=2d0f4769e69d228d9593c574014c634706edea97;hp=7f4bf1dfbc33d420aeab7017a6fcb6ca5d44f692;hpb=26897ecf6be30b8ccc64285e1e293ab76df38ab9;p=xboard.git diff --git a/xoptions.c b/xoptions.c index 7f4bf1d..b95cb22 100644 --- a/xoptions.c +++ b/xoptions.c @@ -239,12 +239,12 @@ HighlightWithScroll (Option *opt, int sel, int max) float top, bottom, f, g; HighlightListBoxItem(opt, sel); if(!ReadScroll(opt, &top, &bottom)) return; // no scroll bar - bottom = bottom*max - 1.; + bottom = bottom*max - 1.f; f = g = top; top *= max; - if(sel > (top + 3*bottom)/4) f = (sel - 0.75*(bottom-top))/max; else - if(sel < (3*top + bottom)/4) f = (sel - 0.25*(bottom-top))/max; - if(f < 0.) f = 0.; if(f + 1./max > 1.) f = 1. - 1./max; + if(sel > (top + 3*bottom)/4) f = (sel - 0.75f*(bottom-top))/max; else + if(sel < (3*top + bottom)/4) f = (sel - 0.25f*(bottom-top))/max; + if(f < 0.f) f = 0.; if(f + 1.f/max > 1.f) f = 1. - 1./max; if(f != g) SetScroll(opt, f); } @@ -641,7 +641,7 @@ WheelProc (Widget w, XEvent *event, String *prms, Cardinal *nprms) XtSetArg(args[j], XtNshown, &h); j++; XtSetArg(args[j], XtNtopOfThumb, &top); j++; XtGetValues(v, args, j); - top += 0.1*h*n; if(top < 0.) top = 0.; + top += 0.1f*h*n; if(top < 0.f) top = 0.; XtCallActionProc(v, "StartScroll", event, params+1, 1); XawScrollbarSetThumb(v, top, -1.0); XtCallActionProc(v, "NotifyThumb", event, params, 0); @@ -807,12 +807,16 @@ GenericPopUp (Option *option, char *title, DialogClass dlgNr, DialogClass parent if(option[i].type == FileName || option[i].type == PathName) w -= 55; j = SetPositionAndSize(args, dialog, last, 1 /* border */, w /* w */, option[i].type == TextBox ? option[i].value : 0 /* h */, 0x91 /* chain full width */); - if(option[i].type == TextBox && option[i].value) { // decorations for multi-line text-edits + if(option[i].type == TextBox) { // decorations for multi-line text-edits if(option[i].min & T_VSCRL) { XtSetArg(args[j], XtNscrollVertical, XawtextScrollAlways); j++; } if(option[i].min & T_HSCRL) { XtSetArg(args[j], XtNscrollHorizontal, XawtextScrollAlways); j++; } if(option[i].min & T_FILL) { XtSetArg(args[j], XtNautoFill, True); j++; } if(option[i].min & T_WRAP) { XtSetArg(args[j], XtNwrap, XawtextWrapWord); j++; } - if(option[i].min & T_TOP) { XtSetArg(args[j], XtNtop, XtChainTop); j++; } + if(option[i].min & T_TOP) { XtSetArg(args[j], XtNtop, XtChainTop); j++; + if(!option[i].value) { XtSetArg(args[j], XtNbottom, XtChainTop); j++; + XtSetValues(dialog, args+j-2, 2); + } + } } else shrink = TRUE; XtSetArg(args[j], XtNeditType, XawtextEdit); j++; XtSetArg(args[j], XtNuseStringInPlace, False); j++; @@ -962,6 +966,7 @@ GenericPopUp (Option *option, char *title, DialogClass dlgNr, DialogClass parent (last = XtCreateManagedWidget("graph", widgetClass, form, args, j)); XtAddEventHandler(last, ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask, False, (XtEventHandler) GraphEventProc, option[i].target); // mandatory user-supplied expose handler + if(option[i].min & SAME_ROW) last = forelast, forelast = lastrow; break; case PopUp: // note: used only after Graph, so 'last' refers to the Graph widget option[i].handle = (void*) CreateComboPopup(last, option + i, i + 256*dlgNr, TRUE, option[i].value); @@ -1148,7 +1153,7 @@ SetInsertPos (Option *opt, int pos) 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); +// XSetInputFocus(xDisplay, XtWindow(opt->handle), RevertToPointerRoot, CurrentTime); } void