Browse Source

The re-painting due to mouse-click under MS Windows is caused by line 561

of windisp.c. Upon left mouse button up the plot recangle is invalidated,
and a WM_PAINT message is generated (same on line 614 for right mouse
button up). If not re-pained, artifacts may be left on the canvas after
collecting coordinate data.

Shifting the command InvalidateRect to a place where it becomes active
only after the mouse has been moved, does the trick. Simple clicking
(right or left) will not cause a re-paint any more.
pre-master-46
Holger Vogt 4 years ago
parent
commit
ce9bc9fc64
  1. 7
      src/frontend/wdisp/windisp.c

7
src/frontend/wdisp/windisp.c

@ -558,7 +558,6 @@ LRESULT CALLBACK PlotWindowProc(HWND hwnd, UINT uMsg,
case WM_LBUTTONUP:
{
GRAPH *gr = pGraph(hwnd);
InvalidateRect (hwnd, NULL, TRUE);
xe = LOWORD (lParam);
ye = HIWORD (lParam);
WIN_ScreentoData(gr, xe, ye, &fxe, &fye);
@ -578,6 +577,8 @@ LRESULT CALLBACK PlotWindowProc(HWND hwnd, UINT uMsg,
}
else {
/* need to print info about two points */
/* trigger re-plotting the graph to get rid of the coordinate rectangle */
InvalidateRect (hwnd, NULL, TRUE);
fprintf(stdout, "\nx0 = %g, y0 = %g x1 = %g, y1 = %g\n",
fx0, fy0, fxe, fye);
fprintf(stdout, "dx = %g, dy = %g\n", fxe-fx0, fye - fy0);
@ -611,7 +612,6 @@ LRESULT CALLBACK PlotWindowProc(HWND hwnd, UINT uMsg,
case WM_RBUTTONUP:
{
GRAPH *gr = pGraph(hwnd);
InvalidateRect (hwnd, NULL, TRUE);
xe = LOWORD (lParam);
ye = HIWORD (lParam);
/* do nothing if mouse curser is not moved in both x and y */
@ -619,6 +619,9 @@ LRESULT CALLBACK PlotWindowProc(HWND hwnd, UINT uMsg,
SetFocus(swString);
goto WIN_DEFAULT;
}
/* trigger re-plotting the graph to get rid of the coordinate rectangle */
InvalidateRect(hwnd, NULL, TRUE);
WIN_ScreentoData(gr, xe, ye, &fxe, &fye);
strncpy(buf2, gr->plotname, sizeof(buf2));

Loading…
Cancel
Save