Fix bug in resizing
authorH.G. Muller <h.g.muller@hccnet.nl>
Sun, 21 Oct 2012 08:40:37 +0000 (10:40 +0200)
committerH.G. Muller <h.g.muller@hccnet.nl>
Sun, 21 Oct 2012 09:46:49 +0000 (11:46 +0200)
The nominal size of the window was not set in the correct Option struct.

xboard.c
xoptions.c

index 3e8de0b..69079be 100644 (file)
--- a/xboard.c
+++ b/xboard.c
@@ -1736,8 +1736,8 @@ ReSize (WindowPlacement *wp)
        } else ResizeBoardWindow(BOARD_WIDTH * (squareSize + lineGap) + lineGap, BOARD_HEIGHT * (squareSize + lineGap) + lineGap, 0);
        w = BOARD_WIDTH * (squareSize + lineGap) + lineGap;
        h = BOARD_HEIGHT * (squareSize + lineGap) + lineGap;
        } else ResizeBoardWindow(BOARD_WIDTH * (squareSize + lineGap) + lineGap, BOARD_HEIGHT * (squareSize + lineGap) + lineGap, 0);
        w = BOARD_WIDTH * (squareSize + lineGap) + lineGap;
        h = BOARD_HEIGHT * (squareSize + lineGap) + lineGap;
-       if(optList->max   > w) optList->max = w;
-       if(optList->value > h) optList->value = h;
+       if(optList[W_BOARD].max   > w) optList[W_BOARD].max = w;
+       if(optList[W_BOARD].value > h) optList[W_BOARD].value = h;
 }
 
 static XtIntervalId delayedDragID = 0;
 }
 
 static XtIntervalId delayedDragID = 0;
index bf1ff10..097f881 100644 (file)
@@ -551,10 +551,12 @@ GraphEventProc(Widget widget, caddr_t client_data, XEvent *event)
            XtSetArg(args[j], XtNwidth, &w); j++;
            XtSetArg(args[j], XtNheight, &h); j++;
            XtGetValues(widget, args, j);
            XtSetArg(args[j], XtNwidth, &w); j++;
            XtSetArg(args[j], XtNheight, &h); j++;
            XtGetValues(widget, args, j);
+
            if(w < graph->max || w > graph->max + 1 || h != graph->value) { // use width fudge of 1 pixel
            if(w < graph->max || w > graph->max + 1 || h != graph->value) { // use width fudge of 1 pixel
-               sizing = (((XExposeEvent*)event)->count >= 0); // suppress sizing on ordered redraw in response to sizing.
+               sizing = (((XExposeEvent*)event)->count >= 0); // suppress sizing on expose for ordered redraw in response to sizing.
                graph->max = w; graph->value = h; // note: old values are kept if we we don't exceed width fudge
                graph->max = w; graph->value = h; // note: old values are kept if we we don't exceed width fudge
-           }
+           } else w = graph->max;
+
            if(sizing && ((XExposeEvent*)event)->count > 0) { graph->max = 0; return; } // don't bother if further exposure is pending during resize
            if(!graph->textValue || sizing) { // create surfaces of new size for display widget
                if(graph->textValue) cairo_surface_destroy((cairo_surface_t *)graph->textValue);
            if(sizing && ((XExposeEvent*)event)->count > 0) { graph->max = 0; return; } // don't bother if further exposure is pending during resize
            if(!graph->textValue || sizing) { // create surfaces of new size for display widget
                if(graph->textValue) cairo_surface_destroy((cairo_surface_t *)graph->textValue);