Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!psuvax1!vu-vlsi!elh From: elh@vu-vlsi.UUCP (Edward L. Hepler) Newsgroups: comp.sys.att Subject: Help with 3b1 track(3T) Message-ID: <1163@vu-vlsi.UUCP> Date: Fri, 16-Oct-87 00:46:07 EDT Article-I.D.: vu-vlsi.1163 Posted: Fri Oct 16 00:46:07 1987 Date-Received: Sat, 17-Oct-87 16:32:58 EDT Organization: Villanova Univ. EE Dept. Lines: 137 I have been trying to figure out how track(3T) works all evening! I assumed that one calls track and it returns when something happens which it thinks you should know about. I am getting very strange results. I have written a small program to try to get the feel for what is going on and have run out of ideas. Can anyone help me? I am running on a 3b1 release 3.5 of the OS, release 3.51 of the development tools. I compile using: cc -o dr d.c -ltam -ltermcap Many thanks, Ed Hepler elh@vu-vlsi The source for d.c follows: #include #include #include track_t screen_map; tkitem_t track_items[] = { {0, 0, 100, 100, (struct icon *)0, 1}, {0, 100, 100, 100, (struct icon *)0, 2}, {0, 200, 100, 100, (struct icon *)0, 3}, {100, 0, 300, 300, (struct icon *)0, 4}, {0,0,0,0,(struct icon *)0,0} }; main(argc,argv) int argc; char *argv[]; { int pw; pw = init_screen(); setup_screen(pw); cycle_screen(pw); } int init_screen() { int pw; winit(); if((pw = wcreate((short)1,(short)0,(short)24,(short)80, (unsigned short)NBORDER)) < 0) { perror("Couldn't open window"); exit(1); } clear(); return(pw); } restore_screen(pw,exit_code) int pw; int exit_code; { struct wstat curstat; clear(); curstat.begx = 0; curstat.begy = 1; curstat.height = 18; curstat.width = 80; curstat.uflags = BORDRESIZE | NOSETUFLAGS; wsetstat(pw,&curstat); wexit(exit_code); } setup_screen(pw) int pw; { int but,why; int reason; screen_map.t_flags = MSUP | MSDOWN; screen_map.t_scalex = screen_map.t_scaley = 1; screen_map.t_tkitems = track_items; reason = track(pw,&screen_map,T_BEGIN,&but,&why); wgoto(pw,2,0); wprintf(pw,"Init to track returned %d",reason); } cycle_screen(pw) int pw; { int but,why; int reason; int loop = 0; while(1) { wgoto(pw,3,0); wprintf(pw,"Loop is %d",loop); reason = track(pw,&screen_map,T_INPUT,&but,&why); switch(reason) { case Mouse: switch(why) { case MSIN: wgoto(pw,4,0); wprintf(pw,"Mouse entered window - loop %d",loop); break; case MSOUT: wgoto(pw,5,0); wprintf(pw,"Mouse outside window - loop %d",loop); break; case MSUP: wgoto(pw,6,0); wprintf(pw,"Mouse button up - loop %d",loop); break; case MSDOWN: wgoto(pw,7,0); wprintf(pw,"Mouse button down - loop %d",loop); break; default: wgoto(pw,8,0); wprintf(pw,"Unknown why - loop %d",loop); restore_screen(pw,1); break; } default: wgoto(pw,9,0); wprintf(pw,"Keycode returned: %o",reason); break; } loop++; } }