Created attachment 150624 [details] enhanced FULL patch of patch-ab: original + new patch P1 and P2 math/xgraph has two historical bug and I just got sometime to debug and made fixes. Problem 1: xgraph never had window re-size implemented. When re-size xgraph window, new drawing overlaps old draws. Append patch (P1) gets XWindow re_size implemented. Problem 2: command geometry option -- =WxH+X0+Y0 generally does not work. In most cases, it only takes W, and ignore the H; It is not clear what the original designer tried to code for. Sent email to xgraph but do not get response. It looks like this project has been discontinued since Y2K. Append patch (P2) to fix the compiler directive to separate Bogus formula if USE_GEOMETRY is defined. Also, a combined patch -- patch-ab is also attached. Do not confuse: patch-ab is a FULL patch that combines P1, P2 and original patch-ab. This is not third patch. Since only one file can be attached, so only the full patch -- patch-ab is in attachment file. P1 and P2 are pasted below: --------- patch P1: implementing xgraph XWindow re-size ------------ --- xgraph.c.orig 2000-09-10 07:05:47.000000000 -0700 +++ xgraph.c 2014-12-15 22:32:58.000000000 -0800 @@ -403,6 +402,7 @@ fg_color = PM_COLOR("Foreground"); bg_color = PM_COLOR("Background"); XRecolorCursor(disp, zoomCursor, &fg_color, &bg_color); + init_X(win_info->dev_info.user_state); Num_Windows = 1; while (Num_Windows > 0) { @@ -415,6 +415,12 @@ continue; } switch (theEvent.type) { + case ConfigureNotify: + win_info->dev_info.area_w = theEvent.xconfigure.width; + win_info->dev_info.area_h = theEvent.xconfigure.height; + XClearArea(disp, theEvent.xany.window, 1, 1, win_info->dev_info.area_w, win_info->dev_info.area_h, 0); + DrawWindow(win_info); + break; case Expose: if (theEvent.xexpose.count <= 0) { XWindowAttributes win_attr; @@ -422,7 +428,7 @@ XGetWindowAttributes(disp, theEvent.xany.window, &win_attr); win_info->dev_info.area_w = win_attr.width; win_info->dev_info.area_h = win_attr.height; - init_X(win_info->dev_info.user_state); + XClearArea(disp, theEvent.xany.window, 1, 1, win_info->dev_info.area_w, win_info->dev_info.area_h, 0); DrawWindow(win_info); } break; @@ -789,7 +796,7 @@ new_info->flags = 0; XSelectInput(disp, new_window, - ExposureMask|KeyPressMask|ButtonPressMask); + ExposureMask|KeyPressMask|ButtonPressMask|StructureNotifyMask); if (!theCursor) { theCursor = XCreateFontCursor(disp, XC_top_left_arrow); fg_color = PM_COLOR("Foreground"); ---------- Patch P2 for fixing =WxH+X0+Y0 command option ------ --- xgraph.c.orig 2000-09-10 07:05:47.000000000 -0700 +++ xgraph.c 2014-12-15 22:32:58.000000000 -0800 @@ -715,7 +721,7 @@ if (sizehints.x<0) sizehints.x = 0; sizehints.y += 25; } -#endif +#else /* Aspect ratio computation */ if (asp < 1.0) { @@ -723,6 +729,7 @@ } else { height = ((int) (((double) NORMSIZE) / asp)); } +#endif height = MAX(MINDIM, height); width = MAX(MINDIM, width);
Auto-assigned to maintainer sanpei@FreeBSD.org
Created attachment 151109 [details] update patch for patch-xgraph.c I checked jguojun's patch(2014-12-16 06:46 UTC) on my FreeBSD-11-current box. Unfortunately xgraph is core dumped. I created new patch(move init_X line to original line, because win_info->dev_info is not set in jguojun's patch). Please test my patch, jguojun. If you accept my patch, I will commit my patch.
I checked jguojun's patch(2014-12-16 06:46 UTC) on my FreeBSD-11-current box. Unfortunately xgraph is core dumped. I created new patch(update patch for patch-xgraph.c 2014-12-30 09:29 UTC, move init_X line to original line, because win_info->dev_info is not set in jguojun's patch). Please test my patch, jguojun. If you accept my patch, I will commit my patch.
(In reply to MIHIRA Sanpei Yoshiro from comment #3) New patch works and thanks for finding the issue that win_info->dev_info did not get set. Strangely, 8.4-amd64 did not coredump on this one. Please commit the patch.
(In reply to MIHIRA Sanpei Yoshiro from comment #3) I'm test new patch (2014-12-30 09:29 UTC) with FreeBSD 11.0-CURRENT #0 r280818 - work fine without patch xgraph (core dumped) Please commit the patch.
I already commited my updated patch(Revision 376508, Jan 8 01:23:17 2015).