bug in sunview under 4.0
jaksa at cpswh.cps.msu.edu
jaksa at cpswh.cps.msu.edu
Tue Feb 6 06:43:59 AEST 1990
A developer of sunview-based software has run into an anomaly using
sunview. The problem is explained in the header comment of the following
small program that demonstrates the problem.
Any information or insight regarding this would be appreciated.
Thanks,
Rob Jaksa
/* This small program illustrates what I take to be a bug in
the SUNVIEW software system. The program creates a canvas
window within a Frame. The canvas handler simply calls the
draw_and_erase routine, which draws a line segment within the
canvas using two points input by two LEFT mouse clicks. A
third mouse click should erase the line. The program works as
expected on Sun3 terminals and on Color Sparc stations. However,
on Monochrome Sparc stations the line segment is not always
completely erased. Line segments that are more than about
45 degrees to the horizontal are only partially erased;
sometimes most and sometimes very little of the line is
removed.
Compilation: cc demo.c -lsuntool -lsunwindow -lpixrect
*/
#include <stdio.h>
#include <suntool/sunview.h>
#include <suntool/canvas.h>
Frame base_frame;
Canvas canvas;
Pixwin *canvas_pw;
Rect *canvas_rect;
static void
canvas_handler(canvas, event, arg)
Canvas canvas;
Event *event;
caddr_t arg;
{
if (!((event_id(event) == LOC_STILL) &&
(event_id(event) == LOC_MOVE))) {
draw_and_erase();
}
}
draw_and_erase()
{
int x1,
y1,
x2,
y2;
Event event;
printf("\n enter draw and erase ");
/* wait for left click for first endpoint */
do {
window_read_event(canvas, &event);
if ((event_id(&event) == LOC_RGNEXIT) ||
(event_id(&event) == LOC_WINEXIT)) {
printf(" leave window \n");
return;
}
} while (event_id(&event) != MS_LEFT);
x1 = event_x(&event);
y1 = event_y(&event);
/* wait for left click for second endpoint */
do {
window_read_event(canvas, &event);
if ((event_id(&event) == LOC_RGNEXIT) ||
(event_id(&event) == LOC_WINEXIT)) {
printf(" leave window \n");
return;
}
} while (event_id(&event) != MS_LEFT);
x2 = event_x(&event);
y2 = event_y(&event);
/* draw edge */
pw_vector(canvas_pw, x1, y1, x2, y2, PIX_SRC, 1);
/* wait for left click to erase edge */
do {
window_read_event(canvas, &event);
if ((event_id(&event) == LOC_RGNEXIT) ||
(event_id(&event) == LOC_WINEXIT)) {
printf(" leave window \n");
return;
}
} while (event_id(&event) != MS_LEFT);
/* erase edge */
pw_vector(canvas_pw, x1, y1, x2, y2, PIX_NOT(PIX_SRC) & PIX_DST, 1);
}
main()
{
base_frame =
window_create(0, FRAME,
WIN_X, 100,
WIN_Y, 100,
WIN_WIDTH, 500,
WIN_HEIGHT, 500,
FRAME_SUBWINDOWS_ADJUSTABLE, FALSE, 0);
canvas =
window_create(base_frame, CANVAS,
WIN_EVENT_PROC, canvas_handler,
WIN_WIDTH, 500,
WIN_HEIGHT, 500,
WIN_IGNORE_PICK_EVENTS, WIN_UP_EVENTS, 0,
WIN_IGNORE_KBD_EVENT, WIN_NO_EVENTS,
CANVAS_FIXED_IMAGE, TRUE,
CANVAS_FAST_MONO, TRUE,
0);
window_set(canvas, WIN_CONSUME_PICK_EVENTS, LOC_STILL, LOC_RGNENTER, LOC_RGNEXIT, 0);
canvas_pw = canvas_pixwin(canvas);
canvas_rect = (Rect *) window_get(canvas, WIN_RECT);
window_main_loop(base_frame);
exit(0);
}
More information about the Comp.sys.sun
mailing list